GRE隧道与IPsec的结合

安全
有关于IPsec的相关内容,这篇文章主要讲解GRE隧道与IPsec的相关内容。希望本文的内容,能够对网管员有一个很好的帮助。

在前面,我们讲解过了关于采用积极模式并PSK的IPsec VPN配置基于PSK的IPsec VPN配置的相关内容,那么下面我们主要分析一下GRE和IPsec的相关内容。GRE隧道本身不带安全特性,可以通过结合基于PSK的IPsec来实现安全功能.拓扑如下:

GRE隧道与IPsec的结合

1.R1基本配置:

  1. R1(config)#interface loopback0  
  2. R1(config-if)#ip address 10.1.1.1 255.255.255.0  
  3. R1(config-if)#no shutdown  
  4. R1(config-if)#interface serial0/0  
  5. R1(config-if)#ip address  192.168.1.1 255.255.255.252  
  6. R1(config-if)#clock rate 56000  
  7. R1(config-if)#no shutdown  
  8. R1(config)#interface tunnel 0  
  9. R1(config-if)#ip unnumbered serial0/0  
  10. R1(config-if)#tunnel source serial0/0  
  11. R1(config-if)#tunnel destination 192.168.1.1  
  12. R1(config-if)#tunnel mode gre ip       /---可以不打,默认即为GRE---/  
  13. R1(config-if)#no shutdown  
  14. R1(config-if)#exit  
  15.  

2.定义感兴趣流量与路由协议:

  1. R1(config)#access-list 100 permit gre host 192.168.1.1 host 192.168.1.2  
  2. R1(config)#ip route 0.0.0.0 0.0.0.0 serial0/0  
  3. R1(config)#ip route 10.2.2.0 255.255.255.0 serial0/0  
  4.  

3.全局启用ISAKMP并定义对等体及其PSK(预共享密钥):

  1. R1(config)#crypto isakmp enable   
  2. R1(config)#crypto isakmp key 91lab address 192.168.1.2  
  3.  

4.定义IKE策略:

  1. R1(config)#crypto isakmp policy 10  
  2. R1(config-isakmp)#encryption aes 128     /---默认是DES加密---/  
  3. R1(config-isakmp)#hash sha            /---默认是SHA-1---/  
  4. R1(config-isakmp)#authentication pre-share       
  5. R1(config-isakmp)#group 2             /---默认是768位的DH1---/  
  6. R1(config-isakmp)#lifetime 3600        /---默认是86400秒---/  
  7. R1(config-isakmp)#exit  
  8.  

5.定义IPSec转换集(transform set):

  1. R1(config)#crypto ipsec transform-set tt esp-aes 128 esp-sha-hmac   
  2. R1(cfg-crypto-trans)#mode tunnel   
  3. R1(cfg-crypto-trans)#exit  
  4.  

6.定义crypto map并应用在接口上:

  1. R1(config)#crypto map cisco 10 ipsec-isakmp   
  2. R1(config-crypto-map)#match address 100       
  3. R1(config-crypto-map)#set peer 192.168.1.2     /---定义要应用crypto map的对等体地址---/  
  4. R1(config-crypto-map)#set transform-set tt     /---定义crypto map要应用的IPsec转换集---/  
  5. R1(config-crypto-map)#exit  
  6. R1(config)#interface serial0/0  
  7. R1(config-if)#crypto map cisco  
  8.  
  9.    
  10. *Mar  1 00:08:31.131: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON  
  11.  
  12. R1(config-if)#end  
  13. R1#  
  14.  

R1配置完成.

同理,R2相关配置如下:

  1. !   
  2. !  
  3. crypto isakmp policy 10  
  4. encr aes  
  5. authentication pre-share  
  6. group 2    
  7. crypto isakmp key 91lab address 192.168.1.1  
  8. !  
  9. !  
  10. crypto ipsec transform-set tt esp-aes esp-sha-hmac   
  11. !  
  12. crypto map cisco 10 ipsec-isakmp   
  13. set peer 192.168.1.1  
  14. set transform-set tt   
  15. match address 100  
  16. !  
  17. !  
  18. !  
  19. interface Tunnel0  
  20. ip unnumbered Serial0/0  
  21. tunnel source Serial0/0  
  22. tunnel destination 192.168.1.1  
  23. !  
  24. interface Loopback0  
  25. ip address 10.2.2.1 255.255.255.0  
  26. !  
  27. interface Serial0/0  
  28. ip address 192.168.1.2 255.255.255.252  
  29. crypto map cisco  
  30. !  
  31. ip route 0.0.0.0 0.0.0.0 Serial0/0  
  32. !  
  33. access-list 100 permit gre host 10.2.2.1 host 10.1.1.1  

 

责任编辑:佟健 来源: 51CTO整理
相关推荐

2009-12-28 14:00:46

2012-07-17 09:57:15

2009-08-25 17:12:33

思科认证CCNP

2023-10-22 11:54:19

2020-11-19 09:24:18

Linux GRE配置

2015-01-20 09:07:26

青云青云QingCloud私有网络

2015-01-19 14:38:03

青云QingCloud

2014-09-03 10:09:23

LinuxOpenswan

2011-11-25 13:34:56

IPsec VPNIPsec VPN协议

2010-08-26 15:36:30

DHCP路由

2011-11-29 12:13:21

VPN

2010-07-12 17:06:04

GRE协议

2010-06-03 15:04:31

NAP IPSEC配置

2012-09-26 09:49:44

2017-08-16 08:45:50

EVPNVXLAN网络

2010-06-24 14:29:58

GRE协议

2009-06-04 10:44:34

StrutsHibernate配合

2010-03-19 15:39:41

云计算

2011-03-07 16:10:41

FireFTPFirefoxFTP

2022-05-17 09:19:17

XebianLinuxLinux 发行版
点赞
收藏

51CTO技术栈公众号