A-A+

Cisco路由器GRE over IPSEC VPN的配置实验

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

下面将介绍的是一个通过三台cisco路由器的简单链式网络,来完成GRE over IPSEC VPN的配置实验,拓扑图和配置步骤都会有详述,大家可以按照下文列出的全部配置命令来自己做一遍。

由于IPSEC VPN不能支持组播和广播,因此不能运行动态路由协议,由于我们需要把一条VPN链路作为一条专线使用,还必须建立GRE tunnel隧道,以支持动态路由协议.

实验拓扑:

基本配置步骤如下:

1:配置基本路由和需保护流量的感兴趣访问列表(注意这里感兴趣流量设为GRE隧道流量)

2:配置GRE Tunnel隧道.

3:配置IPSEC VPN.

4:配置动态路由协议.

配置如下 :

  1. R1#sho run   
  2. crypto isakmp policy 10  
  3. authentication pre-share  
  4. crypto isakmp key cisco address 202.1.1.2  
  5. !  
  6. crypto ipsec transform-set mytrans esp-3des   
  7. !  
  8. crypto map mymap 1 ipsec-isakmp   
  9. set peer 202.1.1.2  
  10. set transform-set mytrans   
  11. match address 101  
  12. !  
  13. interface Loopback0  
  14. ip address 10.1.1.1 255.255.255.0  
  15. !  
  16. interface Tunnel0  
  17. ip address 192.168.1.1 255.255.255.0  
  18. tunnel source Ethernet0/0  
  19. tunnel destination 202.1.1.2  
  20. !  
  21. interface Ethernet0/0  
  22. ip address 201.1.1.1 255.255.255.0  
  23. crypto map mymap  
  24. router ospf 1  
  25. log-adjacency-changes  
  26.   
  27.   
  28. network 10.1.1.0 0.0.0.255 area 0  
  29. network 192.168.1.0 0.0.0.255 area 0  
  30. ip route 0.0.0.0 0.0.0.0 Ethernet0/0  
  31. access-list 101 permit gre host 201.1.1.1 host 202.1.1.2  
  32. //注意访问列表所定义的IPSEC所保护的感兴趣流量为GRE流量.  
  33. R2#  
  34. interface Ethernet0/0  
  35. ip address 201.1.1.2 255.255.255.0  
  36. !  
  37. interface Ethernet2/0  
  38. ip address 202.1.1.1 255.255.255.0  
  39.   
  40.   
  41. R3#  
  42. crypto isakmp policy 10  
  43. authentication pre-share  
  44. crypto isakmp key cisco address 201.1.1.1  
  45. !  
  46. !  
  47. crypto ipsec transform-set mytrans esp-3des   
  48. !  
  49. crypto map mymap 10 ipsec-isakmp   
  50. set peer 201.1.1.1  
  51. set transform-set mytrans   
  52. match address 101  
  53. !  
  54. interface Loopback0  
  55. ip address 172.16.1.1 255.255.255.0  
  56. !  
  57. interface Tunnel0  
  58. ip address 192.168.1.2 255.255.255.0  
  59. tunnel source Ethernet2/0  
  60. tunnel destination 201.1.1.1  
  61. !  
  62. interface Ethernet2/0  
  63. ip address 202.1.1.2 255.255.255.0  
  64. half-duplex  
  65. crypto map mymap  
  66. !  
  67. router ospf 1  
  68. log-adjacency-changes  
  69. network 172.16.1.0 0.0.0.255 area 0  
  70. network 192.168.1.0 0.0.0.255 area 0  
  71. ip route 0.0.0.0 0.0.0.0 Ethernet2/0  
  72. !  
  73. access-list 101 permit gre host 202.1.1.2 host 201.1.1.1  
  74.   
  75. 测试:  
  76. R1#show ip os nei  
  77.   
  78. Neighbor ID     Pri   State           Dead Time   Address         Interface  
  79. 172.16.1.1        0   FULL/ -        00:00:37    192.168.1.2     Tunnel0  
  80. R1#show ip route  
  81. Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP  
  82.        D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area   
  83.        N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2  
  84.        E1 - OSPF external type 1, E2 - OSPF external type 2  
  85.        i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2  
  86.        ia - IS-IS inter area, * - candidate default, U - per-user static route   
  87.        o - ODR, P - periodic downloaded static route  
  88.   
  89. Gateway of last resort is 0.0.0.0 to network 0.0.0.0  
  90.   
  91. C    201.1.1.0/24 is directly connected, Ethernet0/0  
  92.      172.16.0.0/32 is subnetted, 1 subnets  
  93. O       172.16.1.1 [110/11112] via 192.168.1.2, 00:41:22, Tunnel0  
  94.      10.0.0.0/24 is subnetted, 1 subnets  
  95. C       10.1.1.0 is directly connected, Loopback0  
  96. C    192.168.1.0/24 is directly connected, Tunnel0  
  97. S*   0.0.0.0/0 is directly connected, Ethernet0/0  
  98. R1#show crypto isakmp sa   
  99. dst             src             state          conn-id slot  
  100. 202.1.1.2       201.1.1.1       QM_IDLE              8    0  
  101.   
  102. R1#traceroute 172.16.1.1  
  103.   
  104. Type escape sequence to abort.  
  105. Tracing the route to 172.16.1.1  
  106.   
  107. 1 192.168.1.2 132 msec * 156 msec   //走的是隧道吧!  
标签:

给我留言