A-A+

基于cisco路由器间的DyVPN的配置方法

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

基于采用4台思科路由器进行简单组网的情况下,配置Dynamic LAN-to-LAN VPN(简称DyVPN)的方法并不难,还可以举一反三的学会EZVPN的操作方法。下面是拓扑图:

R1配置:

  1. R1#show running-config   
  2. Building configuration...  
  3. Current configuration : 1347 bytes  
  4. !  
  5. version 12.4  
  6. service timestamps debug datetime msec  
  7. service timestamps log datetime msec  
  8. no service password-encryption  
  9. !  
  10. hostname R1  
  11. !  
  12. boot-start-marker  
  13. boot-end-marker  
  14. !  
  15. !  
  16. no aaa new-model  
  17. memory-size iomem 5  
  18. !  
  19. !  
  20. ip cef  
  21. no ip domain lookup  
  22. ip domain name lab.local  
  23. !  
  24. !  
  25. !           
  26. !  
  27. !           
  28. crypto keyring abc   
  29.   pre-shared-key address 0.0.0.0 0.0.0.0 key cisco123  
  30. !           
  31. crypto isakmp policy 1  
  32.  encr 3des  
  33.  authentication pre-share  
  34.  group 2    
  35. crypto isakmp profile ppp  
  36.    keyring abc  
  37.    match identity address 0.0.0.0   
  38. !           
  39. !           
  40. crypto ipsec transform-set ccie esp-3des esp-sha-hmac   
  41. !           
  42. crypto dynamic-map dymap 5  
  43.  set transform-set ccie   
  44.  set isakmp-profile ppp  
  45. !           
  46. !           
  47. crypto map mymap 10 ipsec-isakmp dynamic dymap   
  48. !           
  49. !           
  50. !           
  51. !           
  52. interface Ethernet0/0  
  53.  ip address 12.1.1.1 255.255.255.0   
  54.  half-duplex  
  55.  crypto map mymap  
  56. !           
  57. interface Ethernet0/1  
  58.  ip address 10.1.1.1 255.255.255.0  
  59.  half-duplex  
  60. !           
  61. interface Ethernet0/2  
  62.  no ip address  
  63.  shutdown   
  64.  half-duplex  
  65. !           
  66. interface Ethernet0/3  
  67.  no ip address  
  68.  shutdown   
  69.  half-duplex  
  70. !           
  71. no ip http server  
  72. no ip http secure-server  
  73. ip route 0.0.0.0 0.0.0.0 12.1.1.2  
  74. ip route 10.1.2.0 255.255.255.0 10.1.1.5  
  75. !           
  76. !           
  77.        
  78. control-plane  
  79. !           
  80. !           
  81.       
  82.         
  83. line con 0  
  84.  exec-timeout 0 0  
  85.  privilege level 15  
  86.  logging synchronous  
  87. line aux 0  
  88.  exec-timeout 0 0  
  89.  privilege level 15  
  90.  logging synchronous  
  91. line vty 0 4  
  92.  login      
  93. !           
  94. !           
  95. end     

R2配置 略 (模拟ISP 只配置IP)

R3配置

  1. R3#show running-config   
  2. Building configuration...  
  3. Current configuration : 1889 bytes  
  4. !  
  5. version 12.4  
  6. service timestamps debug datetime msec  
  7. service timestamps log datetime msec  
  8. no service password-encryption  
  9. !  
  10. hostname R3  
  11. !  
  12. boot-start-marker  
  13. boot-end-marker  
  14. !  
  15. !  
  16. no aaa new-model  
  17. memory-size iomem 5  
  18. !  
  19. !  
  20. ip cef  
  21. no ip domain lookup   
  22. ip domain name lab.local  
  23. !  
  24. !  
  25. !           
  26. !           
  27. !           
  28. !           
  29. crypto isakmp policy 1  
  30.  encr 3des  
  31.  authentication pre-share  
  32.  group 2    
  33. crypto isakmp key cisco123 address 12.1.1.1  
  34. !           
  35. !           
  36. crypto ipsec transform-set ccie esp-3des esp-sha-hmac   
  37. !           
  38. crypto map l2l 1 ipsec-isakmp   
  39.  set peer 12.1.1.1  
  40.  set transform-set ccie   
  41.  match address 100  
  42. !           
  43. !           
  44. !           
  45. !           
  46. interface Ethernet0/0  
  47.  ip address 192.168.1.3 255.255.255.0  
  48.  ip nat inside  
  49.  ip virtual-reassembly  
  50.  half-duplex  
  51. !           
  52. interface Ethernet0/1  
  53.  no ip address  
  54.  shutdown   
  55.  half-duplex  
  56. !           
  57. interface Ethernet0/2  
  58.  no ip address  
  59.  shutdown   
  60.  half-duplex  
  61. !           
  62. interface Ethernet0/3  
  63.  no ip address  
  64.  shutdown   
  65.  half-duplex  
  66. !           
  67. interface Serial1/0  
  68.  ip address 23.1.1.3 255.255.255.0  
  69.  ip nat outside  
  70.  ip virtual-reassembly  
  71.  serial restart-delay 0  
  72.  crypto map l2l  
  73. !           
  74. interface Serial1/1  
  75.  no ip address  
  76.  shutdown   
  77.  serial restart-delay 0  
  78. !           
  79. interface Serial1/2  
  80.  no ip address  
  81.  shutdown   
  82.  serial restart-delay 0  
  83. !           
  84. interface Serial1/3  
  85.  no ip address  
  86.  shutdown   
  87.  serial restart-delay 0  
  88. !           
  89. no ip http server  
  90. no ip http secure-server  
  91. ip route 0.0.0.0 0.0.0.0 23.1.1.2  
  92. !           
  93. !           
  94. ip nat inside source list 110 interface Serial1/0 overload  
  95. !           
  96. access-list 100 permit ip 192.168.1.0 0.0.0.255 10.1.1.0 0.0.0.255  
  97. access-list 100 permit ip 192.168.1.0 0.0.0.255 10.1.2.0 0.0.0.255  
  98. access-list 110 deny   ip 192.168.1.0 0.0.0.255 10.1.1.0 0.0.0.255  
  99. access-list 110 deny   ip 192.168.1.0 0.0.0.255 10.1.2.0 0.0.0.255   
  100. access-list 110 permit ip any any  
  101. !           
  102. !           
  103. !           
  104. control-plane  
  105. !           
  106. !           
  107. !           
  108.       
  109. !           
  110. line con 0  
  111.  exec-timeout 0 0  
  112.  privilege level 15  
  113.  logging synchronous  
  114. line aux 0  
  115.  exec-timeout 0 0  
  116.  privilege level 15  
  117.  logging synchronous  
  118. line vty 0 4  
  119.  login      
  120. !           
  121. !           
  122. end     

R4配置

  1. R4#show running-config   
  2.   
  3. Building configuration...  
  4. Current configuration : 1550 bytes   
  5. !  
  6. version 12.4  
  7. service timestamps debug datetime msec  
  8. service timestamps log datetime msec  
  9. no service password-encryption  
  10. !  
  11. hostname R4  
  12. !  
  13. boot-start-marker  
  14. boot-end-marker  
  15. !  
  16. !  
  17. no aaa new-model  
  18. memory-size iomem 5  
  19. !  
  20. !  
  21. ip cef  
  22. no ip domain lookup  
  23. ip domain name lab.local  
  24. !  
  25. !  
  26. !           
  27.         
  28. crypto isakmp policy 1  
  29.  encr 3des  
  30.  authentication pre-share  
  31.  group 2    
  32. crypto isakmp key cisco123 address 12.1.1.1  
  33. !           
  34. !           
  35. crypto ipsec transform-set ccie esp-3des esp-sha-hmac   
  36. !           
  37. crypto map l2l 1 ipsec-isakmp   
  38.  set peer 12.1.1.1  
  39.  set transform-set ccie   
  40.  match address 100  
  41. !           
  42. !           
  43. !           
  44. !           
  45. interface Ethernet0/0  
  46.  ip address 172.16.1.4 255.255.255.0  
  47.  ip nat inside  
  48.  ip virtual-reassembly  
  49.  half-duplex  
  50. !           
  51. interface Ethernet0/1  
  52.  ip address dhcp  
  53.  ip nat outside  
  54.  ip virtual-reassembly  
  55.  half-duplex  
  56.  crypto map l2l  
  57. !           
  58. interface Ethernet0/2  
  59.  no ip address  
  60.  shutdown   
  61.  half-duplex  
  62. !           
  63. interface Ethernet0/3  
  64.  no ip address  
  65.  shutdown   
  66.  half-duplex  
  67. !           
  68. no ip http server  
  69. no ip http secure-server  
  70. !           
  71. !           
  72. ip nat inside source list 110 interface Ethernet0/1 overload  
  73. !           
  74. access-list 100 permit ip 172.16.1.0 0.0.0.255 10.1.1.0 0.0.0.255  
  75. access-list 100 permit ip 172.16.1.0 0.0.0.255 10.1.2.0 0.0.0.255  
  76. access-list 110 deny   ip 172.16.1.0 0.0.0.255 10.1.1.0 0.0.0.255  
  77. access-list 110 deny   ip 172.16.1.0 0.0.0.255 10.1.2.0 0.0.0.255  
  78. access-list 110 permit ip any any  
  79. !           
  80. !           
  81. !           
  82. control-plane  
  83. !           
  84. !           
  85. !           
  86. !           
  87.        
  88. !           
  89. line con 0  
  90.  exec-timeout 0 0  
  91.  privilege level 15  
  92.  logging synchronous  
  93. line aux 0  
  94.  exec-timeout 0 0  
  95.  privilege level 15  
  96.  logging synchronous  
  97. line vty 0 4  
  98.  login      
  99. !           

R5配置

  1. R5#show running-config   
  2. Building configuration...  
  3. Current configuration : 878 bytes  
  4. !  
  5. version 12.4  
  6. service timestamps debug datetime msec  
  7. service timestamps log datetime msec  
  8. no service password-encryption  
  9. !  
  10. hostname R5  
  11. !  
  12. boot-start-marker  
  13. boot-end-marker  
  14. !  
  15. !  
  16. no aaa new-model  
  17. memory-size iomem 5  
  18. !  
  19. !  
  20. ip cef  
  21. no ip domain lookup  
  22. ip domain name lab.local  
  23.  !           
  24. !           
  25. !           
  26. !           
  27. !           
  28. !           
  29. !           
  30. !           
  31. !           
  32. !           
  33. !           
  34. !           
  35. !           
  36. !           
  37. !           
  38. !           
  39. !           
  40. interface Ethernet0/0  
  41.  ip address 10.1.2.5 255.255.255.0  
  42.  half-duplex  
  43. !           
  44. interface Ethernet0/1  
  45.  ip address 10.1.1.5 255.255.255.0  
  46.  half-duplex  
  47. !           
  48. interface Ethernet0/2  
  49.  no ip address  
  50.  shutdown   
  51.  half-duplex  
  52. !           
  53. interface Ethernet0/3  
  54.  no ip address  
  55.  shutdown   
  56.  half-duplex  
  57. !           
  58. no ip http server  
  59. no ip http secure-server  
  60. ip route 0.0.0.0 0.0.0.0 10.1.1.1  
  61. !           
  62. !           
  63. !           
  64. !           
  65. !           
  66. !           
  67. control-plane  
  68. !           
  69. !           
  70. !           
  71. !           
  72.     
  73. line con 0  
  74.  exec-timeout 0 0  
  75.  privilege level 15  
  76.  logging synchronous  
  77. line aux 0  
  78.  exec-timeout 0 0  
  79.  privilege level 15  
  80.  logging synchronous  
  81. line vty 0 4  
  82.  login      
  83. !           
  84. !           
  85. end        

验证:

  1. R1#show crypto isakmp sa   
  2. dst             src             state          conn-id slot status  
  3. 12.1.1.1        23.1.1.3        QM_IDLE              1    0 ACTIVE   
  4. 12.1.1.1        24.1.1.1        QM_IDLE              2    0 ACTIVE  
  5. R3#ping 10.1.2.5 source 192.168.1.3  
  6. Type escape sequence to abort.  
  7. Sending 5, 100-byte ICMP Echos to 10.1.2.5, timeout is 2 seconds:  
  8. Packet sent with a source address of 192.168.1.3   
  9. !!!!!  
  10. Success rate is 100 percent (5/5), round-trip min/avg/max = 152/172/204 ms  
  11.    
  12. R4#ping 10.1.2.5 source 172.16.1.4  
  13. Type escape sequence to abort.  
  14. Sending 5, 100-byte ICMP Echos to 10.1.2.5, timeout is 2 seconds:  
  15. Packet sent with a source address of 172.16.1.4   
  16. !!!!!  
  17. Success rate is 100 percent (5/5), round-trip min/avg/max = 152/170/204 ms  

在R3 和R4中都定义了ipsec 需要加密的 兴趣流和 nat 穿越。

所以在R3和R4访问R5的数据流量走vpn 访问internet的数据走NAT。

R1(Hub端)是不能事先向R3 R4(spoke端)发起流量来触发自己的SA建立 只能相应spoke端vpn请求。

标签:

给我留言