静态浮动路由与双线热备份
知识点
拓扑图
实验步骤
1.配置去往0.0.0.0的静态路由(两台优先级60和70),查看路由表
[GW]ip route-static 0.0.0.0 0.0.0.0 10.1.1.1
[GW]ip route-static 0.0.0.0 0.0.0.0 20.1.1.1 preference 70
[GW]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 60 0 RD 10.1.1.1 GigabitEthernet
0/0/0
10.1.1.0/24 Direct 0 0 D 10.1.1.2 GigabitEthernet
0/0/0
10.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
20.1.1.0/24 Direct 0 0 D 20.1.1.2 GigabitEthernet
0/0/1
20.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
20.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
2.配置loopback,ip 123.1.1.1
[DianXin]int loopback 0
[DianXin-LoopBack0]ip address 123.1.1.1 255.255.255.0
[LianTong]int loopback 0
[LianTong-LoopBack0]ip address 123.1.1.1 255.255.255.0
3.网关ping123.1.1.1,通
[GW]ping 123.1.1.1
PING 123.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 123.1.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=3 ttl=255 time=40 ms
Reply from 123.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=5 ttl=255 time=10 ms
--- 123.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/22/40 ms
4.shutdown网关设备通往电信的出接口G0/0/0
[GW]int GigabitEthernet0/0/0
[GW-GigabitEthernet0/0/0]shutdown
5.ping123.1.1.1
[GW]ping 123.1.1.1
PING 123.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 123.1.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=3 ttl=255 time=40 ms
Reply from 123.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=5 ttl=255 time=10 ms
--- 123.1.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 10/22/40 ms
6.查看路由表,发现0.0.0.0路由表优先级由60变为70.
到这一步就实现了静态浮动路由双线热备份
[GW]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 11 Routes : 11
Destination/Mask Proto Pre Cost Flags NextHop Interface
0.0.0.0/0 Static 70 0 RD 20.1.1.1 GigabitEthernet
0/0/1
10.1.1.0/24 Direct 0 0 D 10.1.1.2 GigabitEthernet
0/0/0
10.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
10.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
20.1.1.0/24 Direct 0 0 D 20.1.1.2 GigabitEthernet
0/0/1
20.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
20.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
接下来将通过BFD协议来实现单臂回声,检测链路的通信是否正常,实现网络实时连通。
7.现将原本shutdown的G0/0/0口恢复
[GW]int g0/0/0
[GW-GigabitEthernet0/0/0]undo shutdown
8.重新ping123.1.1.1,查看路由表,路由表的静态路由恢复成原来的电信60。
9.shutdown电信的g0/0/0口,从网关ping123.1.1.1.显示连接超时。查看路由表信息发现去往0.0.0.0的静态路由还是60,没有变成70.
[DianXin]int g0/0/0
[DianXin-GigabitEthernet0/0/0]shutdown
10.配置bfd协议
[GW]bfd
[GW-bfd]q
[GW]bfd huawei bind peer-ip 10.1.1.1 interface g0/0/0 one-arm-echo
[GW-bfd-session-huawei]discriminator local 111
[GW-bfd-session-huawei]commit
11.将原本通往10.1.1.1的静态路由undo
[GW]undo ip route-static 0.0.0.0 0 10.1.1.1
[GW]ip route-static 0.0.0.0 0 10.1.1.1 track bfd-session huawei
12.查看bfd 可以看见去往10.1.1.1的线路显示down
[GW]dis bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
111 - 10.1.1.1 Down S_IP_IF GigabitEthernet0/0/0
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 0/1
13.先恢复电信的g0/0/0口,这个时候一直ping123.1.1.1 -t,是通的。
然后shutdown g0/0/0口,可以看见ping页面丢了两个包,后右恢复了连接
[GW]ping 123.1.1.1
PING 123.1.1.1: 56 data bytes, press CTRL_C to break
Reply from 123.1.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 123.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms
Request timeout!
Request timeout!
Reply from 123.1.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=4 ttl=255 time=20 ms
Reply from 123.1.1.1: bytes=56 Sequence=5 ttl=255 time=20 ms