网络拓扑如下
一、公司A端外网路由器配置
#
//定义允许NAT的数据流
acl
number 2000
rule 10 permit source 192.168.1.0 0.0.0.255
#
interface Ethernet0/0
port link-mode route
//
在公网接口绑定
NAT
转换
nat outbound 2000
ip address 12.12.12.1 255.255.255.0
#
//
私网接口
interface Ethernet0/1
port link-mode route
ip address 192.168.1.1 255.255.255.0
//配置默认路由
ip route-static 0.0.0.0 0.0.0.0 12.12.12.2
//配置去往内网网段的回程路由
ip route-static 192.168.1.0 255.255.255.0 10.0.0.2
二、公司A端外网路由器配置
//定义需要保护的
安全数据流
acl
number 3000
rule 10 permit ip source 192.168.1.0 0.0.0.255 destination 192.168.2.0 0.0.0.255
#
//
指定本端的
IKE
名字
ike local-name rta
#
ike
peer rtb
//
指定为野蛮模式
exchange-mode aggressive
pre-shared-key 123
//
使用
name
识别
id-type name
//
对端名字
remote-name rtb
//对端地址,私网侧必须配置
remote-address 23.23.23.3
//
使能
NAT
检测与穿越
nat traversal
#
//
定义
IPSec
提议
ipsec
proposal to_rtb (注:使用默认值:隧道模式、MD5认证、DES加密)
#
//
定义
IPSec
策略,协商方式为
isakmp
,即使用
IKE
协商
ipsec
policy to_rtb 1 isakmp
//
定义需要加密传送的
ACL
security acl 3000
//
选择使用的
IKE
对等体
ike-peer to_rtb
//
选择安全策略
proposal to_rtb
#
interface Ethernet0/0
port link-mode route
description WAN
ip address 10.0.0.2 255.255.255.0
//
将安全策略绑定在端口下
ipsec policy to_rtb
#
interface Ethernet0/1
port link-mode route
description LAN
ip address 192.168.1.1 255.255.255.0
#
//
定义默认路由
ip route-static 0.0.0.0 0.0.0.0 10.0.0.1
三、公司B端路由器配置
//定义需要保护的
安全数据流
acl
number 3000
rule 10 permit ip source 192.168.2.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
#
//
指定本端的
IKE
名字
ike local-name rtb
#
ike
peer rta
//
指定为野蛮模式
exchange-mode aggressive
pre-shared-key 123
//
使用
name
识别
id-type name
//
对端名字
remote-name rta
//
使能
NAT
检测与穿越
nat traversal
#
//
定义
IPSec
提议
ipsec
proposal to_rtb (注:使用默认值:隧道模式、MD5认证、DES加密)
#
//
定义
IPSec
策略,协商方式为
isakmp
,即使用
IKE
协商
ipsec
policy to_rtb 1 isakmp
//
定义需要加密传送的
ACL
security acl 3000
//
选择使用的
IKE
对等体
ike-peer to_rtb
//
选择安全策略
proposal to_rtb
#
interface Ethernet0/0
port link-mode route
description WAN
ip address 23.23.23.3 255.255.255.0
//
将安全策略绑定在端口下
ipsec policy to_rta
#
interface Ethernet0/1
port link-mode route
description LAN
ip address 192.168.1.1 255.255.255.0
#
//
定义默认路由
ip route-static 0.0.0.0 0.0.0.0 23.23.23.2
配置完成后IPSEC的连接必须由A公司端先发起,在A公司端的内网路由器上通过命令ping -a 192.168.1.1 192.168.2.1来激活IPSEC连接,ping完成后通过display ike sa和display ipsec sa查看ike和ipsec的sa建立情况。
配置关键点:
1) 先配置A端外网路由器的NAT,保证A端内网可以访问B端的公网路由器
2) A和B都要定义IKE Local-Name;
3) 使用IKE Peer的野蛮模式;
4) 指定IKE Peer的id-type为name;
5) A和B都需要指定remote-name;
6) A上还需要指定remote-address,因为A端处于私网侧;
7) A和B都需要使能NAT探测与穿越。
转载于:https://blog.51cto.com/sfwang/438621