【华为】BFD与静态路由和RIP联用
- 实验需求
- 配置
- AR1
- AR2
- AR3
- AR4
- 效果
- 抓包查看
实验需求
如上图组网所示,在R1上配置到达R4的Loopback0。
4.4.4.4/32网段的浮动静态路由,正常情况下通过R3访问R4。
当R3故障时,自动选路通过R2访问R4的Loopback0;在R1与R3之间建立BFD会话,并与静态路由绑定,实现故障快速检测和路径快速收敛。
配置
AR1
<AR1>system-view
Enter system view, return user view with Ctrl+Z.
[AR1]sysname AR1
[AR1]undo info-center enable
Info: Information center is disabled.
[AR1]int g0/0/0
[AR1-GigabitEthernet0/0/0]ip address 13.13.13.1 24
[AR1-GigabitEthernet0/0/0]quit
[AR1]int g0/0/01
[AR1-GigabitEthernet0/0/1]ip address 12.12.12.1 24
[AR1-GigabitEthernet0/0/1]qu
## 开启BFD功能
[AR1]bfd
[AR1-bfd]qu
[AR1]bfd 13 bind peer-ip 13.13.13.3 interface GigabitEthernet 0/0/0
[AR1-bfd-session-13]discriminator local 10
[AR1-bfd-session-13]discriminator remote 20
[AR1-bfd-session-13]commit
[AR1-bfd-session-13]qu
[AR1]ip route-static 4.4.4.4 32 13.13.13.3 track bfd-session 13
[AR1]ip route-static 4.4.4.4 32 12.12.12.2 preference 100
AR2
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysn AR2
[AR2]undo info-center enable
Info: Information center is disabled.
[AR2]int g0/0/0
[AR2-GigabitEthernet0/0/0]ip address 12.12.12.2 24
[AR2-GigabitEthernet0/0/0]quit
[AR2]int g0/0/1
[AR2-GigabitEthernet0/0/1]ip address 24.24.24.2 24
[AR2-GigabitEthernet0/0/1]quit
## 开启BFD功能
[AR2]bfd
[AR2-bfd]qu
## RIPv2的宣告
[AR2]rip
[AR2-rip-1]version 2
[AR2-rip-1]undo summary
[AR2-rip-1]bfd all-interface enable ## RIP的全接口启用BFD
[AR2-rip-1]network 12.0.0.0
[AR2-rip-1]network 24.0.0.0
[AR2-rip-1]quit
AR3
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR3
[AR3]undo info-center enable
Info: Information center is disabled.
[AR3]int g0/0/0
[AR3-GigabitEthernet0/0/0]ip address 13.13.13.3 24
[AR3-GigabitEthernet0/0/0]qu
[AR3]int g0/0/01
[AR3-GigabitEthernet0/0/1]ip address 34.34.34.3 24
[AR3-GigabitEthernet0/0/1]qu
## 开启BFD功能
[AR3]bfd
[AR3-bfd]qu
[AR3]bfd 31 bind peer-ip 13.13.13.1 interface g0/0/0
[AR3-bfd-session-31]discriminator local 20
[AR3-bfd-session-31]discriminator remote 10
[AR3-bfd-session-31]commit
[AR3-bfd-session-31]qu
## RIPv2的宣告
[AR3]rip
[AR3-rip-1]version 2
[AR3-rip-1]undo summary
[AR3-rip-1]bfd all-interface enable ## RIP的全接口启用BFD
[AR3-rip-1]network 13.0.0.0
[AR3-rip-1]network 34.0.0.0
[AR3-rip-1]qu
AR4
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname AR4
[AR4]undo info-center enable
Info: Information center is disabled.
[AR4]int g0/0/0
[AR4-GigabitEthernet0/0/0]ip address 34.34.34.4 24
[AR4-GigabitEthernet0/0/0]qu
[AR4]int g0/0/01
[AR4-GigabitEthernet0/0/1]ip address 24.24.24.4 24
[AR4-GigabitEthernet0/0/1]qu
[AR4]int loopback 0
[AR4-LoopBack0]ip address 4.4.4.4 32
[AR4-LoopBack0]qu
## 开启BFD功能
[AR4]bfd
[AR4-bfd]qu
## RIPv2的宣告
[AR4]rip
[AR4-rip-1]version 2
[AR4-rip-1]undo summary
[AR4-rip-1]bfd all-interface enable ## RIP的全接口启用BFD
[AR4-rip-1]network 34.0.0.0
[AR4-rip-1]network 24.0.0.0
[AR4-rip-1]network 4.0.0.0
[AR4-rip-1]qu
效果
在R1身上去 tracert R4的loopback 0 接口地址4.4.4.4/32
可以看到我是走R3的,说明符合我的预期
此时,我把R3的G0/0/0接口shutdown掉
这个时候,可以看到我R1是走R2去访问 4.4.4.4/32 的流量了