当前位置:网站首页>华为路由器:GRE技术

华为路由器:GRE技术

2022-06-24 07:07:00 兔子王cool

实验拓扑

在这里插入图片描述

R1 按照拓扑配置好IP地址

这里省略。

R2 GRE部分的配置

#按照拓扑图配置好IP
ip route-static 0.0.0.0 0 10.10.10.2       #加一条路由,使得两个公网IP互通
[R2]interface Tunnel0/0/0                  #新建隧道
[R2-Tunnel0/0/0]description to_jikong      #隧道描述
[R2-Tunnel0/0/0]tunnel-protocol gre        #隧道协议
[R2-Tunnel0/0/0]source 10.10.10.1          #源地址
[R2-Tunnel0/0/0]de?                        #注意这两容易敲错,一定要destination
  description  Specify interface description
  destination  Destination address of the tunnel interface
[R2-Tunnel0/0/0]destination 10.10.20.1     #目标地址,注意这两容易敲错
[R2-Tunnel0/0/0]ip add 192.168.254.1 24    #给隧道配置地址
[R2-Tunnel0/0/0]q
[R2]ip route-static 192.168.12.0 255.255.255.0 192.168.254.2   #给隧道配置静态路由

需要注意的是:description(描述)和destination(目标地址),很容易敲错。

R3 GRE部分的配置

ip route-static 0.0.0.0 0 10.10.20.2    
[R3]interface Tunnel0/0/0
[R3-Tunnel0/0/0]description to_office
[R3-Tunnel0/0/0]tunnel-protocol gre
[R3-Tunnel0/0/0]source 10.10.20.1
[R3-Tunnel0/0/0]destination 10.10.10.1
[R3-Tunnel0/0/0]ip add 192.168.254.1 24
[R3-Tunnel0/0/0]q
[R3]ip route-static 192.168.11.0 255.255.255.0 192.168.254.1

验证结果

PC>ping 192.168.12.1

Ping 192.168.12.1: 32 data bytes, Press Ctrl_C to break
From 192.168.12.1: bytes=32 seq=1 ttl=126 time=15 ms
From 192.168.12.1: bytes=32 seq=2 ttl=126 time=16 ms
From 192.168.12.1: bytes=32 seq=3 ttl=126 time=15 ms
From 192.168.12.1: bytes=32 seq=4 ttl=126 time=32 ms
From 192.168.12.1: bytes=32 seq=5 ttl=126 time=31 ms
PC>ping 192.168.11.1

Ping 192.168.11.1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.11.1: bytes=32 seq=2 ttl=126 time=16 ms
From 192.168.11.1: bytes=32 seq=3 ttl=126 time=16 ms
From 192.168.11.1: bytes=32 seq=4 ttl=126 time=31 ms
From 192.168.11.1: bytes=32 seq=5 ttl=126 time=16 ms
原网站

版权声明
本文为[兔子王cool]所创,转载请带上原文链接,感谢
https://blog.csdn.net/pokes/article/details/125366232