A-A+

多点IPsecVPN和NAT-T穿越的实现的实验

2016年01月05日 站长资讯 暂无评论

实验拓扑图和实验环境:

在GNS3上面搭建五台路由器和三台PC机,R1,R4,R5作为VPN路由器,R2作为NAT地址转换路由器,ISP路由器作为运营商,使用VPCS模拟PC机客户端

实验要求:

配置多点IPsecVPN,实现C1能访问C2和C3,在NAT地址转换的环境下配置NAT-T,使外网的可以发起VPN隧道连接。

实验步骤:

配置各路由器接口和PC机IP地址:

  1. R1:  
  2. R1(config)#int f0/0  
  3. R1(config-if)#ip add 192.168.10.1 255.255.255.0  
  4. R1(config-if)#no shu  
  5. R1(config-if)#int f0/1  
  6. R1(config-if)#ip add 172.16.10.1 255.255.255.0  
  7. R1(config-if)#no shut  
  8.   
  9. R2:  
  10. R2(config)#int f0/0  
  11. R2(config-if)#ip add 172.16.10.2 255.255.255.0  
  12. R2(config-if)#no shut  
  13. R2(config-if)#int f0/1  
  14. R2(config-if)#ip add 100.1.1.1 255.255.255.252  
  15. R2(config-if)#no shut  
  16.   
  17. ISP:  
  18. R3(config)#int f0/0  
  19. R3(config-if)#ip add 100.1.1.2 255.255.255.252  
  20. R3(config-if)#no shut  
  21. R3(config-if)#int f0/1  
  22. R3(config-if)#ip add 150.1.1.1 255.255.255.252  
  23. R3(config-if)#no shut  
  24.   
  25. R4:  
  26. R4(config)#int f0/0  
  27. R4(config-if)#ip add 150.1.1.2 255.255.255.252  
  28. R4(config-if)#no shut  
  29. R4(config-if)#int f0/1  
  30. R4(config-if)#ip add 12.1.1.1 255.255.255.0   
  31. R4(config-if)#no shut  
  32.   
  33. R5:  
  34. R5(config)#int f0/0  
  35. R5(config-if)#ip add 200.1.1.2 255.255.255.252  
  36. R5(config-if)#no shut  
  37. R5(config-if)#int f0/1  
  38. R5(config-if)#ip add 13.1.1.1 255.255.255.0  
  39. R5(config-if)#no shut  
  40.   
  41. PC:  
  42.   
  43. 配置默认路由:  
  44.   
  45. R1(config)#ip route 0.0.0.0 0.0.0.0 172.16.10.2  
  46.   
  47. R2(config)#ip route 0.0.0.0 0.0.0.0 100.1.1.2  
  48.   
  49. R4(config)#ip route 0.0.0.0 0.0.0.0 150.1.1.1  
  50.   
  51. R5(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.1  

接下来配置IPsecVPN:

  1. R1到R4之间的VPN隧道:  
  2. R1(config)#crypto isakmp policy 1  
  3. R1(config-isakmp)#encryption des  
  4. R1(config-isakmp)#authentication pre-share   
  5. R1(config-isakmp)#hash sha  
  6. R1(config-isakmp)#group 2  
  7. R1(config-isakmp)#lifetime 60  
  8. R1(config-isakmp)#ex  
  9. R1(config)#crypto isakmp key 0 abc123 address 150.1.1.2  
  10. R1(config)#access-list 110 permit ip 192.168.10.0 0.0.0.255 12.1.1.0 0.0.0.255                  
  11. R1(config)#crypto ipsec transform-set benet esp-des esp-sha-hmac   
  12. R1(cfg-crypto-trans)#ex  
  13. R1(config)#crypto map benetmap 1 ipsec-isakmp   
  14. R1(config-crypto-map)#set peer 150.1.1.2  
  15. R1(config-crypto-map)#set transform-set benet  
  16. R1(config-crypto-map)#match address 110  
  17. R1(config-crypto-map)#ex  
  18. R1(config)#int f0/1  
  19. R1(config-if)#crypto map benetmap  

配置实现多点IPsecVPN:

在R1上建立与R5的共享密钥和保护流量的ACL,还需要建立新的crypto map:

  1. R1(config)#crypto isakmp key 0 abc123 address 150.1.1.2  
  2. R1(config)#access-list 110 permit ip 192.168.10.0 0.0.0.255 12.1.1.0 0.0.0.255      
  3. R1(config)#crypto map benetmap 2 ipsec-isakmp  //使用相同的映射名称,但序列号不同  
  4. R1(config-crypto-map)#set peer 200.1.1.2  
  5. R1(config-crypto-map)#set transform-set benet  
  6. R1(config-crypto-map)#match address 120  

R4的隧道配置:

  1. R4(config)#crypto isakmp policy 1  
  2. R4(config-isakmp)#authentication pre-share   
  3. R4(config-isakmp)#hash sha  
  4. R4(config-isakmp)#group 2  
  5. R4(config-isakmp)#lifetime 60  
  6. R4(config-isakmp)#ex  
  7. R4(config)#crypto isakmp key 0 abc123 address 100.1.1.1  
  8. R4(config)#access-list 110 permit ip 12.1.1.0 0.0.0.255 192.168.10.0 0.0.0.255           
  9. R4(config)#crypto ipsec transform-set benet esp-des esp-sha-hmac   
  10. R4(cfg-crypto-trans)#ex http://www.luyouqiwang.com/fast/  
  11. R4(config)#crypto map benetmap 1 ipsec-isakmp   
  12. R4(config-crypto-map)#set peer 100.1.1.1  
  13. R4(config-crypto-map)#set transform-set benet  
  14. R4(config-crypto-map)#match address 110  
  15. R4(config-crypto-map)#ex  
  16. R4(config)#int f0/0  
  17. R4(config-if)#crypto map benetmap  

R5的隧道配置:

  1. R5(config)#crypto isakmp policy 1  
  2. R5(config-isakmp)#encryption des  
  3. R5(config-isakmp)#authentication pre-share   
  4. R5(config-isakmp)#hash sha  
  5. R5(config-isakmp)#group 2  
  6. R5(config-isakmp)#lifetime 60  
  7. R5(config-isakmp)#ex  
  8. R5(config)#crypto isakmp key 0 abc456 address 100.1.1.1  
  9. R5(config)#access-list 120 permit ip 13.1.1.0 0.0.0.255 192.168.10.0 0.0.0.255           
  10. R5(config)#crypto ipsec transform-set benet esp-des esp-sha-hmac   
  11. R5(cfg-crypto-trans)#ex  
  12. R5(config)#crypto map benetmap 2 ipsec-isakmp   
  13. R5(config-crypto-map)#set peer 100.1.1.1  
  14. R5(config-crypto-map)#set transform-set benet  
  15. R5(config-crypto-map)#match address 120  
  16. R5(config-crypto-map)#ex  
  17. R5(config)#int f0/0  
  18. R5(config-if)#crypto map benetmap  

在NAT路由器上做NAT-T穿越:

NAT-T在阶段一建立过中检测对等体之间是否存在地址转换设备,如果有,会在后续数据包中的IP包头和ESP包头之间插入一个标准的UDP包头。

  1. R2(config)#ip nat inside source list 1 interface f0/1 overload  //作一条PAT转换私有地址  
  2. R2(config)#ip nat inside source static udp 172.16.10.1 500 100.1.1.1 500   //配置管理连接的静态端口映射  
  3. R2(config)#ip nat inside source static udp 172.16.10.1 4500 100.1.1.1 4500  //配置数据连接的静态端口映射  

测试C1与C2和C3通信,成功。实验完成。

标签:

给我留言