拓扑图
要求:
- PC1划分在vlan10;PC2划分在vlan20;主机IP和网关如图所示,这里不做展示
- LSW1配置vlan10的根交换机,vlan20的备根交换机;LSW2配置vlan20的根交换机,vlan10的备根交换机
- LSW1配置vlan10的VRRP作为vlan10 的网关;LSW2配置vlan20的VRRP作为vlan20的网关
LSW1配置vlan
vlan batch 10 20
#
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
LSW2配置vlan
vlan batch 10 20
#
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
LSW3配置vlan
vlan batch 10 20
#
interface Ethernet0/0/1
port link-type access
port default vlan 10
#
interface Ethernet0/0/2
port link-type access
port default vlan 20
#
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
下面开始配置MSTP
LSW1配置MSTP
stp mode mstp
#
stp region-configuration
region-name re-mstp
revision-level 1
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
stp instance 1 root primary
stp instance 2 root secondary
LSW2配置MSTP
stp mode mstp
#
stp region-configuration
region-name re-mstp
revision-level 1
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
#
stp instance 1 root secondary
stp instance 2 root primary
LSW3配置MSTP
stp mode mstp
#
stp region-configuration
region-name re-mstp
revision-level 1
instance 1 vlan 10
instance 2 vlan 20
active region-configuration
下面开始配置VRRP
LSW1配置VRRP
interface Vlanif10
ip address 192.168.10.253 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.1
vrrp vrid 10 priority 120
vrrp vrid 10 preempt-mode timer delay 30
#
interface Vlanif20
ip address 192.168.20.253 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.1
vrrp vrid 20 priority 100 # 设置优先级100(默认值是100,也可以不设置)
LSW2配置VRRP
interface Vlanif10
ip address 192.168.10.254 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.1
vrrp vrid 10 priority 100 # 设置优先级100(默认值是100,也可以不设置)
#
interface Vlanif20
ip address 192.168.20.254 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.1
vrrp vrid 20 priority 120
vrrp vrid 20 preempt-mode timer delay 30
至此MSTP与VRRP配置完成,下面测试PC1 ping PC2