在第一台主机上创建手动隧道

您可以使用 SMITips4_basic 快速路径(用于 IP V4)和 SMIT ips6_basic 快速路径(用于 IP V6)配置隧道,也可以使用以下过程手动创建隧道。

下面是一个用于创建人工隧道的 gentun 命令的示例:

gentun -v 4 -t manual -s 5.5.5.19 -d 5.5.5.8 \
   -a HMAC_MD5 -e DES_CBC_8 -N 23567 

您可以使用 lstun -v 4 命令列出由前面的示例创建的人工隧道的特征。 输出类似以下示例:

Tunnel ID            : 1
IP Version           : IP Version 4
Source               : 5.5.5.19
Destination          : 5.5.5.8
Policy               : auth/encr
Tunnel Mode          : Tunnel
Send AH Algo         : HMAC_MD5
Send ESP Algo        : DES_CBC_8
Receive AH Algo      : HMAC_MD5
Receive ESP Algo     : DES_CBC_8
Source AH SPI        : 300
Source ESP SPI       : 300
Dest AH SPI          : 23576
Dest ESP SPI         : 23576
Tunnel Life Time     : 480
Status               : Inactive
Target               : -
Target Mask          : -
Replay               : No
New Header           : Yes
Snd ENC-MAC Algo     : -
Rcv ENC-MAC Algo     : -

要激活隧道,请输入以下代码:

mktun -v 4 -t1
将会自动生成与隧道有关的过滤规则。
要查看过滤规则,使用 lsfilt -v 4 命令。 输出类似以下示例:
Rule 4:
Rule action           : permit
Source Address        : 5.5.5.19
Source Mask           : 255.255.255.255
Destination Address   : 5.5.5.8
Destination Mask      : 255.255.255.255
Source Routing        : yes
Protocol              : all
Source Port           : any 0
Destination Port      : any 0
Scope                 : both
Direction             : outbound
Logging control       : no
Fragment control      : all packets
Tunnel ID number      : 1
Interface             : all
Auto-Generated        : yes

Rule 5:
Rule action           : permit
Source Address        : 5.5.5.8
Source Mask           : 255.255.255.255
Destination Address   : 5.5.5.19
Destination Mask      : 255.255.255.255
Source Routing        : yes
Protocol              : all
Source Port           : any 0
Destination Port      : any 0
Scope                 : both
Direction             : inbound
Logging control       : no
Fragment control      : all packets
Tunnel ID number      : 1
Interface             : all
Auto-Generated        : yes 

要激活过滤规则 (包括缺省过滤规则) ,请使用 mktun -v 4 -t 1 命令。

要设置另一边(当它是使用该操作系统的另一台机器时),可以从主机 A 上导出隧道定义,然后将其导入到主机 B。

以下命令将隧道定义导出到一个名为 ipsec_tun_manu.exp 的文件中,并且目录中任何与文件 ipsec_fltr_rule.exp 关联的过滤规则都由 -f 标志表示:
 exptun -v 4 -t 1 -f /tmp