构建实验拓扑
R1
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 2.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 1.1.1.10 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]vrrp vrid 1 virtual-ip 1.1.1.100 //设置编号为1的VRRP组虚拟IP为1.100
[Huawei-GigabitEthernet0/0/1]vrrp vrid 1 priority 120
//优先级为120
[Huawei-GigabitEthernet0/0/1]vrrp vrid 1 preempt-mode timer delay 20 //占先的延迟为20秒
[Huawei-GigabitEthernet0/0/1]vrrp vrid 1 track interface g0/0/0 //端口追踪
[Huawei-GigabitEthernet0/0/1]q
[Huawei]bfd //全局开启BFD联动
[Huawei-bfd]q
[Huawei]bfd 1 bind peer-ip 1.1.1.20
[Huawei-bfd-session-1]discriminator local 1
[Huawei-bfd-session-1]discriminator remote 2
[Huawei-bfd-session-1]commit
[Huawei-bfd-session-1]q
Total:1 Master:1 Backup:0 Non-active:0
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Master GE0/0/1 Normal 1.1.1.100
GigabitEthernet0/0/1 | Virtual Router 1
State : Master
Virtual IP : 1.1.1.100
Master IP : 1.1.1.10
PriorityRun : 120
PriorityConfig : 120
MasterPriority : 120
Preempt : YES Delay Time : 20 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Track IF : GigabitEthernet0/0/0 Priority reduced : 10
IF state : UP
Create time : 2021-12-22 11:58:02 UTC-08:00
Last change time : 2021-12-22 11:58:06 UTC-08:00
[Huawei]int g0/0/
[Huawei-GigabitEthernet0/0/1]shutdown //模拟断开
R2
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 3.1.1.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 1.1.1.20 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]vrrp vrid 1 virtual-ip 1.1.1.100
[Huawei-GigabitEthernet0/0/1]vrrp vrid 1 preempt-mode timer delay 0
[Huawei-GigabitEthernet0/0/1]vrrp vrid 1 track interface g0/0/0
[Huawei-GigabitEthernet0/0/1]q
[Huawei]bfd
[Huawei-bfd]q
[Huawei]bfd 2 bind peer-ip 1.1.1.10
[Huawei-bfd-session-2]discriminator local 2
[Huawei-bfd-session-2]discriminator remote 1
[Huawei-bfd-session-2]commit
[Huawei-bfd-session-2]q
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]vrrp vrid 1 track bfd session 2 increased 30
[Huawei-GigabitEthernet0/0/1]q
[Huawei]display bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
2 1 1.1.1.10 Up S_IP_PEER -
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
[Huawei]display vrrp
GigabitEthernet0/0/1 | Virtual Router 1
State : Backup
Virtual IP : 1.1.1.100
Master IP : 1.1.1.10
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 120
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Track IF : GigabitEthernet0/0/0 Priority reduced : 10
IF state : UP
Track BFD : 2 Priority increased : 30
BFD-session state : UP
Create time : 2021-12-22 12:00:05 UTC-08:00
Last change time : 2021-12-22 12:00:05 UTC-08:00
[Huawei]display vrrp brief
Total:1 Master:0 Backup:1 Non-active:0
VRID State Interface Type Virtual IP
----------------------------------------------------------------
1 Backup GE0/0/1 Normal 1.1.1.100
[Huawei]q
GigabitEthernet0/0/1 | Virtual Router 1
State : Master
Virtual IP : 1.1.1.100
Master IP : 1.1.1.20
PriorityRun : 130
PriorityConfig : 100
MasterPriority : 130
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-0101
Check TTL : YES
Config type : normal-vrrp
Backup-forward : disabled
Track IF : GigabitEthernet0/0/0 Priority reduced : 10
IF state : UP
Track BFD : 2 Priority increased : 30
BFD-session state : DOWN
Create time : 2021-12-22 12:00:05 UTC-08:00
Last change time : 2021-12-22 12:09:50 UTC-08:00