一、拓扑
二、 GRE关键配置
1、R1和R2及R3实现全网互联互通
ip route-static 0.0.0.0 0.0.0.0 100.1.1.2
ip route-static 0.0.0.0 0.0.0.0 200.1.1.1
R1可以ping通R2
[AR1]ping 200.1.1.2
PING 200.1.1.2: 56 data bytes, press CTRL_C to break
Reply from 200.1.1.2: bytes=56 Sequence=1 ttl=254 time=80 ms
Reply from 200.1.1.2: bytes=56 Sequence=2 ttl=254 time=20 ms
Reply from 200.1.1.2: bytes=56 Sequence=3 ttl=254 time=20 ms
--- 200.1.1.2 ping statistics ---
3 packet(s) transmitted
2、GRE隧道配置
R1配置:
interface Tunnel0/0/0
ip address 172.16.1.1 255.255.255.0
tunnel-protocol gre
source 100.1.1.1
destination 200.1.1.2
R3配置:
interface Tunnel0/0/0
ip address 172.16.1.2 255.255.255.0
tunnel-protocol gre
source 200.1.1.2
destination 100.1.1.1
gre key 123
[AR1]ip route-static 192.168.2.0 255.255.255.0 Tunnel 0/0/0 //配置目标路由到隧道接口
[AR3]ip route-static 192.168.1.0 255.255.255.0 Tunnel 0/0/0//配置目标路由到隧道接口
[AR1]display interface Tunnel 0/0/0
Tunnel0/0/0 current state : UP
Line protocol current state : UP
Last line protocol up time : 2020-09-07 15:51:08 UTC-08:00
Description:HUAWEI, AR Series, Tunnel0/0/0 Interface
Route Port,The Maximum Transmit Unit is 1500
Internet Address is 172.16.1.1/24
Encapsulation is TUNNEL, loopback not set
Tunnel source 100.1.1.1 (GigabitEthernet0/0/1), destination 200.1.1.2
Tunnel protocol/transport GRE/IP, key 123
keepalive disabled
3、通过抓包查看
数据报文中增加了GRE头部及新的封装的公网IP地址
GRE隧道接口启用Keepalive检测功能:
[AR1-Tunnel0/0/0]keepalive period 3
通过抓包查看keepalive period
每天关注的前10名小伙伴关注分享该WX Gongzhonghao:
华亿网络实验室 或 huayinetwork 进行资料下载