R1:
interface GigabitEthernet0/0
port link-mode route
combo enable copper
ip address 10.0.12.1 255.255.255.0
#
interface GigabitEthernet0/1
port link-mode route
combo enable copper
ip address 20.1.1.1 255.255.255.0
#
interface Tunnel0 mode gre //配置tunnel 接口
ip address 192.168.1.1 255.255.254.0 //自定义本地tunnel地址
source 10.0.12.1 //本地互联地址
destination 10.0.23.3 //对端互联地址
ipsec apply policy 1 //在tunnel接口下调用ipsec策略
#
ip route-static 0.0.0.0 0 10.0.12.2 //配置静态路由,R1出去的流量下一跳为12.2
ip route-static 30.1.1.0 24 Tunnel0 //配置访问30地址的流量出口为tunnel
#
acl advanced 3000 //acl访问防护
rule 0 permit ip source 20.1.1.0 0.0.0.255 destination 30.1.1.0 0.0.0.255
#
ipsec transform-set 1(协议名字) //配置ipsec提议,加密算法为3des-cbc,认证算法为MD5
esp encryption-algorithm 3des-cbc
esp authentication-algorithm md5
#
ipsec policy 1 10 isakmp //配置ipsec策略,调用acl,ipsec提议,指定对端tunnel地址
transform-set 1
security acl 3000
remote-address 192.168.1.2
#
ike keychain 1 //配置ike 密钥,地址为对端tunnel地址
pre-shared-key address 192.168.1.2 255.255.255.255 key si(认证密码)
#
R3:
interface GigabitEthernet0/0
port link-mode route
combo enable copper
ip address 10.0.23.3 255.255.255.0
#
interface GigabitEthernet0/1
port link-mode route
combo enable copper
ip address 30.1.1.1 255.255.255.0
#
interface Tunnel0 mode gre //配置tunnel 接口
ip address 192.168.1.2 255.255.254.0 //自定义本地tunnel地址
source 10.0.23.3 //本地互联地址
destination 10.0.12.1 //对端互联地址
ipsec apply policy 1 //在tunnel接口下调用ipsec策略
#
ip route-static 0.0.0.0 0 10.0.23.2 //配置静态路由,R1出去的流量下一跳为12.2
ip route-static 20.1.1.0 24 Tunnel0 //配置访问30地址的流量出口为tunnel
#
acl advanced 3000 //acl访问防护
rule 0 permit ip source 30.1.1.0 0.0.0.255 destination 20.1.1.0 0.0.0.255
#
ipsec transform-set 1(协议名字) //配置ipsec提议,加密算法为3des-cbc,认证算法为MD5
esp encryption-algorithm 3des-cbc
esp authentication-algorithm md5
#
ipsec policy 1 10 isakmp //配置ipsec策略,调用acl,ipsec提议,指定对端tunnel地址
transform-set 1
security acl 3000
remote-address 192.168.1.1
#
ike keychain 1 //配置ike 密钥,地址为对端tunnel地址
pre-shared-key address 192.168.1.1 key si(认证密码)
#
检查下配置