BFD实验记录
1、BFD联动静态路由

路由器 | 端口 | IP地址 |
---|
R1 | 0/0/0 | 192.168.12.1/24 |
R1 | 0/0/1 | 192.168.13.1/24 |
R2 | 0/0/0 | 192.168.12.2/24 |
R2 | 0/0/1 | 192.168.234.2/24 |
R3 | 0/0/0 | 192.168.234.3/24 |
R4 | 0/0/0 | 192.168.13.2/24 |
R4 | 0/0/1 | 192.168.234.4/24 |
R1:
[r1]bfd
[r1-bfd]q
[r1]bfd 1 bind peer-ip 192.168.12.2 source 192.168.12.1
[r1-bfd-session-1]discriminator local 1
[r1-bfd-session-1]discriminator remote 2
[r1-bfd-session-1]commit
[r1-bfd-session-1]q
R2:
[r2]bfd
[r2-bfd]q
[r2]bfd 1 bind peer-ip 192.168.12.1 source 192.168.12.2
[r2-bfd-session-1]discriminator local 2
[r2-bfd-session-1]discriminator remote 1
[r2-bfd-session-1]commit
[r2-bfd-session-1]q
R1:
[r1]ip route-static 192.168.234.0 24 192.168.12.2 track bfd-session 1
[r1]ip route-static 192.168.234.0 24 192.168.13.2 preference 100
R3:
[r3]ip route-static 192.168.12.0 24 192.168.234.2
[r3]ip route-static 192.168.13.0 24 192.168.234.4
验证:断掉交换机LSW1的0/0/2接口,看是否能到达192.168.234.3
2、BFD与OSPF联动

路由器 | 端口 | IP地址 |
---|
R1 | 0/0/0 | 192.168.12.1 |
R2 | 0/0/0 | 192.168.12.2 |
R2 | 0/0/1 | 192.168.23.1 |
R3 | 0/0/0 | 192.168.23.2 |
R1:
[r1-GigabitEthernet0/0/0]ospf 1 rou 1.1.1.1
[r1-ospf-1]ar 0
[r1-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255
[r1-ospf-1-area-0.0.0.0]q
[r1-ospf-1]bfd all-interfaces enable
[r1-ospf-1]bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 3
R2:
[r2-GigabitEthernet0/0/1]ospf 1 rou 2.2.2.2
[r2-ospf-1]ar 0
[r2-ospf-1-area-0.0.0.0]network 192.168.12.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255
[r2-ospf-1-area-0.0.0.0]q
[r2-ospf-1]bfd all-interfaces enable
[r2-ospf-1]bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 3
R3:
[r3-GigabitEthernet0/0/0]ospf 1 rou 3.3.3.3
[r3-ospf-1]ar 0
[r3-ospf-1-area-0.0.0.0]network 192.168.23.0 0.0.0.255
[r3-ospf-1-area-0.0.0.0]q
[r3-ospf-1]bfd all-interfaces enable
[r3-ospf-1]bfd all-interfaces min-rx-interval 100 min-tx-interval 100 detect-multiplier 3
验证:
将交换机LSW1的0/0/2接口shutdown,看R1和R2的邻居关系是不是立即断开
3、BFD的单臂回声

路由器 | 接口 | IP地址 |
---|
R1 | /0/0/0 | 192.168.12.1/24 |
R1 | loopback 0 | 1.1.1.1/32 |
R2 | /0/0/0 | 192.168.12.2/24 |
R2 | loopback 0 | 2.2.2.2/32 |
将R2假设为不支持BFD的服务器,单臂回声只有必要配一个本地标识,和一个传送的频率
R1:
[r1]bfd
[r1-bfd]q
[r1]bfd 1 bind peer-ip 192.168.12.2 interface GigabitEthernet 0/0/0 one-arm-echo
[r1-bfd-session-1]discriminator local 1
[r1-bfd-session-1]commit
验证:看BFD是否UP
[r1]display bfd session all verbose
4、BFD和VRRP联动

PC配置

路由器 | 接口 | IP地址 |
---|
R1 | 0/0/1 | 192.168.100.1 |
R1 | 0/0/0 | 192.168.13.1 |
R2 | 0/0/1 | 192.168.100.2 |
R2 | 0/0/0 | 192.168.24.1 |
(R1,R2) | VRRP 1 | 192.168.100.254 |
R3 | 0/0/0 | 192.168.35.1 |
R3 | 0/0/1 | 192.168.13.2 |
R4 | 0/0/0 | 192.168.45.1 |
R4 | 0/0/1 | 192.168.24.2 |
R5 | 0/0/0 | 192.168.35.2 |
R5 | 0/0/0 | 192.168.45.2 |
R5 | loopback 0 | 5.5.5.5 |
路由打通用OSPF
配置VRRP
R1:
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]vrrp vrid 1 virtual-ip 192.168.100.254
[r1-GigabitEthernet0/0/1]vrrp vrid 1 priority 120
[r1-GigabitEthernet0/0/1]vrrp vrid 1 preempt-mode timer delay 15
R2:
[r2]int g 0/0/1
[r2-GigabitEthernet0/0/1]vrrp vrid 1 virtual-ip 192.168.100.254
[r2-GigabitEthernet0/0/1]vrrp vrid 1 priority 100
[r2-GigabitEthernet0/0/1]vrrp vrid 1 preempt-mode timer delay 15
验证

走的是R1,现在模拟链路故障,在R3上将0/0/0接口断开,再次tracert 5.5.5.5

路由线路不是走R2->R4->R5,而是R1->R2->R4->R5,这是因为vrrp检测不到链路出现了故障,现在配置BFD检测链路状况与VRRP联动
配置BFD
R1:
[r1]bfd
[r1-bfd]q
[r1]bfd 1to5 bind peer-ip 192.168.35.2
[r1-bfd-session-1to5]discriminator local 1
[r1-bfd-session-1to5]discriminator remote 2
[r1-bfd-session-1to5]min-rx-interval 10
[r1-bfd-session-1to5]min-tx-interval 10
[r1-bfd-session-1to5]commit
R5:
[r5]bfd
[r5-bfd]q
[r5]bfd 1to5 bind peer-ip 192.168.100.1
[r5-bfd-session-1to5]discriminator local 2
[r5-bfd-session-1to5]discriminator remote 1
[r5-bfd-session-1to5]min-rx-interval 10
[r5-bfd-session-1to5]min-tx-interval 10
[r5-bfd-session-1to5]commit
在R1VRRP中联动BFD
R1:
[r1]int g 0/0/1
[r1-GigabitEthernet0/0/1]vrrp vrid 1 track bfd-session 1 reduced 50
验证:模拟R3与R5之间链路出现故障,用PC去ping 5.5.5.5,看经过的路径

现在的路由路径为R2->R4->R5,证明BFD起了作用