BFD(Bidirectional Forwarding Detection)是双向转发检测,它是一种实现网络可靠性的机制,它可被用于检测网络中的链路状况,IP可达性等,BFD可以与多种协议或机制进行联动,以确保它们更加可靠的工作,例如静态路由、OSPF、ISIS、BGP、VRRP、PIM及MPLS LSP等。
案例一
按照上面的拓扑图把基础信息先配置好。这里我们采用浮动路由,主线路由优先级默认60,备线路由优先级70。
R1
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sys R1
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 12.1.1.1 24
[R1-GigabitEthernet0/0/1]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]ip add 21.1.1.1 24
[R1-GigabitEthernet0/0/0]q
[R1]int LoopBack 0
[R1-LoopBack0]ip add 1.1.1.1 24
[R1-LoopBack0]q
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Direct 0 0 D 1.1.1.1 LoopBack0
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
1.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet0/0/1
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
21.1.1.0/24 Direct 0 0 D 21.1.1.1 GigabitEthernet0/0/0
21.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
21.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
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
[R1]ip route-static 2.2.2.0 24 12.1.1.2
[R1]ip route-static 2.2.2.0 24 21.1.1.2
[R1]undo ip route-static 2.2.2.0 24 21.1.1.2
[R1]ip route-static 2.2.2.0 24 21.1.1.2 ?
description Add or delete description of unicast static route
inherit-cost Inherit the cost of the iterated route
permanent Specifies route permanent
preference Specifies route preference
tag Specifies route tag
track Specify track object
<cr> Please press ENTER to execute command
[R1]ip route-static 2.2.2.0 24 21.1.1.2 pr
[R1]ip route-static 2.2.2.0 24 21.1.1.2 preference 70
#静态路由默认是60,这里优先级设置成70意思就是备份。如果设置成50就是主线
[R1]dis ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 14 Routes : 14
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.0/24 Direct 0 0 D 1.1.1.1 LoopBack0
1.1.1.1/32 Direct 0 0 D 127.0.0.1 LoopBack0
1.1.1.255/32 Direct 0 0 D 127.0.0.1 LoopBack0
2.2.2.0/24 Static 60 0 主 RD 12.1.1.2 GigabitEthernet0/0/1
12.1.1.0/24 Direct 0 0 D 12.1.1.1 GigabitEthernet0/0/1
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
12.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/1
21.1.1.0/24 Direct 0 0 D 21.1.1.1 GigabitEthernet0/0/0
21.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
21.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0