少年三国志突破10魏国:CCNP之IPSec VPN实验案例

来源:百度文库 编辑:偶看新闻 时间:2024/05/03 09:56:03
CCNP之IPSec VPN实验案例 2011-11-03 14:48:39 标签:CCNP ipsec-vpn 版权声明:原创作品,如需转载,请与作者联系。否则将追究法律责任。

实验要求:
1、 依据拓扑,搭建好环境,其中出差人员采用真实的 PC 机,桥接一台路由器再连接到 ISP;
2、 出差人员可以通过 PPTP 访问总部内网的 VLAN2,同时可以访问 ISP 上面的 WEB 服务 器;
3、 要求总分部之间建立起 IPSEC-VPN 用来安全地通过 ISP 传送之间的流量,其中 VLAN3 到 VLAN4 要求采用 3DES 加密,MD5 哈希;VLAN3 到 VLAN5 之间采用 AES 加密和 SHA 哈希,其他流量采用 DES 加密,MD5 哈希;
4、 确保总分部内网可以访问 ISP。
实验拓扑:
 
实验步骤:
1、 在总分部启用 PAT
GW1:
GW1(config)#ip nat inside source list 110 interface Serial1/0 overload
GW1(config)#access-list 110 deny ip 172.16.0.0 0.0.255.255 10.1.0.0 0.0.255.255
GW1(config)#access-list 110 permit ip 172.16.0.0 0.0.255.255 any
GW1(config)#ip route 0.0.0.0 0.0.0.0 Serial1/0
GW1(config)#interface Loopback0
GW1(config-if)#ip address 172.16.3.1 255.255.255.0
GW1(config-if)#ip nat inside
GW1(config)#interface Loopback1
GW1(config-if)#ip address 172.16.2.1 255.255.255.0
GW1(config-if)#ip nat inside
GW1(config)#interface Serial1/0
GW1(config-if)#ip address 201.1.1.2 255.255.255.0
GW1(config-if)#ip nat outside
GW2:
GW2(config)#ip nat inside source list 110 interface Serial1/0 overload
GW2(config)#access-list 110 deny ip 10.1.0.0 0.0.255.255 172.16.0.0 0.0.255.255
GW2(config)#access-list 110 permit ip 10.1.0.0 0.0.255.255 any
GW2(config)#ip route 0.0.0.0 0.0.0.0 Serial1/0
GW2(config)#interface Loopback0
GW2(config-if)#ip address 10.1.4.1 255.255.255.0
GW1(config-if)#ip nat inside
GW1(config)#interface Loopback1
GW1(config-if)#ip address 10.1.5.1 255.255.255.0
GW1(config-if)#ip nat inside
GW1(config)#interface Serial1/0
GW1(config-if)#ip address 202.1.1.2 255.255.255.0
GW1(config-if)#ip nat outside
Ping ISP 上的服务器:
R1#ping 200.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.5.1, timeout is 2 seconds: Packet sent with a source address of 172.16.3.1
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 168/253/400 ms
2、总分部之间建立起 IPSEC-VPN
定义 VLAN3 到 VLAN4 的流量:
GW1(config)#access-list 101 permit ip 172.16.3.0 0.0.0.255 10.1.4.0 0.0.0.255
定义 VLAN3 到 VLAN5 的流量:
GW1(config)#access-list 102 permit ip 172.16.3.0 0.0.0.255 10.1.5.0 0.0.0.255
定义其他流量:
GW1(config)#access-list 105 permit ip 172.16.0.0 0.0.255.255 10.1.0.0 0.0.255.255
IKE 阶段 1:
GW1(config)#crypto isakmp policy 1
GW1(config-crypto)#authentication pre-share GW1(config-crypto)#encryption 3des GW1(config-crypto)#group 1
GW1(config-crypto)#hash MD5
IKE 阶段 2:
GW1(config)#crypto isakmp key 0 cisco add 202.1.1.2
GW1(config)#crypro ipsec transform-set sovand esp-md5-hamc esp-3des    //MD5 哈希,3DES 加密
GW1(config)#crypro ipsec transform-set cisco esp-sha-hamc esp-aes    //SHA 哈希,AES 加密
GW1(config)#crypro ipsec transform-set hjw esp-md5-hamc esp-des    //MD5 哈希,DES 加密
定义map:
GW1(config)#crypto map ccnp 1 ipsec-isamap
GW1(config-crypto)#match add 101    //对应 VLAN3 到 VLAN4 的流量
GW1(config-crypto)#set peer 202.1.1.2    //目的网关 GW1(config-crypto)#set transform-set sovand    //调用加密算法 GW1(config)#int s0/1
GW1(config-if)#crypto map ccnp    //接口调用 MAP

GW1(config)#crypto map ccnp 2 ipsec-isamap
GW1(config-crypto)#match add 102    //对应 VLAN3 到 VLAN5 的流量
GW1(config-crypto)#set peer 202.1.1.2    //目的网关
GW1(config-crypto)#set transform-set cisco    //调用加密算法

GW1(config)#crypto map ccnp 3 ipsec-isamap
GW1(config-crypto)#match add 105    //对应其他流量
GW1(config-crypto)#set peer 202.1.1.2        //目的网关
GW1(config-crypto)#set transform-set hjw        //调用加密算法

在 GW2 上做相同的配置:
定义 VLAN4 到 VLAN3 的流量:
GW2(config)#access-list 101 permit ip 10.1.4.0 0.0.0.255 172.16.3.0 0.0.0.255
定义 VLAN5 到 VLAN3 的流量:
GW2(config)#access-list 102 permit ip 10.1.5.0 0.0.0.255 172.16.3.0 0.0.0.255
定义其他流量:
GW2(config)#access-list 105 permit ip 10.1.0.0 0.0.255.255 172.16.0.0 0.0.255.255
IKE 阶段 1:
GW2(config)#crypto isakmp policy 1
GW2(config-crypto)#authentication pre-share
GW2(config-crypto)#encryption 3des
GW2(config-crypto)#group 1
GW2(config-crypto)#hash MD5
IKE 阶段 2:
GW2(config)#crypto isakmp key 0 cisco add 201.1.1.2
GW2(config)#crypro ipsec transform-set sovand esp-md5-hamc esp-3des    //MD5 哈希,3DES 加密
GW2(config)#crypro ipsec transform-set cisco esp-sha-hamc esp-aes    //SHA 哈希,AES 加密
GW2(config)#crypro ipsec transform-set hjw esp-md5-hamc esp-des    //MD5 哈希,DES 加密
定义 map:
GW2(config)#crypto map ccnp 1 ipsec-isamap
GW2(config-crypto)#match add 101    //对应 VLAN4 到 VLAN3 的流量
GW2(config-crypto)#set peer 201.1.1.2    //目的网关
GW1(config-crypto)#set transform-set sovand    //调用加密算法 GW1(config)#int s0/1
GW1(config-if)#crypto map ccnp    //接口调用 MAP

GW1(config)#crypto map ccnp 2 ipsec-isamap
GW1(config-crypto)#match add 102    //对应 VLAN5 到 VLAN3 的流量
GW1(config-crypto)#set peer 201.1.1.2    //目的网关
GW1(config-crypto)#set transform-set cisco    //调用加密算法

GW1(config)#crypto map ccnp 3 ipsec-isamap
GW1(config-crypto)#match add 105    //对应其他流量
GW1(config-crypto)#set peer 201.1.1.2        //目的网关
GW1(config-crypto)#set transform-set hjw        //调用加密算法 测试 VPN 能否互通:
GW1#ping 10.1.4.1 source 172.16.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.4.1, timeout is 2 seconds: Packet sent with a source address of 172.16.3.1
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 216/237/260 ms

GW1#ping 10.1.5.1 source 172.16.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.5.1, timeout is 2 seconds: Packet sent with a source address of 172.16.3.1
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 168/253/400 ms

GW2#ping 172.16.3.1 source 10.1.4.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.1, timeout is 2 seconds:
Packet sent with a source address of 10.1.4.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 196/275/384 ms

GW2#ping 172.16.3.1 source 10.1.5.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.3.1, timeout is 2 seconds: Packet sent with a source address of 10.1.5.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 212/252/288 ms

GW2#show crypto engine connections active
ID Interface
1 Serial1/0    IP-Address
202.1.1.2    State set    Algorithm     Encry
HMAC_MD5+3DES_56_C    pt    Decrypt
0       

0       
2001 Serial1/0    202.1.1.2    set    3DES+MD5    0            9   
2002 Serial1/0    202.1.1.2    set    3DES+MD5    9            0   
2003 Serial1/0    202.1.1.2    set    AES+SHA        0            9
2004 Serial1/0    202.1.1.2    set    AES+SHA        9            0
从上面可知,GW2 共收到 9 个 3DES+MD5 的加密和解密报文,以及 9 个 AES+SHA 的加密和解密报文。
3、配置 PPTP
GW1(config)#vpdn enable GW1(config)#vpdn-group cisco GW1(config-vpdn)#accept-dialin GW1(config-vpdn-acc-in)#protocal pptp
GW1(config-vpdn-acc-in)#virtual-template 1
GW1(config)#int virtual-template 1
GW1(config-if)#ip unnmbered s0/0
GW1(config-if)#ppp authen ms-chap
GW1(config-if)#ppp encrpy mppe auto    //加密密钥
GW1(config-if)#peer default ip add pool sovand    //创建地址池名称
GW1(config)#ip local pool sovand 172.16.100.1 172.16.100.255    //创建地址池
GW1(config)#username hjw2011 privilege 15 pass qwaszx
4、在 PC 上创建 VPN 连接(用虚拟机模拟)
在 windows 系统下创建虚拟专用网络: 
 
开始 VPN 拨号: 
 
查看 VPN 状态: |

测试 VPN 对内网和外网的访问: 

经测试,VPN 可以同时访问内网和外网。