1、配置 OSPF 联动 BFD 实现快速收敛。
2、配置 BDF 联动静态浮动路由实现故障切换。
[AR1]interface GigabitEthernet 2/0/0
[AR1-GigabitEthernet2/0/0]ip address 10.10.10.1 24
[AR1-GigabitEthernet2/0/0]quit
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]ip address 1.1.1.1 24
[AR1-GigabitEthernet0/0/0]quit
[AR1]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]ip address 2.2.2.1 24
[AR1-GigabitEthernet0/0/1]quit
[AR2]interface GigabitEthernet 0/0/0
[AR2-GigabitEthernet0/0/0]ip address 2.2.2.2 24
[AR2-GigabitEthernet0/0/0]quit
[AR2]interface GigabitEthernet 0/0/1
[AR2-GigabitEthernet0/0/1]ip address 3.3.3.2 24
[AR2-GigabitEthernet0/0/1]quit
[AR3]interface GigabitEthernet 2/0/0
[AR3-GigabitEthernet2/0/0]ip address 20.20.20.1 24
[AR3-GigabitEthernet2/0/0]quit
[AR3]interface GigabitEthernet 0/0/0
[AR3-GigabitEthernet0/0/0]ip address 1.1.1.3 24
[AR3-GigabitEthernet0/0/0]quit
[AR3]interface GigabitEthernet 0/0/1
[AR3-GigabitEthernet0/0/1]ip address 3.3.3.3 24
[AR3-GigabitEthernet0/0/1]quit
直接在区域里面将每个路由的所有接口都声明进 OSPF 的 0 区域中(实际工作一般不这么配置)
[AR1]ospf 1 router-id 1.1.1.1
[AR1-ospf-1]area 0
[AR1-ospf-1-area-0.0.0.0]network 0.0.0.0 0.0.0.0
[AR2]ospf 1 router-id 2.2.2.2
[AR2-ospf-1]area 0
[AR2-ospf-1-area-0.0.0.0]network 0.0.0.0 0.0.0.0
[AR3]ospf 1 router-id 3.3.3.3
[AR3-ospf-1]area 0
[AR3-ospf-1-area-0.0.0.0]network 0.0.0.0 0.0.0.0
使能 BFD 功能
[AR1]bfd
[AR1-bfd]quit
方法一:进入接口。开启 OSPF BFD 功能。配置接受和发送的检测报文时间(默认 1000 毫秒)
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]ospf bfd enable
[AR1-GigabitEthernet0/0/0]ospf bfd min-rx-interval 100 min-tx-interval 100
[AR2]bfd
[AR2-bfd]quit
方法二:进入 OSPF 进程。启用所有接口的 BFD 功能。配置检测报文时间。
[AR2]ospf 1
[AR2-ospf-1]bfd all-interfaces enable
[AR2-ospf-1]bfd all-interfaces min-rx-interval 100 min-tx-interval 100
[AR3]bfd
[AR3-bfd]quit
[AR3]interface GigabitEthernet 0/0/0
[AR3-GigabitEthernet0/0/0]ospf bfd enable
[AR3-GigabitEthernet0/0/0]ospf bfd min-rx-interval 100 min-tx-interval 100
[AR1]ip route-static 20.20.20.0 255.255.255.0 1.1.1.3
[AR1]ip route-static 20.20.20.0 255.255.255.0 2.2.2.2 preference 70
[AR2]ip route-static 20.20.20.0 255.255.255.0 3.3.3.3
[AR2]ip route-static 10.10.10.0 255.255.255.0 2.2.2.1
[AR3]ip route-static 10.10.10.0 255.255.255.0 1.1.1.1
[AR3]ip route-static 10.10.10.0 255.255.255.0 3.3.3.2 preference 70
使能 BFD 功能。
[AR1]bfd
[AR1-bfd]quit
创建名为 a1toa3 的 BFD 绑定检测。(auto 一般要加上,自协商标签,不加需要手动配置)
[AR1]bfd a1toa3 bind peer-ip 1.1.1.3 source-ip 1.1.1.1 auto
[AR1-bfd-session-a1toa3]min-rx-interval 100
[AR1-bfd-session-a1toa3]min-tx-interval 100
[AR1-bfd-session-a1toa3]quit
AR3 路由器也这样配置检测
[AR3]bfd
[AR3-bfd]quit
[AR3]bfd a3toa1 bind peer-ip 1.1.1.1 source-ip 1.1.1.3 auto
[AR3-bfd-session-a3toa1]min-rx-interval 100
[AR3-bfd-session-a3toa1]min-tx-interval 100
[AR3-bfd-session-a3toa1]quit
配置 BFD 静态路由检测绑定。
注意:将两台路由器配置检测配置完成后,才开始给静态路由绑定 BFD 检测。
如果只是单向配置了一个绑定,此路由不会生效,需要双向配置完成后,静态路由条目才会生效。
[AR1]ip route-static 20.20.20.0 255.255.255.0 1.1.1.3 track bfd-session a1toa3
[AR3]ip route-static 10.10.10.0 255.255.255.0 1.1.1.1 track bfd-session a3toa1
查看 BFD 会话信息
<AR1>display bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
8192 8192 1.1.1.3 Up S_AUTO_PEER -
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0