A-A+

思科路由器IPSEC_OVER_TUNNEL的vpn配置实例

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

一,Site1路由器IPsec tunnel配置:

  1. crypto isakmp policy 10    //定义第一阶段安全策略  
  2.  encr 3des  
  3.  hash md5  
  4.   
  5.  authentication pre-share  
  6.  group 2  
  7. crypto isakmp key cisco address 61.128.1.1    //定义两端的密码,cisco为密码。  
  8. !  
  9. !  
  10. crypto ipsec transform-set cisco esp-des      
  11.  mode transport   
  12. !  
  13. crypto ipsec profile To_site2_ipsec    //定义第二阶感安全策略  
  14.  set transform-set cisco  
  15. !  
  16. !  
  17. !  
  18. !  
  19. !  
  20. interface Loopback0   
  21.  ip address 1.1.1.1 255.255.255.0  
  22. !  
  23. interface Tunnel0  
  24.  ip address 172.16.1.1 255.255.255.0  
  25.  tunnel source 202.100.1.1  
  26.  tunnel destination 61.128.1.1  
  27.  tunnel protection ipsec profile To_site2_ipsec     //安全策略应用到TUNNEL接口。TUNNEL定义了感兴趣流。   
  28. !  
  29. interface FastEthernet0/0  
  30.  ip address 202.100.1.1 255.255.255.0  
  31.  duplex auto  
  32.  speed auto  
  33. !  
  34. interface FastEthernet1/0  
  35.  no ip address   
  36.  shutdown  
  37.  duplex auto  
  38.  speed auto  
  39. !  
  40. interface FastEthernet2/0  
  41.  no ip address  
  42.  shutdown  
  43.  duplex auto  
  44.  speed auto   
  45. !  
  46. interface FastEthernet3/0  
  47.  no ip address  
  48.  shutdown  
  49.  duplex auto  
  50.  speed auto  
  51. !  
  52. router ospf 1  
  53.  log-adjacency-changes   
  54.  network 1.1.1.0 0.0.0.255 area 0  
  55.  network 172.16.1.0 0.0.0.255 area 0  
  56. !  
  57. no ip http server  
  58. no ip http secure-server  
  59. !  
  60. ip forward-protocol nd  
  61. ip route 0.0.0.0 0.0.0.0 202.100.1.10   
  62. !  
  63. !  
  64. control-plane  
  65. !  
  66.   
  67. !  
  68. line con 0  
  69.  exec-timeout 0 0  
  70.  privilege level 15   
  71.  logging synchronous  
  72. line aux 0  
  73.  exec-timeout 0 0  
  74.  privilege level 15  
  75.  logging synchronous  
  76. line vty 0 4  
  77.  login  
  78. !   
  79. !  
  80. end  
  81. Site1#  

二,Site2 IPSEC 配置:

  1. !  
  2. crypto isakmp policy 10    //定义第一阶段ISAKMP策略  
  3.  encr 3des  
  4.  hash md5  
  5.   
  6.  authentication pre-share  
  7.  group 2  
  8. crypto isakmp key cisco address 202.100.1.1  
  9. !  
  10. !  
  11. crypto ipsec transform-set cisco esp-des   
  12.  mode transport  
  13. !   
  14. crypto map cisco 10 ipsec-isakmp    //定义第二阶段IPSEC安全策略。  
  15.  set peer 202.100.1.1  
  16.  set transform-set cisco  
  17.  match address vpn  
  18. !  
  19. !  
  20. !  
  21. !   
  22. interface Loopback0  
  23.  ip address 2.2.2.2 255.255.255.0  
  24. !  
  25. interface Tunnel0  
  26.  ip address 172.16.1.2 255.255.255.0  
  27.  tunnel source FastEthernet1/0  
  28.  tunnel destination 202.100.1.1  
  29. !   
  30. interface FastEthernet0/0  
  31.  no ip address  
  32.  shutdown  
  33.  duplex auto  
  34.  speed auto  
  35. !  
  36. interface FastEthernet1/0  
  37.  ip address 61.128.1.1 255.255.255.0   
  38.  duplex auto  
  39.  speed auto  
  40.  crypto map cisco    //定义好的cisco应用到接口。  
  41. !  
  42. interface FastEthernet2/0  
  43.  no ip address   
  44.  shutdown  
  45.  duplex auto  
  46.  speed auto  
  47. !  
  48. interface FastEthernet3/0  
  49.  no ip address  
  50.  shutdown  
  51.  duplex auto  
  52.  speed auto   
  53. !  
  54. router ospf 1  
  55.  log-adjacency-changes  
  56.  network 2.2.2.0 0.0.0.255 area 0  
  57.  network 172.16.1.0 0.0.0.255 area 0  
  58. !  
  59. no ip http server  
  60. no ip http secure-server   
  61. !  
  62. ip forward-protocol nd  
  63. ip route 0.0.0.0 0.0.0.0 61.128.1.10  
  64. !  
  65. !  
  66. !  
  67. ip access-list extended vpn   
  68.  permit gre host 61.128.1.1 host 202.100.1.1 //定义感兴趣流  
  69. !  
  70. !  
  71. !  
  72. control-plane  
  73. !  
  74. !  
  75. !  
  76. !   
  77. !  
  78. !  
  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  
  96. Site2#  

三,VPN 测试:

  1. Site1#ping 2.2.2.2 so 1.1.1.1  
  2. Type escape sequence to abort.  
  3. Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:  
  4. Packet sent with a source address of 1.1.1.1  
  5. !!!!!  
  6. Success rate is 100 percent (5/5), round-trip min/avg/max = 24/56/96 ms   
  7. Site1#  

四,VPN状态查看:

  1. 1,Site1:  
  2. Site1#show crypto engi connec ac  
  3.   ID Interface            IP-Address      State  Algorithm           Encrypt  Decrypt  
  4.    1 Tunnel0              172.16.1.1      set    HMAC_MD5+3DES_56_C        0        0  
  5.   
  6. 2001 Tunnel0              202.100.1.1     set    DES                     234        0  
  7. 2002 Tunnel0              202.100.1.1     set    DES                       0      233  
  8. Site1#show crypto isakmp sa  
  9. dst             src             state          conn-id slot status  
  10.   
  11. 61.128.1.1      202.100.1.1     QM_IDLE              1    0 ACTIVE  
  12. Site1#show crypto ipsec sa  
  13. interface: Tunnel0  
  14.     Crypto map tag: Tunnel0-head-0, local addr 202.100.1.1  
  15.    protected vrf: (none)  
  16.    local  ident (addr/mask/prot/port): (202.100.1.1/255.255.255.255/47/0)  
  17.    remote ident (addr/mask/prot/port): (61.128.1.1/255.255.255.255/47/0)   
  18.    current_peer 61.128.1.1 port 500  
  19.      PERMIT, flags={origin_is_acl,}  
  20.     #pkts encaps: 236, #pkts encrypt: 236, #pkts digest: 236  
  21.     #pkts decaps: 235, #pkts decrypt: 235, #pkts verify: 235  
  22.     #pkts compressed: 0, #pkts decompressed: 0  
  23.     #pkts not compressed: 0, #pkts compr. failed: 0  
  24.   
  25.     #pkts not decompressed: 0, #pkts decompress failed: 0  
  26.     #send errors 0, #recv errors 0  
  27.      local crypto endpt.: 202.100.1.1, remote crypto endpt.: 61.128.1.1  
  28.      path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet0/0  
  29.      current outbound spi: 0x698BB99(110672793)  
  30.      inbound esp sas:  
  31.       spi: 0x911DD429(2434651177)  
  32.         transform: esp-des ,  
  33.         in use settings ={Transport, }  
  34.   
  35.         conn id: 2002, flow_id: SW:2, crypto map: Tunnel0-head-0  
  36.         sa timing: remaining key lifetime (k/sec): (4428651/1493)  
  37.         IV size: 8 bytes  
  38.         replay detection support: N  
  39.         Status: ACTIVE  
  40.      inbound ah sas:  
  41.      inbound pcp sas:  
  42.      outbound esp sas:  
  43.       spi: 0x698BB99(110672793)  
  44.         transform: esp-des ,  
  45.         in use settings ={Transport, }  
  46.   
  47.         conn id: 2001, flow_id: SW:1, crypto map: Tunnel0-head-0  
  48.         sa timing: remaining key lifetime (k/sec): (4428650/1490)  
  49.         IV size: 8 bytes  
  50.         replay detection support: N  
  51.         Status: ACTIVE  
  52.      outbound ah sas:  
  53.      outbound pcp sas:  
  54. Site1#  
  55.    
  56. 2,Site2:  
  57.   
  58. Site2#show crypto engi connec ac  
  59.   ID Interface            IP-Address      State  Algorithm           Encrypt  Decrypt  
  60.    1 FastEthernet1/0      61.128.1.1      set    HMAC_MD5+3DES_56_C        0        0  
  61.   
  62. 2001 FastEthernet1/0      61.128.1.1      set    DES                     242        0  
  63. 2002 FastEthernet1/0      61.128.1.1      set    DES                       0      243  
  64. Site2#show crypto isakmp sa  
  65. dst             src             state          conn-id slot status   
  66. 61.128.1.1      202.100.1.1     QM_IDLE              1    0 ACTIVE  
  67. Site2#show crypto ipsec sa  
  68. interface: FastEthernet1/0  
  69.     Crypto map tag: cisco, local addr 61.128.1.1  
  70.    protected vrf: (none)  
  71.    local  ident (addr/mask/prot/port): (61.128.1.1/255.255.255.255/47/0)  
  72.    remote ident (addr/mask/prot/port): (202.100.1.1/255.255.255.255/47/0)  
  73.    current_peer 202.100.1.1 port 500   
  74.      PERMIT, flags={origin_is_acl,}  
  75.     #pkts encaps: 414, #pkts encrypt: 414, #pkts digest: 414  
  76.     #pkts decaps: 415, #pkts decrypt: 415, #pkts verify: 415  
  77.     #pkts compressed: 0, #pkts decompressed: 0  
  78.     #pkts not compressed: 0, #pkts compr. failed: 0   
  79.     #pkts not decompressed: 0, #pkts decompress failed: 0  
  80.     #send errors 16, #recv errors 0  
  81.      local crypto endpt.: 61.128.1.1, remote crypto endpt.: 202.100.1.1  
  82.      path mtu 1500, ip mtu 1500, ip mtu idb FastEthernet1/0  
  83.      current outbound spi: 0x911DD429(2434651177)  
  84.      inbound esp sas:  
  85.       spi: 0x698BB99(110672793)  
  86.         transform: esp-des ,  
  87.         in use settings ={Transport, }  
  88.   
  89.         conn id: 2002, flow_id: SW:2, crypto map: cisco  
  90.         sa timing: remaining key lifetime (k/sec): (4472959/1405)  
  91.         IV size: 8 bytes  
  92.         replay detection support: N  
  93.         Status: ACTIVE  
  94.      inbound ah sas:  
  95.      inbound pcp sas:  
  96.      outbound esp sas:  
  97.       spi: 0x911DD429(2434651177)  
  98.         transform: esp-des ,  
  99.         in use settings ={Transport, }  
  100.   
  101.         conn id: 2001, flow_id: SW:1, crypto map: cisco  
  102.         sa timing: remaining key lifetime (k/sec): (4472960/1404)  
  103.         IV size: 8 bytes  
  104.         replay detection support: N  
  105.         Status: ACTIVE  
  106.      outbound ah sas:  
  107.      outbound pcp sas:  
  108. Site2#  
标签:

给我留言