343、实验:vrrp + MSTP实现冗余
实验topo:
实验步骤:
vlan10 配置vrrp,并将SW1作为主链路;
SW1:
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
vlan batch 10 20
#
#
interface Vlanif1
#
interface Vlanif10
ip address 192.168.1.254 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.1
vrrp vrid 1 priority 105
#
SW2:
#
interface Vlanif1
#
interface Vlanif10
ip address 192.168.1.253 255.255.255.0
vrrp vrid 1 virtual-ip 192.168.1.1
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
查看vrrp 状态:
vlan 20 配置vrrp,并将SW2 作为主链路:
SW1:
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.1
#
SW2:
#
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
vrrp vrid 2 virtual-ip 192.168.20.1
vrrp vrid 2 priority 105
#
查看vrrp状态:
此时如果不做MSTP,就会出现有一个端口被阻塞,就不能实现vrrp;
为了让核心交换机的下联口故障时候,可以让vrrp主动切换至备核心:
SW1:
#
vrrp vrid 1 track interface GigabitEthernet0/0/1
#
SW2:
#
vrrp vrid 1 track interface GigabitEthernet0/0/1
#
tips:如果不设置跟踪接口状态,那么vrpp 就不会知道链路已经故障,还是走最优路径;
tips :如图topo,由于局域网产生环路,所以启动stp之后会产生一个阻塞端口,SW2的G0/0/1为阻塞端口,当vlan 20 的PC与网关通信时,由于最短 路径阻塞只能走备链路;vrrp就没有实际意义;
因此,需要配合MSTP使用;
MSTP配置:
SW1:
#
stp region-configuration
region-name vrrpmstp
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
SW2:
#
stp region-configuration
region-name vrrpmstp
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
SW3:
#
stp region-configuration
region-name vrrpmstp
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
设置实例1 的根桥为SW1,备桥为SW2:
SW1
#
stp instance 1 root primary
#
SW2 :
#
stp instance 1 root secondary
#
设置实例2的根桥为SW2,备桥为SW1:
SW1:
#
stp instance 2 root secondary
#
SW2:
#
stp instance 2 root primary
#
查看实例1 的跟端口:
tips:此时 SW3的g/0/2口为阻塞端口
查看实例2 的跟端口:
tips:此时对于实例2 SW3的G0/0/1口为阻塞端口
查看如果主链路故障,是否会切换链路
tips:主链路故障之后,需要一定的收敛时间才会切换至备份链路;