前言:
VRRP虚拟路由器冗余协议,两台网关设备互为冗余,防止网关单点故障
MSTP多生成树,提供二层链路的线路冗余,实现多个VLAN的数据负载均衡
BFD双向转发检测,快速链路检查机制,实现两台VRRP冗余设备之间的存活检测
网络拓扑:
划分VLAN10与VLAN20,并在SW1与SW2启用VLAN10与VLAN20的三层接口IP,SW1与SW2互为VRRP冗余。
SW1配置:
sysname SW1 /修改设备名
#
vlan batch 10 20 /批量创建VLAN#
stp mode mstp /启用mstp
#
stp region-configuration /创建MSTP域,设置域名,VLAN绑定实例
region-name 123
instance 1 vlan 10
instance 2 vlan 20
active region-configuration#
stp instance 1 root primary /设置交换机为实例1的根桥
stp instance 2 root secondary /设置交换机为实例2的备用根桥#
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254 /创建VLANIF10的VRRP备份组,设置VRRP虚拟IP
vrrp vrid 10 priority 120 /更改VRRP优先级,默认为100
vrrp vrid 10 preempt-mode timer delay 30 /更改设备的抢占延迟时间
vrrp vrid 10 track interface GigabitEthernet0/0/24 reduced 30 /监控上联接口,若断开减优先级
#
interface Vlanif20
ip address 192.168.20.1 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254 /创建VLANIF 20的VRRP备份组设置VRRP的虚拟IP
vrrp vrid 20 track bfd-session 21 increased 30 /联动BFD会话21
#
interface Eth-Trunk1 /创建链路聚合口,设置为trunk,允许VLAN 10与20通过
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/1 /把接口加入Eth-trunk组1
eth-trunk 1
#
interface GigabitEthernet0/0/2 /把接口加入Eth-trunk组1
eth-trunk 1
#
interface GigabitEthernet0/0/3 /设置接口为trunk,并允许vlan 10与20通过
port link-type trunk
port trunk allow-pass vlan 10 20#
bfd
#bfd 1 bind peer-ip 192.168.10.2 interface Vlanif10 /创建SW1与SW2之间VLANIF 10的静态BFD会话
discriminator local 1
discriminator remote 2
min-tx-interval 100
min-rx-interval 100
commit
#
bfd 2 bind peer-ip 192.168.20.2 interface Vlanif20 /创建SW1与SW2之间VLANIF 20的静态BFD会话
discriminator local 21
discriminator remote 22
min-tx-interval 100
min-rx-interval 100
commit
SW2的配置
#
sysname SW2
#
vlan batch 10 20
#stp mode mstp
#
stp region-configuration
region-name 123
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
stp instance 1 root secondary
stp instance 2 root primary#
interface Vlanif10
ip address 192.168.10.2 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 track bfd-session 2 increased 30
#
interface Vlanif20
ip address 192.168.20.2 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 120
vrrp vrid 20 track interface GigabitEthernet0/0/24 reduced 30
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/1
eth-trunk 1
#
interface GigabitEthernet0/0/2
eth-trunk 1
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20
#bfd
#
bfd 1 bind peer-ip 192.168.10.1 interface Vlanif10
discriminator local 2
discriminator remote 1
min-tx-interval 100
min-rx-interval 100
commit
#
bfd 2 bind peer-ip 192.168.20.1 interface Vlanif20
discriminator local 22
discriminator remote 21
min-tx-interval 100
min-rx-interval 100
commit
#
SW3配置
#
sysname SW3
#
vlan batch 10 20
#stp mode mstp
#
stp region-configuration
region-name 123
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20
#
SW1上查看VRRP状态、BFD状态、MSTP状态
SW2查看相关信息
SW3查看生成树信息