A-A+

思科路由器EzVPN解决地址重叠测试

2015年11月23日 站长资讯 暂无评论

一.概述:

EzVPN,如果硬件客户端身后的地址,与EzVPN server身后的地址重叠,即使是client模式的单向访问也无法实现,需要配置静态NAT,为了不影响总部上公网,需要把静态NAT与动态PAT分开。

二.基本思路:

A.EzVPN Client模式:

----这种只是分支机构单向访问总部,在总部配置静态NAT,使得分支机构访问总部主机时认为是另外一个网段的地址

----为了能够使得总部配置静态NAT还能上公网,总部路由器的内网口和外网口作为ip nat enable的一对口,配置PAT;将loopback和外网口分别配置ip nat inside和ip nat outside,作为一对口,配置静态NAT,同时为了使流量能够到达loopback口,在内网口配置PBR,将需要VPN的流量打到loopback口,流量在进行VPN之前就进行静态NAT。

B.EzVPN network-extension或network-plus模式:

----这两种种方式,因为可以双方向互访,为了实现双方向互访,需要总部配置对内和对外的两条静态NAT,同时为了能把静态NAT和动态PAT上公网的流量分开,采用不同的NAT配置方法来实现。

三.测试拓扑:

四.基本配置:

  1. A.总部Server路由器:  
  2. interface Ethernet0/0  
  3. ip address 10.1.1.2 255.255.255.0  
  4. no shut  
  5. ip route 0.0.0.0 0.0.0.0 10.1.1.1  
  6. B.总部Center路由器:  
  7. interface Ethernet0/0  
  8. ip address 10.1.1.1 255.255.255.0  
  9. no shut  
  10. interface Ethernet0/1  
  11. ip address 202.100.1.1 255.255.255.0  
  12. no shut  
  13. ip route 0.0.0.0 0.0.0.0 202.100.1.10  
  14. C.Internet路由器:  
  15. interface Ethernet0/0  
  16. ip address 202.100.1.10 255.255.255.0  
  17. no shut  
  18. interface Ethernet0/1  
  19. ip address 202.100.2.10 255.255.255.0  
  20. no shut  
  21. D.Branch路由器:  
  22. interface Ethernet0/0  
  23. ip address 10.1.1.1 255.255.255.0  
  24. no shut  
  25. interface Ethernet0/1  
  26. ip address 202.100.2.1 255.255.255.0  
  27. no shut  
  28. ip route 0.0.0.0 0.0.0.0 202.100.2.10  
  29. E.分支inside路由器:  
  30. interface Ethernet0/0  
  31. ip address 10.1.1.2 255.255.255.0  
  32. no shut  
  33. ip route 0.0.0.0 0.0.0.0 10.1.1.1  

五.EzVPN配置:

A.EzVPN Server总部Center路由器:

  1. ①第一阶段:  
  2. crypto isakmp policy 10  
  3. authentication pre-share  
  4. en des  
  5. group 2  
  6. hash md5  
  7. crypto isakmp client configuration group ipsecgroup  
  8. key cisco  
  9. ②第1.5阶段XAUTH配置:  
  10. aaa new-model  
  11. aaa authentication login noacs line none  
  12. line console 0  
  13.  login authentication noacs  
  14. line aux 0  
  15.  login authentication noacs  
  16. username xll password xll  
  17. aaa authentication login xauth-authen local  
  18. ③第1.5阶段MODE-CFG配置:  
  19. ip local pool ippool 123.1.1.100 123.1.1.200  
  20. ip access-list extended split  
  21. permit ip 172.16.1.0 0.0.0.255 any  
  22. aaa authorization network mcfg-author local  
  23. crypto isakmp client configuration group ipsecgroup  
  24.  pool ippool  
  25.  acl split  
  26. ④第2阶段转换集与动态map配置:  
  27. crypto ipsec transform-set ezvpnset esp-des esp-md5-hmac  
  28. crypto dynamic-map dymap 10  
  29. set transform-set ezvpnset   
  30. reverse-route   
  31. ⑤第2阶段crypto map配置:  
  32. crypto map cry-map client authentication list xauth-authen  
  33. crypto map cry-map isakmp authorization list mcfg-author  
  34. crypto map cry-map client configuration address respond  
  35. crypto map cry-map 10 ipsec-isakmp dynamic dymap  
  36. interface E0/1  
  37. crypto map cry-map  

B.EzVPN硬件客户端Branch路由器配置:

  1. ①EzVPN基本配置:  
  2. crypto ipsec client ezvpn Ez-Client  
  3. connect manual  
  4. group ipsecgroup key cisco  
  5. mode client   
  6. peer 202.100.1.1  
  7. interface e0/0  
  8. crypto ipsec client ezvpn Ez-Client inside  
  9. interface e0/1  
  10. crypto ipsec client ezvpn Ez-Client outside  
  11. ②手动触发EzVPN连接:  
  12. crypto ipsec client ezvpn connect  
  13. crypto ipsec client ezvpn xauth  
  14. Username: xll  
  15. Password: xll  
  16. Branch#  
  17. *Mar  1 00:05:21.047: %CRYPTO-6-EZVPN_CONNECTION_UP: (Client)  User=  Group=ipsecgroup  Client_public_addr=202.100.2.1  Server_public_addr=202.100.1.1  Assigned_client_addr=123.1.1.100    
  18. Branch#show crypto ipsec client ezvpn   
  19. Easy VPN Remote Phase: 4  
  20. Tunnel name : Ez-Client  
  21. Inside interface list: Ethernet0/0  
  22. Outside interface: Ethernet0/1   
  23. Current State: IPSEC_ACTIVE  
  24. Last Event: SOCKET_UP  
  25. Address: 123.1.1.100  
  26. Mask: 255.255.255.255  
  27. Save Password: Disallowed  
  28. Split Tunnel List: 1  
  29.       Address    : 172.16.1.0  
  30.       Mask       : 255.255.255.0  
  31.       Protocol   : 0x0  
  32.       Source Port: 0  
  33.       Dest Port  : 0  
  34. Current EzVPN Peer: 202.100.1.1  

----这时虽然VPN能连接上去但是,无法连接内网

六.NAT及策略路由配置:

A.动态PAT配置:

  1. ①总部Center路由器配置:  
  2. interface Ethernet0/0  
  3. ip nat enable  
  4. interface Ethernet0/1  
  5. ip nat enable  
  6. ip access-list extended Internet  
  7. deny   ip 10.1.1.0 0.0.0.255 123.1.1.0 0.0.0.255  
  8. permit ip 10.1.1.0 0.0.0.255 any   
  9. ip nat source list Internet interface Ethernet0/1 overload  
  10. 测试:  
  11. Server#ping 202.100.1.10   
  12.   
  13. Type escape sequence to abort.  
  14. Sending 5, 100-byte ICMP Echos to 202.100.1.10, timeout is 2 seconds:  
  15. !!!!!  
  16. Success rate is 100 percent (5/5), round-trip min/avg/max = 48/105/216 ms  
  17. Server#  
  18. ②分支branch路由器配置:  
  19. interface Ethernet0/0  
  20. ip nat enable  
  21. interface Ethernet0/1  
  22. ip nat enable  
  23. ip access-list extended Internet  
  24. deny   ip 10.1.1.0 0.0.0.255 172.16.1.0 0.0.0.255  
  25. permit ip 10.1.1.0 0.0.0.255 any  
  26. ip nat source list Internet interface Ethernet0/1 overload  
  27. 测试:  
  28. Inside#ping 202.100.2.1  
  29.   
  30. Type escape sequence to abort.  
  31. Sending 5, 100-byte ICMP Echos to 202.100.2.1, timeout is 2 seconds:  
  32. !!!!!  
  33. Success rate is 100 percent (5/5), round-trip min/avg/max = 20/60/120 ms  

B.静态NAT及策略路由配置:

---只需在总部Center路由器上配置

  1. interface Loopback0  
  2. ip address 1.1.1.1 255.255.255.252  
  3. ip nat inside  
  4. interface Ethernet0/1  
  5. ip nat outside  
  6. ip nat inside source static network 10.1.1.0 172.16.1.0 /24  
  7. ip access-list extended VPN  
  8. permit ip 10.1.1.0 0.0.0.255 123.1.1.0 0.0.0.255  
  9. route-map VPN permit 10  
  10. match ip address VPN  
  11. set interface Loopback0  
  12. interface Ethernet0/0  
  13. ip policy route-map VPN  
  14. C.测试:  
  15. clear crypto ipsec client ezvpn   
  16. crypto ipsec client ezvpn connect  
  17. crypto ipsec client ezvpn xauth  
  18. Username: xll  
  19. Password: xll  
  20. *Mar  1 00:09:33.803: %CRYPTO-6-EZVPN_CONNECTION_UP: (Client)  User=  Group=ipsecgroup  Client_public_addr=202.100.2.1  Server_public_addr=202.100.1.1  Assigned_client_addr=123.1.1.101   
  21.   
  22. Branch#  
  23. Inside#ping 172.16.1.2  
  24. Type escape sequence to abort.  
  25. Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:  
  26. !!!!!  
  27. Success rate is 100 percent (5/5), round-trip min/avg/max = 196/265/392 ms  
  28. Inside#  

七.后记:

----如果EzVPN采用的是网络拓展模式或者网络拓展加模式,因为两边都可以主动发起访问,配置的方式跟上面有所不同,跟L2L IPSEC VPN类似:

A.动态PAT配置:

  1. ①总部Center路由器配置:  
  2. interface Ethernet0/0  
  3. ip nat enable  
  4. interface Ethernet0/1  
  5. ip nat enable  
  6. ip access-list extended Internet  
  7. deny   ip 10.1.1.0 0.0.0.255 192.168.1.0 0.0.0.255  
  8. permit ip 10.1.1.0 0.0.0.255 any  
  9. ip nat source list Internet interface Ethernet0/1 overload  
  10. ②分支branch路由器配置:  
  11. interface Ethernet0/0  
  12. ip nat enable  
  13. interface Ethernet0/1  
  14. ip nat enable  
  15. ip access-list extended Internet  
  16. deny   ip 10.1.1.0 0.0.0.255 172.16.1.0 0.0.0.255  
  17. permit ip 10.1.1.0 0.0.0.255 any   
  18. ip nat source list Internet interface Ethernet0/1 overload  

B.静态NAT及策略路由配置:

  1. ①总部Center路由器:  
  2. interface Loopback0  
  3. ip address 1.1.1.1 255.255.255.252  
  4. ip nat inside  
  5. interface Ethernet0/1  
  6. ip nat outside  
  7. ip nat inside source   static network 10.1.1.0 172.16.1.0 /24  
  8. ip nat Outside source  static network 10.1.1.0 192.168.1.0 /24  
  9. ip access-list extended VPN  
  10. permit ip 10.1.1.0 0.0.0.255 192.168.1.0  0.0.0.255  
  11. route-map VPN permit 10  
  12. match ip address VPN  
  13. set interface Loopback0  
  14. interface Ethernet0/0  
  15. ip policy route-map VPN  
  16. ②分支Branch路由器  
  17. interface Loopback0  
  18. ip address 192.168.1.1 255.255.255.0  
  19. crypto ipsec client ezvpn Ez-Client inside  
  20. ----这个将分支机构被NAT的网络通过反向路由注入的方式注入到总部Center路由器  
  21. ----测试时发现如果Server不配置反向路由注入,即使配置了隧道分离,客户端还是把VPN流量送到了互联网。  

C.测试:

  1. clear crypto ipsec client ezvpn   
  2. crypto ipsec client ezvpn connect  
  3. crypto ipsec client ezvpn xauth  
  4. Username: xll  
  5. Password: xll  
  6. Branch#  
  7. *Mar  1 00:11:53.395: %CRYPTO-6-EZVPN_CONNECTION_UP: (Client)  User=  Group=ipsecgroup  Client_public_addr=202.100.2.1  Server_public_addr=202.100.1.1  NEM_Remote_Subnets=10.1.1.0/255.255.255.0  192.168.1.0/255.255.255.0     
  8.   
  9. Inside#ping 172.16.1.2  
  10.   
  11. Type escape sequence to abort.  
  12. Sending 5, 100-byte ICMP Echos to 172.16.1.2, timeout is 2 seconds:  
  13. !!!!!  
  14. Success rate is 100 percent (5/5), round-trip min/avg/max = 192/258/348 ms  
  15. Inside#  
  16. ----ping的同时在对方debug ip icmp,可以看到回包  
  17. Server#  
  18. *Mar  2 22:11:07.472: ICMP: echo reply sent, src 10.1.1.2, dst 192.168.1.2  
  19. *Mar  2 22:11:07.740: ICMP: echo reply sent, src 10.1.1.2, dst 192.168.1.2  
  20. *Mar  2 22:11:07.972: ICMP: echo reply sent, src 10.1.1.2, dst 192.168.1.2  
  21. *Mar  2 22:11:08.160: ICMP: echo reply sent, src 10.1.1.2, dst 192.168.1.2  
  22. *Mar  2 22:11:08.412: ICMP: echo reply sent, src 10.1.1.2, dst 192.168.1.2  

反过来也能通:

  1. Server#ping 192.168.1.2  
  2.   
  3. Type escape sequence to abort.  
  4. Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:  
  5. !!!!!  
  6. Success rate is 100 percent (5/5), round-trip min/avg/max = 176/248/372 ms  
  7. Inside#  
  8. *Mar  2 19:21:54.933: ICMP: echo reply sent, src 10.1.1.2, dst 172.16.1.2  
  9. *Mar  2 19:21:55.273: ICMP: echo reply sent, src 10.1.1.2, dst 172.16.1.2  
  10. *Mar  2 19:21:55.481: ICMP: echo reply sent, src 10.1.1.2, dst 172.16.1.2  
  11. *Mar  2 19:21:55.669: ICMP: echo reply sent, src 10.1.1.2, dst 172.16.1.2  
  12. *Mar  2 19:21:55.857: ICMP: echo reply sent, src 10.1.1.2, dst 172.16.1.2  
标签:

给我留言