欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

HuaWei ❀ 配置GRE Over IPv4

程序员文章站 2024-02-14 13:08:46
...

配置GRE Over IPv4

如下图所示,R1、R2、R3使用OSPF协议路由可达,要求在R1和R3之间建立直连链路,部署GRE隧道,通过静态路由指定到达对端的报文通过隧道接口转发;
HuaWei ❀ 配置GRE Over IPv4

配置接口IP地址:

[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24

配置OSPF:

[r1]ospf 100 router-id 1.1.1.1
[r1-ospf-100]area 0
[r1-ospf-100-area-0.0.0.0]network 12.1.1.0 0.0.0.255

[r2]ospf 100 router-id 2.2.2.2
[r2-ospf-100]area 0
[r2-ospf-100-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[r2-ospf-100-area-0.0.0.0]network 23.1.1.0 0.0.0.255

[r3]ospf 100 router-id 3.3.3.3
[r3-ospf-100]area 0
[r3-ospf-100-area-0.0.0.0]network 23.1.1.0 0.0.0.255

配置GRE:

[r1]int Tunnel 0/0/0
[r1-Tunnel0/0/0]ip address 100.1.1.1 24
[r1-Tunnel0/0/0]tunnel-protocol gre 
[r1-Tunnel0/0/0]source 12.1.1.1
[r1-Tunnel0/0/0]destination 23.1.1.2

[r3]int t0/0/0
[r3-Tunnel0/0/0]ip address 100.1.1.2 24
[r3-Tunnel0/0/0]tunnel-protocol gre 
[r3-Tunnel0/0/0]source 23.1.1.2
[r3-Tunnel0/0/0]destination 12.1.1.1

配置静态路由或者OSPF多进程:

静态路由:
[r1]ip route-static 3.3.3.0 255.255.255.0 Tunnel 0/0/0
[r3]ip route-static 1.1.1.0 255.255.255.0 Tunnel 0/0/0

OSPF 200:
[r1]ospf 200 router-id 1.1.1.1
[r1-ospf-200]area 0
[r1-ospf-200-area-0.0.0.0]network 1.1.1.0 0.0.0.255
[r1-ospf-200-area-0.0.0.0]network 100.1.1.0 0.0.0.255

[r3]ospf 200 router-id 3.3.3.3 
[r3-ospf-200]area 0
[r3-ospf-200-area-0.0.0.0]network 3.3.3.0 0.0.0.255
[r3-ospf-200-area-0.0.0.0]network 100.1.1.0 0.0.0.255

查看配置结果:

[r1]display ip routing-table 3.3.3.3                  
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 1
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        3.3.3.0/24  Static  60   0           D   100.1.1.1       Tunnel0/0/0
相关标签: HuaWei