华为设备GRE配置

该博客介绍了如何配置GRE隧道和使用OSPF动态路由协议,以实现网络互连。配置步骤包括设置路由器接口IP、创建GRE隧道、定义隧道源和目标,以及在路由器两端启用OSPF并宣告相关网络。通过OSPF替代静态路由,实现了网络路由的动态更新和管理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

实验拓扑:

 配置思路:

①写路由器各个接口的ip地址

②向ISP写缺省

③打开Tunnel隧道

④写隧道ip地址

⑤写隧道协议为gre

⑥写source和destination       

//配置过程中写入de然后按tab第一个弹出来的是description而不是destination,注意甄别

⑦向两边环回写静态,下一跳为Tunnel0/0/0

具体配置:

[r1]int l0
[r1-LoopBack0]ip add 192.168.1.1 24
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 10.0.12.1 24

[r1]ip route-static 0.0.0.0 0 10.0.12.2

[r1]int t 0/0/0
[r1-Tunnel0/0/0]ip add 20.1.1.1 24	
[r1-Tunnel0/0/0]tunnel-protocol gre 	
[r1-Tunnel0/0/0]source 10.0.12.1
[r1-Tunnel0/0/0]destination 10.0.23.3

[r1]ip route-static 192.168.2.0 24 Tunnel 0/0/0
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 10.0.12.2 24
[r2]int g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 10.0.23.2 24
[r3]int l0 
[r3-LoopBack0]ip add 192.168.2.1 24
[r3-LoopBack0]int g 0/0/1
[r3-GigabitEthernet0/0/1]ip add 10.0.23.3 24

[r3]ip route-static 0.0.0.0 0 10.0.23.2 

[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip add 20.1.1.2 24	
[r3-Tunnel0/0/0]tunnel-protocol gre 
[r3-Tunnel0/0/0]source 10.0.23.3
[r3-Tunnel0/0/0]destination 10.0.12.1

ip route-static 192.168.1.0 24 Tunnel 0/0/0

测试:

[r3]ping -a 192.168.2.1 192.168.1.1
  PING 192.168.1.1: 56  data bytes, press CTRL_C to break
    Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=255 time=50 ms
    Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
    Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=255 time=30 ms
    Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=255 time=40 ms
    Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms

  --- 192.168.1.1 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 20/34/50 ms

如何使用动态路由来配置呢?

[r1]undo ip route-static 192.168.2.0 24 Tunnel 0/0/0

[r1]ospf 1
[r1-ospf-1]area 0
[r1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255

//注意:宣告的是环回口网段和tunnel网段
[r3]undo ip route-static 192.168.1.0 24 Tunnel 0/0/0

[r3]ospf 1
[r3-ospf-1]area 0
[r3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]network 20.1.1.0 0.0.0.255

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值