gre over ipsec 用loopback口建隧道产生的up down问题
gre over ipsec原理

gre over ipsec原理一、什么是GRE和IPSec1.1 GRE(通用路由封装协议)1.2 IPSec(Internet协议安全)二、GRE over IPSec的定义和作用2.1 GRE over IPSec的定义2.2 GRE over IPSec的作用三、GRE over IPSec的工作原理3.1 GRE的工作原理3.2 IPSec的工作原理3.3 GRE over IPSec的工作原理四、GRE over IPSec的优点和应用场景4.1 GRE over IPSec的优点4.2 GRE over IPSec的应用场景五、GRE over IPSec的配置步骤和注意事项5.1 GRE over IPSec的配置步骤1.设定GRE隧道接口2.配置隧道的本地和远程地址3.启动隧道接口4.配置IPSec5.验证GRE over IPSec配置5.2 GRE over IPSec的注意事项1.网络拓扑结构和IP地址规划的设计2.密钥管理和安全策略的配置3.设备的性能和对GRE over IPSec的支持程度六、GRE over IPSec与其他VPN技术的比较6.1 GRE over IPSec与PPTP的比较6.2 GRE over IPSec与L2TP的比较6.3 GRE over IPSec与SSL VPN的比较七、总结本文简要介绍了GRE和IPSec协议,并深入探讨了GRE over IPSec的工作原理、优点以及配置步骤和注意事项。
我们还比较了GRE over IPSec与其他VPN技术的差异。
GRE over IPSec作为一种安全可靠的VPN解决方案,在跨网络通信中起着重要的作用。
希望通过本文的介绍,读者对GRE over IPSec有更深入的了解,并能够灵活应用于实际网络环境中。
L2TP,GRE二三层隧道协议解说

L2TP,GRE二三层隧道协议解说
二三层隧道协议
一直知道L2TP是第二层隧道协议,GRE是第三层隧道协议,可是一直不是太明白,今天总结一下自己理解的。
L2TP是用于三层网络上承载二层协议报文的隧道协议,是用于在三层网络上跑PPP 的。
GRE是通用路由封装协议,内部能封装二层,三层,MPLS……它能封装的报文类型很多,但一般都用于封装三层报文,所以也有叫三层隧道协议的,但这个说法也不严谨。
例如:GRE能封装MPLS,ISIS 等,这些都不是三层报文。
Gre over ipsec就是通过GRE将广播,组播,非IP报文通过GRE 封装变成单播IP报文,然后再用IPSEC封装加密,IPSEC是个标准的三层隧道协议,它只能承载单播IP报文。
greoveripsec原理和配置

g r e o v e r i p s e c原理和配置(总5页)-CAL-FENGHAI.-(YICAI)-Company One1-CAL-本页仅作为文档封面,使用请直接删除gre over ipsec这里首先补充一下知识吧:1.Ipsec中有2种封装模式:一种是隧道模式,一种是传输模式;当我们使用GRE OVER ipsec时,如果使用隧道模式的话,会多封装 20个字节的ESP头部,其与GRE添加的头部ip完全相同,故而,在GRE over ipsec 时,建议使用传输模式。
(主要是通讯点和传输点之间的关系)2.配置gre over ipsec的时候,可以选择两种的方法,这里都会介绍和给出配置,建议使用第二种方法。
3.第二种配置GRE over IPsec 的方式:profileProfile 可以看做是GRE tunnel中的一种保护机制,在使用profile时,无需配置感兴趣流,无需set peer,如下操作即可:第一种方法:R1:!hostname R1!crypto isakmp policy 10hash md5authentication pre-sharegroup 2crypto isakmp key zhang address!!crypto ipsec transform-set mytrans esp-3des esp-md5-hmac mode transport!crypto map mymap 10 ipsec-isakmpset peerset transform-set mytransmatch address VPN!!!!interface Tunnel0ip addresstunnel source FastEthernet0/0tunnel destinationtunnel key 123!interface Loopback10ip address!interface FastEthernet0/0ip addressduplex autospeed autocrypto map mymap!router ospf 1router-idlog-adjacency-changesnetwork area 0network area 0!ip access-list extended VPNpermit gre!EndR2配置:hostname R2!interface Loopback0ip address!interface FastEthernet0/0ip addressduplex autospeed auto!interface FastEthernet1/0ip addressduplex autospeed auto!EndR3配置:hostname R3!crypto isakmp policy 10hash md5authentication pre-sharegroup 2crypto isakmp key zhang address!!crypto ipsec transform-set mytrans esp-3des esp-md5-hmac mode transport!crypto map mymap 10 ipsec-isakmpset peerset transform-set mytransmatch address VPN!interface Tunnel0ip addresstunnel source FastEthernet0/0tunnel destinationtunnel key 123!interface Loopback10ip address!interface FastEthernet0/0ip addressduplex autospeed autocrypto map mymap!router ospf 1router-idlog-adjacency-changesnetwork area 0network area 0!no ip http serverno ip http secure-serverip route!ip access-list extended VPNpermit gre!End第二种方法:在1实验中的基础上,删徐mymap,access-list VPN,在接口上删徐map的应用。
工程应用之方案二 IPSEC over GRE

工程应用——方案二:IPSEC over GRE一、网络需求:●为缓解FW压力,在DMZ区放置一台VPN集中器●在总部边界FW上为VPN集中器做NAT转换●分部与总部业务网段需要动态路由学习,业务数据需要使用IPSEC进行保护二、拓扑图:三、配置与分析:实验分析:方案一:IPSEC over GREIP递送头部:202.103.12.10—202.103.23.3(该头部在共网上路由,做NAT转换)在FW上将GRE递送头部源IP转换成202.103.12.10;而数据返回时FW 又将GRE递送头部中的目标202.103.12.10转换成10.1.12.1该IP头部在公网上路由,必然是个公网的地址(私网地址不能再公网路由)RT1:10.1.12.1—202.103.23.3RT3:202.103.23.3—202.103.12.10新IP头部: 1.1.1.1—3.3.3.3(该头部在公网上看不到,不做NAT)用loopback接口做IPSEC对等体原IP头部:10.1.1.1—10.1.3.1通过OSPF使到达该网段的路由下一跳是Tunnel接口,撞上crypto map ACL:10.1.1.0/24—10.1.3.0/24IPSEC匹配的是原始的数据路由配置:RT1(config)#ip route 0.0.0.0 0.0.0.0 10.1.12.2RT3(config)#ip route 0.0.0.0 0.0.0.0 202.103.23.2FW(config)# route outside 0.0.0.0 0.0.0.0 202.103.12.2 1FW配置NAT,放行GRE流量:FW(config)#access-list 100 permit gre host 202.103.23.3 host 202.103.12.10 GRE流量access-group 100 in interface outsideStatic (inside,outside) 202.103.12.10 10.1.12.1 netmask 255.255.255.255GRE配置:RT1(config)#interface Tunnel0ip address 10.1.13.1 255.255.255.0tunnel source Ethernet1/0 RT1GER源,10.1.12.1tunnel destination 202.103.23.3 RT1GRE目标,公网地址RT3(config)#interface Tunnel0ip address 10.1.13.3 255.255.255.0tunnel source Serial0/0tunnel destination 202.103.12.10 RT3GRE目标,对方NAT转换后的IPRT1#ping 10.1.3.1 source 10.1.1.1 测试GRE隧道是否建立成功Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.1.3.1, timeout is 2 seconds:Packet sent with a source address of 10.1.1.1!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 28/63/152 msOSPF配置:●公布Tunnel接口网段,通过Tunnel接口建立OSPF邻居●公布业务网段,通过OSPF实现到达对端业务网段的下一跳是Tunnel接口,以便撞上crypto map●公布IPSEC对等体网段,下一跳是Tunnel接口,以便进行GRE封装RT1(config)#router ospf 1router-id 1.1.1.1network 1.1.1.0 0.0.0.255 area 0 IPSEC对等体network 10.1.1.0 0.0.0.255 area 0 业务网段network 10.1.13.0 0.0.0.255 area 0 Tunnel接口RT3(config)#router ospf 1router-id 3.3.3.3network 3.3.3.0 0.0.0.255 area 0network 10.1.3.0 0.0.0.255 area 0network 10.1.13.0 0.0.0.255 area 0RT1#show ip route1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback13.0.0.0/32 is subnetted, 1 subnetsO 3.3.3.3 [110/11112] via 10.1.13.3, 01:09:55, Tunnel0 IPSEC对等体路由10.0.0.0/8 is variably subnetted, 4 subnets, 2 masksC 10.1.13.0/24 is directly connected, Tunnel0C 10.1.12.0/24 is directly connected, Ethernet1/0O 10.1.3.1/32 [110/11112] via 10.1.13.3, 01:09:55, Tunnel0 业务网段路由C 10.1.1.0/24 is directly connected, Loopback0S* 0.0.0.0/0 [1/0] via 10.1.12.2RT3#show ip routeC 202.103.23.0/24 is directly connected, Serial0/01.0.0.0/32 is subnetted, 1 subnetsO 1.1.1.1 [110/11112] via 10.1.13.1, 01:10:26, Tunnel03.0.0.0/24 is subnetted, 1 subnetsC 3.3.3.0 is directly connected, Loopback110.0.0.0/8 is variably subnetted, 3 subnets, 2 masksC 10.1.13.0/24 is directly connected, Tunnel0C 10.1.3.0/24 is directly connected, Loopback0O 10.1.1.1/32 [110/11112] via 10.1.13.1, 01:10:26, Tunnel0S* 0.0.0.0/0 [1/0] via 202.103.23.2RT1#ping 3.3.3.3 source 1.1.1.1 测试IPSEC对等体路由可达Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:Packet sent with a source address of 1.1.1.1!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 24/61/100 msIPSEC配置RT1(config)#crypto isakmp policy 10 IKE阶段传输集encryption deshash md5authentication pre-sharegroup 2crypto isakmp key 6 allen address 3.3.3.3 共享密钥crypto ipsec transform-set laodong esp-des esp-md5-hmac IPSEC阶段传输集access-list 100 permit ip host 10.1.1.1 host 10.1.3.1 IPSEC流量crypto map bluefox local-address Loopback1 loopback接口作为IPSEC源crypto map bluefox 10 ipsec-isakmpset peer 3.3.3.3 对等体IP为对端的loopback接口set transform-set laodongmatch address 100interface Tunnel0crypto map bluefox crypto map应用于Tunnel接口RT3(config)#crypto isakmp policy 10encryption deshash md5authentication pre-sharegroup 2crypto isakmp key 6 allen address 1.1.1.1crypto ipsec transform-set laodong esp-des esp-md5-hmacaccess-list 100 permit ip host 10.1.3.1 host 10.1.1.1crypto map bluefox local-address Loopback1crypto map bluefox 10 ipsec-isakmpset peer 1.1.1.1set transform-set laodongmatch address 100interface Tunnel0crypto map bluefox测试:RT1#ping 10.1.3.1 source 10.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.1.3.1, timeout is 2 seconds:Packet sent with a source address of 10.1.1.1.!!!!Success rate is 80 percent (4/5), round-trip min/avg/max = 68/93/128 msFW# show xlate1 in use,2 most usedPAT Global 202.103.12.10(1024) Local 10.1.12.1(4500)RT1#show crypto isakmp sadst src state conn-id slot status3.3.3.3 1.1.1.1 QM_IDLE 1 0 ACTIVE RT1#show crypto ipsec sainterface: Tunnel0Crypto map tag: bluefox, local addr 1.1.1.1protected vrf: (none)local ident (addr/mask/prot/port): (10.1.1.1/255.255.255.255/0/0)remote ident (addr/mask/prot/port): (10.1.3.1/255.255.255.255/0/0)current_peer 3.3.3.3 port 500PERMIT, flags={origin_is_acl,}#pkts encaps: 9, #pkts encrypt: 9, #pkts digest: 9#pkts decaps: 9, #pkts decrypt: 9, #pkts verify: 9#pkts compressed: 0, #pkts decompressed: 0#pkts not compressed: 0, #pkts compr. failed: 0#pkts not decompressed: 0, #pkts decompress failed: 0#send errors 1, #recv errors 0local crypto endpt.: 1.1.1.1, remote crypto endpt.: 3.3.3.3path mtu 1476, ip mtu 1476, ip mtu idb Tunnel0current outbound spi: 0x2043C509(541312265)inbound esp sas:spi: 0x1B1667DD(454453213)transform: esp-des esp-md5-hmac ,in use settings ={Tunnel, }conn id: 2002, flow_id: SW:2, crypto map: bluefoxsa timing: remaining key lifetime (k/sec): (4417317/2393)IV size: 8 bytesreplay detection support: YStatus: ACTIVEoutbound esp sas:spi: 0x2043C509(541312265)transform: esp-des esp-md5-hmac ,in use settings ={Tunnel, }conn id: 2001, flow_id: SW:1, crypto map: bluefoxsa timing: remaining key lifetime (k/sec): (4417317/2392)IV size: 8 bytesreplay detection support: YStatus: ACTIVE四、总结:由数据包的封装结构分析,IPSEC对等体,GRE源目,IPSEC流量是什么CRYPTO-6-IKMP_MODE_FAILURE: Processing of Quick mode failed with peer at 3.3.3.3快速模式协商失败可能的原因:set peer 对等体错误已经建立数据连接后再次建立,SPI可能错误。
用思科路由器架设动态点到多点GRE Over IPSec

最后,我们还要在多伦多总部为 SOHO 和移动用户开启 L2TP/IPSec 拨入,以方便不能使 用分支机构 VPN 的用户得以安全地接入内部网络。
再次,考虑到 Lan‐to‐LAN VPN 无法承载组播流量,也就无法运行动态路由协议,因此我 们需要在各个站点之间部署 GRE 隧道。我们采用的是多点 GRE Over IPSec 隧道,由多伦多总 部担任 HUB 节点,其他两个分支扮演 SPOKE 节点。
很明显,我们在实施的过程中遇到了一些小问题。GRE 隧道的目的是无法设置为根据域 名动态解析的,因此我们只能寄希望于 IPSec VPN。通过部署 LAN‐to‐LAN VPN 提供一个私有 IP 地址段,我们可以避免动态 IP 对 GRE 隧道造成的影响。
pre‐shared‐key address 0.0.0.0 0.0.0.0 key 1234 ! crypto isakmp policy 10
encr 3des authentication pre‐share group 2 crypto isakmp invalid‐spi‐recovery crypto isakmp keepalive 60 periodic crypto isakmp profile L2L //用于 LAN‐to‐LAN 的 IKE 配置档
DDNS 的配置(以 为例,其他服务商的配置略有不同) ip ddns update method dyndns
HTTP add
http://user:password@/dyndns/update?system=dyndns&hostname=<h>&myi p=<a>&wildcard=ON&backmx=NO&offline=NO
GRE over IPSec环回口

kms页码,1/6SecPath防火 SecPath防火墙 防火墙使用环 使用环回口GRE 回口GRE over IPSec的典型配置 IPSec的典型配置一、 组网需求: 需求: 中心设备和分支设备之间通过GRE over IPSec(野蛮模式)建立VPN隧道,但由于分支出 口地址经常变化,因此采用环回口地址来建立GRE隧道。
从而保证两局域网之间能够互访。
二、 组网图 三、 配置步 配置步骤1.中心: 中心:SecPath1000F的主要配置 SecPath1000F的主要配置: 的主要配置: # sysname zhongxin # ike local-name zhongxin //配置IPSec的野蛮模式 # firewall packet-filter enable firewall packet-filter default permit # ike dpd 1 # ike peer test exchange-mode aggressive pre-shared-key h3c id-type name remote-name fenzhi local-address 202.103.1.1/kms/repository/31046.kmspage2014-05-03kms页码,2/6nat traversal dpd 1 # ipsec proposal 1 # ipsec policy-template 1 10 ike-peer test proposal 1 # ipsec policy test 1 isakmp template 1 # interface GigabitEthernet0/0 loopback ip address 100.1.1.1 255.255.255.0 # interface GigabitEthernet0/1 ip address 202.103.1.1 255.255.255.0 ipsec policy test # interface Tunnel0 //创建Tunnel接口,采用环回口封装 //中心设备采用模板方式ip address 1.1.1.1 255.255.255.0 source 7.7.7.7 destination 6.6.6.6 # interface LoopBack100 ip address 7.7.7.7 255.255.255.0 # firewall zone trust add interface GigabitEthernet0/0 add interface GigabitEthernet0/1 add interface Tunnel0 set priority 85 # ospf 1 //路由配置/kms/repository/31046.kmspage2014-05-03kms页码,3/6area 0.0.0.0 network 1.1.1.0 0.0.0.255 network 100.1.1.0 0.0.0.255 # ip route-static 0.0.0.0 0.0.0.0 202.103.1.2 preference 602.分支: 分支:SecPath500F的主要配置 SecPath500F的主要配置: 的主要配置: # sysname fenzhi # ike local-name zhongxin # firewall packet-filter enable firewall packet-filter default permit # acl number 3000 //配置感兴趣的流量 //配置IPSec的野蛮模式rule 0 permit ip source 6.6.6.0 0.0.0.255 destination 7.7.7.0 0.0.0.255 # ike dpd 1 # ike peer test exchange-mode aggressive pre-shared-key simple h3c id-type name remote-name zhongxin remote-address 202.103.1.1 nat traversal dpd 1 # ipsec proposal 1 # ipsec policy 1 10 isakmp security acl 3000/kms/repository/31046.kmspage2014-05-03kms页码,4/6ike-peer test proposal 1 # interface LoopBack100 ip address 6.6.6.6 255.255.255.255 # interface GigabitEthernet0/0 port link-mode route loopback ip address 200.1.1.1 255.255.255.0 # interface GigabitEthernet0/1 port link-mode route ip address 202.103.2.1 255.255.255.0 ipsec policy 1 # interface Tunnel0 //创建Tunnel接口,采用环回口封装ip address 1.1.1.2 255.255.255.0 source 6.6.6.6 destination 7.7.7.7 # firewall zone trust add interface GigabitEthernet0/0 add interface GigabitEthernet0/1 add interface Tunnel0 set priority 85 # ospf 1 area 0.0.0.0 network 1.1.1.0 0.0.0.255 network 200.1.1.0 0.0.0.255 # ip route-static 0.0.0.0 0.0.0.0 202.103.2.2 # //路由配置/kms/repository/31046.kmspage2014-05-03kms页码,5/63.验证结果 验证结果: 1.网络连通性: [fenzhi]ping -a 1.1.1.2 1.1.1.1 PING 1.1.1.1: 56 data bytes, press CTRL_C to break Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=255 time=2 ms Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=255 time=1 ms[fenzhi]ping -a 200.1.1.1 100.1.1.1 PING 100.1.1.1: 56 data bytes, press CTRL_C to break Reply from 100.1.1.1: bytes=56 Sequence=1 ttl=255 time=1 ms Reply from 100.1.1.1: bytes=56 Sequence=2 ttl=255 time=1 ms 2.VPN的建立: [fenzhi]dis ike sa total phase-1 SAs: 1 connection-id peer flag phase doi---------------------------------------------------------102 103 202.103.1.1 202.103.1.1 RD|ST RD|ST 1 2 IPSEC IPSEC[fenzhi]dis ipsec sa =============================== Interface: GigabitEthernet0/1 path MTU: 1500 ===============================----------------------------IPsec policy name: "1" sequence number: 10 mode: isakmp ----------------------------connection id: 17 encapsulation mode: tunnel perfect forward secrecy: None tunnel:/kms/repository/31046.kmspage2014-05-03kms页码,6/6local address: 202.103.2.1 remote address: 202.103.1.1 Flow : sour addr: 6.6.6.0/255.255.255.0 port: 0 protocol: IP dest addr: 7.7.7.0/255.255.255.0 port: 0 protocol: IP[inbound ESP SAs] spi: 2436129503 (0x913462df) proposal: ESP-ENCRYPT-DES ESP-AUTH-MD5 sa remaining key duration (bytes/sec): 1887427352/3169 max received sequence-number: 91 anti-replay check enable: Y anti-replay window size: 32 udp encapsulation used for nat traversal: N[outbound ESP SAs] spi: 4167546169 (0xf867b539) proposal: ESP-ENCRYPT-DES ESP-AUTH-MD5 sa remaining key duration (bytes/sec): 1887427152/3169 max sent sequence-number: 94 udp encapsulation used for nat traversal: N 四、 配置关键 配置关键点 关键点 请参看注释。
GRE over IPsec 实验

GRE over IPsec 实验1、根据拓扑搭建实验环境2、配置IP地址R1(config)#interface f0/0R1(config-if)#ip add 200.1.1.1 255.255.255.0R1(config-if)#no shutdownR1(config)#interface loopback 0 配置loopback 接口R1(config-if)#ip add 1.1.1.1 255.255.255.0R2(config)#interface f0/0R2(config-if)#ip add 200.1.2.2 255.255.255.0R2(config-if)#no shutdownR2(config)#interface loopback 0 配置loopback 接口R2(config-if)#ip add 2.2.2.2 255.255.255.03、配置路由R1(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.2 Internet的路由R2(config)#ip route 0.0.0.0 0.0.0.0 200.1.2.14、配置GRE隧道R1(config)#interface tunnel 0R1(config-if)#ip add 172.16.1.1 255.255.255.0R1(config-if)#tunnel source 200.1.1.1R1(config-if)#tunnel destination 200.1.2.2R2(config)#interface tunnel 0R2(config-if)#ip add 172.16.1.2 255.255.255.0R2(config-if)#tunnel source 200.1.2.2R2(config-if)#tunnel destination 200.1.1.15、配置隧道路由R1(config)#router ospf 1R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 宣告GRE隧道网络R1(config-router)#network 1.1.1.0 0.0.0.255 area 0 宣告内网网络R1(config)#router ospf 1R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 宣告GRE隧道网络R1(config-router)#network 2.2.2.0 0.0.0.255 area 0 宣告内网网络6、配置IPSec广州路由器配置1)定义隧道的加密认证策略:R1(config)#crypto isakmp policy 10R1(config-isakmp)#authentication pre-share 设置认证方式为预共享密钥方式R1(config-isakmp)#exitR1(config)#crypto isakmp key 0 cisco address 200.1.2.2 设置预共享密钥Cisco 2)定义感兴趣流R1(config)#ip access-list extended gtslistR1(config-ext-nacl)#permit ip 1.1.1.0 0.0.0.255 2.2.2.0 0.0.0.2553)定义转换集--怎么对用户的数据进行加密和认证R1(config)#crypto ipsec transform-set 666 esp-des esp-md5-hmacR1(cfg-crypto-trans)#mode transport 设置传输模式4)定义加密图---R1(config)#crypto map gtsmap 10 ipsec-isakmpR1(config-crypto-map)#match address gtslistR1(config-crypto-map)#set transform-set 666R1(config-crypto-map)#set peer 200.1.2.25)在接口上应用mapR1(config)#interface f0/0R1(config-if)#crypto map gtsmap*Mar 1 00:44:27.151: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ONR1(config-if)#深圳路由器配置1)设置加密认证策略crypto isakmp policy 10authentication pre-sharecrypto isakmp key cisco address 200.1.1.12)定义感兴趣流ip access-list extended gtslistpermit ip 2.2.2.0 0.0.0.255 1.1.1.0 0.0.0.2553)定义转换集--数据保护crypto ipsec transform-set 666 esp-des esp-md5-hmacmode transport4)汇总策略mapcrypto map stgmap 10 ipsec-isakmpset peer 200.1.1.1set transform-set 666match address gtslist5)应用策略到接口Interface f0/0Crypto map stgmap查看安全关联R3#show crypto ipsec sa IPsec。
greoveripsec原理实验

greoveripsec原理实验
GRE over IPsec(Generic Routing Encapsulation over IPsec)是
一种网络隧道协议,它将GRE封装在IPsec中进行加密和认证。
它的原理的实验大致分为以下几个步骤:
1. 确保你有两台物理设备或虚拟机,并且均支持GRE和IPsec。
2. 配置第一台设备的GRE接口。
在第一台设备上,你需要创
建一个GRE隧道接口,并设置其参数,例如隧道IP地址、本
地IP地址和远程IP地址。
3. 配置第一台设备的IPsec策略。
使用IPsec协议对GRE隧道
进行加密和认证,你需要配置相应的IPsec策略,包括加密算法、认证算法和密钥等。
4. 配置第二台设备的GRE接口。
与第一台设备类似,你需要
在第二台设备上创建一个对应的GRE隧道接口,并设置其参数,包括隧道IP地址、本地IP地址和远程IP地址。
5. 配置第二台设备的IPsec策略。
同样,你需要在第二台设备
上配置相同的IPsec策略,以确保与第一台设备间的通信经过IPsec加密和认证。
6. 测试隧道是否正常工作。
在两台设备上ping对方的GRE隧
道IP地址,如果能够正常通信,说明GRE over IPsec隧道已
经建立成功。
需要注意的是,以上步骤只是一个简单的实验示例,具体配置和命令可能会因设备厂商和操作系统版本而略有不同。
在实际应用中,还需考虑防火墙、路由和安全策略等因素,以确保GRE over IPsec的安全和稳定运行。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
1.首先要明白gre是什么时候进行封装的-----当一个普通的报文查找路由表查到下一跳是tunnel口时进行gre封装.
2.了解ipsec什么时候进行封装的----当一个报文从运用了ipsec借口出去的时候进行ipsec封装.
拓扑
tunnel口up时的路由表
tunnel口down时的路由表
产生up down原因:
首先第一个rip包过来,肯定是从tunnel口出去的,所以进行gre封装,然后查找路由表,发现没有10.2.2.1的路由(10.1.1.1和10.2.2.1 建隧道.)只有匹配默认路由出去.所以进行ipsec的封装. 双方都学到对方的路由,tunnel口up.但再一次进行路由信息交换时,还是tunnel口进行封装,封装后的源ip为10.1.1.1目的ip为10.2.2.1.查找路由表,发现10.2.2.1可达.那么交给tunnel
口.tunnel口又进行封装,无限循环,导致包无法发出.在debugging tunnel口时会出现error信息.tunnel error:This packet has looped too many times in the local device.然后tunnel口down掉.
要解决此问题,不network建邻居的loopback口.若用rip协议的时一定要network loopback口时,用router-policy对loopback口的路由进行过滤.。