拓扑图zai
查看vrrp
<S1>display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
10 Master Vlanif10 Normal 192.168.10.254
20 Backup Vlanif20 Normal 192.168.20.254
----------------------------------------------------------------
Total:2 Master:1 Backup:1 Non-active:0
<S1>
<S2>display vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
10 Backup Vlanif10 Normal 192.168.10.254
20 Master Vlanif20 Normal 192.168.20.254
----------------------------------------------------------------
Total:2 Master:1 Backup:1 Non-active:0
<S2>
心跳线与mstp
s1与s2的g0/0/10接口设置trunk,并允许所有vlan通过。
开启mstp模式,vlan10主网关设备为s1,备份设备为s2.
vlan20主网关设备为s2,备份设备为s21
s1配置
[S1]stp re
[S1]stp region-configuration 配置mstp
[S1-mst-region]re
[S1-mst-region]region-name ntd 取名ntd
[S1-mst-region]ins
[S1-mst-region]instance 10 v
[S1-mst-region]instance 10 vlan 10 vlan10加入实例10
[S1-mst-region]ins
[S1-mst-region]instance 20 v
[S1-mst-region]instance 20 vlan 20 vlan20加入实例20
[S1-mst-region]dis this
#
stp region-configuration
region-name ntd
instance 10 vlan 10
instance 20 vlan 20
active region-configuration
#
return
[S1]stp ins
[S1]stp instance 10 pri
[S1]stp instance 10 priority 4096 实例10优先级改为4096(越小越优先)
[S1]stp ins
[S1]stp instance 20 pri
[S1]stp instance 20 priority 8192 实例20优先级改为8192(优先级:范围0-65535(理论取值范围),实际取值范围0-61440,默认32768,步长4096)
S2配置
<S2>u t m
Info: Current terminal monitor is off.
<S2>sy
Enter system view, return user view with Ctrl+Z.
[S2]stp region-configuration
[S2-mst-region] region-name ntd
[S2-mst-region] instance 10 vlan 10
[S2-mst-region] instance 20 vlan 20
[S2-mst-region] active region-configuration
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2-mst-region]
[S2]stp ins
[S2]stp instance 10 p
[S2]stp instance 10 priority 8192
[S2]stp ins
[S2]stp instance pri
[S2]stp instance 20 pri
[S2]stp instance 20 priority 4096
[S2]
查看mstp是否配置成功
[S1]dis stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/1 DESI FORWARDING NONE
0 GigabitEthernet0/0/10 DESI FORWARDING NONE
10 GigabitEthernet0/0/1 DESI FORWARDING NONE
指定端口
10 GigabitEthernet0/0/10 DESI FORWARDING NONE
20 GigabitEthernet0/0/1 DESI DISCARDING NONE
20 GigabitEthernet0/0/10 ROOT FORWARDING NONE
[S2]dis stp brief
MSTID Port Role STP State Protection
0 GigabitEthernet0/0/1 DESI FORWARDING NONE
0 GigabitEthernet0/0/2 DESI FORWARDING NONE
0 GigabitEthernet0/0/10 ROOT FORWARDING NONE
10 GigabitEthernet0/0/1 DESI FORWARDING NONE
10 GigabitEthernet0/0/10 ROOT FORWARDING NONE
20 GigabitEthernet0/0/1 DESI FORWARDING NONE
指定端口
20 GigabitEthernet0/0/10 DESI FORWARDING NONE
[S2]
vrrp联动bfd
拓扑图
s1基础配置
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy sw1
[sw1]
[sw1]
[sw1]vlan 10
[sw1-vlan10]
[sw1-vlan10]q
[sw1]int g0/0/1
[sw1-GigabitEthernet0/0/1]port l
[sw1-GigabitEthernet0/0/1]port link-t t
[sw1-GigabitEthernet0/0/1]port t a v a
[sw1-GigabitEthernet0/0/1]
[sw1-GigabitEthernet0/0/1]q
[sw1]int v
[sw1]int Vlanif 10
[sw1-Vlanif10]ip add
[sw1-Vlanif10]ip address 192.168.10.251 24
[sw1-Vlanif10]vrrp v
[sw1-Vlanif10]vrrp vrid 10 vi
[sw1-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
[sw1-Vlanif10]vrrp vr
[sw1-Vlanif10]vrrp vrid 10 pri
[sw1-Vlanif10]vrrp vrid 10 priority 130
s2基础配置
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy sw2
[sw2]
[sw2]vlan 10
[sw2-vlan10]
[sw2-vlan10]q
[sw2]int g0/0/01
[sw2-GigabitEthernet0/0/1]port l
[sw2-GigabitEthernet0/0/1]port link-t
[sw2-GigabitEthernet0/0/1]port link-type
[sw2-GigabitEthernet0/0/1]port link-type t
[sw2-GigabitEthernet0/0/1]port t
[sw2-GigabitEthernet0/0/1]port trunk a
[sw2-GigabitEthernet0/0/1]port trunk allow-pass v
[sw2-GigabitEthernet0/0/1]port trunk allow-pass vlan a
[sw2-GigabitEthernet0/0/1]
[sw2-GigabitEthernet0/0/1]q
[sw2]int v
[sw2]int Vlanif 10
[sw2-Vlanif10]ip add
[sw2-Vlanif10]ip address 192.168.10.252 24
[sw2-Vlanif10]vrrp vr
[sw2-Vlanif10]vrrp vrid 10 vi
[sw2-Vlanif10]vrrp vrid 10 virtual-ip 192.168.10.254
s3基础配置
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]sy sw3
[sw3]
[sw3]
[sw3]
[sw3]vlan 10
[sw3-vlan10]q
[sw3]int g0/0/3
[sw3-GigabitEthernet0/0/3]port l
[sw3-GigabitEthernet0/0/3]port link-t
[sw3-GigabitEthernet0/0/3]port link-type a
[sw3-GigabitEthernet0/0/3]port def v 10
[sw3-GigabitEthernet0/0/3]q
[sw3]port-g
[sw3]port-group g
[sw3]port-group group-member g0/0/1 g0/0/2
[sw3-port-group]port l
[sw3-port-group]port link-t
[sw3-port-group]port link-type t
[sw3-GigabitEthernet0/0/1]port link-type t
[sw3-GigabitEthernet0/0/2]port link-type t
[sw3-port-group]port t
[sw3-port-group]port trunk a
[sw3-port-group]port trunk allow-pass v
[sw3-port-group]port trunk allow-pass vlan a
[sw3-port-group]port trunk allow-pass vlan all
[sw3-GigabitEthernet0/0/1]port trunk allow-pass vlan all
[sw3-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[sw3-port-group]
验证
<sw1>dis vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
10 Master Vlanif10 Normal 192.168.10.254
----------------------------------------------------------------
Total:1 Master:1 Backup:0 Non-active:0
<sw1>
<sw2>dis vrrp brief
VRID State Interface Type Virtual IP
----------------------------------------------------------------
10 Backup Vlanif10 Normal 192.168.10.254
----------------------------------------------------------------
Total:1 Master:0 Backup:1 Non-active:0
<sw2>
sw1bfd配置
[sw1]bfd
[sw1-bfd]q
[sw1]bfd nnn bin
[sw1]bfd nnn bind p
[sw1]bfd nnn bind peer-ip 192.168.10.252
[sw1-bfd-session-nnn]dis
[sw1-bfd-session-nnn]discriminator l
[sw1-bfd-session-nnn]discriminator local 10
[sw1-bfd-session-nnn]dis
[sw1-bfd-session-nnn]discriminator
[sw1-bfd-session-nnn]discriminator r
[sw1-bfd-session-nnn]discriminator remote 20
[sw1-bfd-session-nnn]min-
[sw1-bfd-session-nnn]min-tx-interval 100
[sw1-bfd-session-nnn]min-r
[sw1-bfd-session-nnn]min-rx-interval 100
[sw1-bfd-session-nnn]co
[sw1-bfd-session-nnn]commit
[sw1-bfd-session-nnn]
<sw1>dis bfd session all
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
10 20 192.168.10.252 Up S_IP_PEER -
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
sw2bfd配置
[sw2]bfd
[sw2-bfd]q
[sw2]bfd nnn b
[sw2]bfd nnn bind p
[sw2]bfd nnn bind peer-ip 192.168.10.251
[sw2-bfd-session-nnn]dis
[sw2-bfd-session-nnn]discriminator l
[sw2-bfd-session-nnn]discriminator local 20
[sw2-bfd-session-nnn]dis
[sw2-bfd-session-nnn]discriminator r
[sw2-bfd-session-nnn]discriminator remote 10
[sw2-bfd-session-nnn]min-
[sw2-bfd-session-nnn]min-tx-interval 100
[sw2-bfd-session-nnn]min-r
[sw2-bfd-session-nnn]min-rx-interval 100
[sw2-bfd-session-nnn]co
[sw2-bfd-session-nnn]commit
<sw2>d b s a
--------------------------------------------------------------------------------
Local Remote PeerIpAddr State Type InterfaceName
--------------------------------------------------------------------------------
20 10 192.168.10.251 Up S_IP_PEER -
--------------------------------------------------------------------------------
Total UP/DOWN Session Number : 1/0
<sw2>
bfd追踪
[sw2]int Vlanif 10
[sw2-Vlanif10]vrrp vr
[sw2-Vlanif10]vrrp vrid 10 tr
[sw2-Vlanif10]vrrp vrid 10 track ?
admin-vrrp Specify configuration information of the administrator VRRP
bfd-session Specify BFD session
interface Interface information
ip Specify IP protocol
nqa Specify NQA test class
[sw2-Vlanif10]vrrp vrid 10 track bfd
[sw2-Vlanif10]vrrp vrid 10 track bfd-session 20 in
[sw2-Vlanif10]vrrp vrid 10 track bfd-session 20 increased 50 //20是本地标识符标志
跟踪 bfd会话 增加 50
<sw2>display vrrp
Vlanif10 | Virtual Router 10
State : Backup
Virtual IP : 192.168.10.254
Master IP : 192.168.10.251
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 130
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-010a
Check TTL : YES
Config type : normal-vrrp
Track BFD : 20 Priority increased : 50
BFD-session state : UP
Create time : 2023-06-28 09:09:31 UTC-08:00
Last change time : 2023-06-28 09:28:55 UTC-08:00
删除s1与s3之间的链路再查看s2vrrp配置
<sw2>display vrrp
Vlanif10 | Virtual Router 10
State : Master
Virtual IP : 192.168.10.254
Master IP : 192.168.10.252
PriorityRun : 150
PriorityConfig : 100
MasterPriority : 150
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-010a
Check TTL : YES
Config type : normal-vrrp
Track BFD : 20 Priority increased : 50
BFD-session state : DOWN
Create time : 2023-06-28 09:09:31 UTC-08:00
Last change time : 2023-06-28 10:24:54 UTC-08:00
解析:当BFD会话状态为down,BFD就告诉vRRP协议-Sw2
2哥,我们和sw1之间会话down了,BFD所提供的功能,仅仅是链路检测,
当sw2的vrrp协议发现和sw1之间的链路down了,sw2就会认为Sw1出现故障,无法正常转发数据了所以sw2会让vrrp协议调高自己的优先级,在原来1ee的基础上,增加6e,成为新的master
重新连接s1与s2
查看vrrp,s1 重新成为master,s2恢复成backup
<sw2>display vrrp
Vlanif10 | Virtual Router 10
State : Backup
Virtual IP : 192.168.10.254
Master IP : 192.168.10.251
PriorityRun : 100
PriorityConfig : 100
MasterPriority : 130
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-010a
Check TTL : YES
Config type : normal-vrrp
Track BFD : 20 Priority increased : 50
BFD-session state : UP
Create time : 2023-06-28 09:09:31 UTC-08:00
Last change time : 2023-06-28 10:32:05 UTC-08:00
<sw1>display vrrp
Vlanif10 | Virtual Router 10
State : Master
Virtual IP : 192.168.10.254
Master IP : 192.168.10.251
PriorityRun : 130
PriorityConfig : 130
MasterPriority : 130
Preempt : YES Delay Time : 0 s
TimerRun : 1 s
TimerConfig : 1 s
Auth type : NONE
Virtual MAC : 0000-5e00-010a
Check TTL : YES
Config type : normal-vrrp
Create time : 2023-06-28 09:08:21 UTC-08:00
Last change time : 2023-06-28 10:32:05 UTC-08:00