拓扑图如下:
说明:ISP之间使用OSPF动态路由协议,R1和R3模拟边界路由,并启用PAT,PC1和PC2模拟内网主机。
要求:PC1和PC2能够使用私有IP加密互访,其他Internet流量使用常规PAT访问。
各设备配置如下:
PC1:
conf tint f0/0 ip add 192.168.0.1 255.255.255.0 no shut exitno ip routingip default-gateway 192.168.0.2endwr
PC2:
conf tint f0/0 ip add 172.16.0.1 255.255.255.0 no shut exitno ip routingip default-gateway 172.16.0.2endwr
R1:
conf tint e0/0 ip add 192.168.0.2 255.255.255.0 duplex full ip nat inside no shutint e0/1 ip add 1.0.0.1 255.255.255.252 duplex full ip nat outside no shut exitaccess-list 1 permit anyip nat inside source list 1 interface e0/1 overloadip route 0.0.0.0 0.0.0.0 1.0.0.2crypto isakmp enablecrypto isakmp policy 1 encryption aes hash sha group 2 authentication pre-share exitcrypto isakmp key 0 IPSEC-TUNNEL address 2.0.0.1access-list 100 permit gre host 1.0.0.1 host 2.0.0.1access-list 100 permit ip 192.168.0.0 0.0.0.255 172.16.0.0 0.0.0.255crypto ipsec transform-set myset ah-sha-hmac esp-md5-hmac esp-3des mode tunnel exitcrypto map mymap 1 ipsec-isakmp match address 100 set transform-set myset set peer 2.0.0.1 exitint e0/1 crypto map mymapint tunnel 0 ip add 100.0.0.1 255.255.255.252 tunnel source 1.0.0.1 tunnel destination 2.0.0.1 crypto map mymap keepalive 2 3 no shutdown exitip route 172.16.0.0 255.255.255.0 tunnel 0do wr
R3:
conf tint e0/1 ip add 172.16.0.2 255.255.255.0 duplex full ip nat inside no shutint e0/0 ip add 2.0.0.1 255.255.255.252 duplex full ip nat outside no shut exitaccess-list 1 permit anyip nat inside source list 1 interface e0/0 overloadip route 0.0.0.0 0.0.0.0 2.0.0.2crypto isakmp enablecrypto isakmp policy 1 encryption aes hash sha group 2 authentication pre-share exitcrypto isakmp key 0 IPSEC-TUNNEL address 1.0.0.1access-list 100 permit gre host 2.0.0.1 host 1.0.0.1access-list 100 permit ip 172.16.0.0 0.0.0.255 192.168.0.0 0.0.0.255crypto ipsec transform-set myset ah-sha-hmac esp-md5-hmac esp-3des mode tunnel exitcrypto map mymap 1 ipsec-isakmp match address 100 set transform-set myset set peer 1.0.0.1 exitint e0/0 crypto map mymapint tunnel 0 ip add 100.0.0.2 255.255.255.252 tunnel source 2.0.0.1 tunnel destination 1.0.0.1 crypto map mymap keepalive 2 3 no shutdown exitip route 192.168.0.0 255.255.255.0 tunnel 0do wr
ISP1:
conf tint e0/1 ip add 1.0.0.2 255.255.255.252 duplex full no shutint e0/0 ip add 12.0.0.1 255.255.255.252 duplex full no shut exitrouter ospf 100 network 1.0.0.0 0.0.0.3 area 0 network 12.0.0.0 0.0.0.3 area 0 exitdo wr
ISP2:
conf tint e0/0 ip add 12.0.0.2 255.255.255.252 duplex full no shutint e0/1 ip add 2.0.0.2 255.255.255.252 duplex full no shut exitrouter ospf 100 network 2.0.0.0 0.0.0.3 area 0 network 12.0.0.0 0.0.0.3 area 0 exitdo wr