拓扑图
配置需求:
1.SW1、 SW2、 SW3、 SW4 运行 MSTP, SW1 为 instance 1 的主根、 为 instance 2 的备根; SW2 相反;
参数要求:region-name为huawei;
revision版本为1;
主根优先级为4096,从根优先级为8192;
2.SW1、 SW2 运行 VRRP, 正常情况下 VLAN10、 30 走 SW1, VLAN20、 40 走 SW2;
参数要求:
VLAN VRRP备份组号(VRID) VRRP虚拟IP
VLAN10 10 192.168.10.254
VLAN20 20 192.168.20.254
VLAN30 30 192.168.30.254
VLAN40 40 192.168.40.254
VRRP组中高优先级设置为150,低优先级设置为120。
3.SW1 上行链路故障时 VLAN10、 20、 30、 40 走 SW2, SW2 上行链路故障时 VLAN10、 20、 30、 40 走 SW1;
4.为确保安全性 VRRP 启用验证功能,验证密钥为明文 huawei;
5.SW3、 SW4 接入 PC 端口开启边缘端口, 上联开启环路保护功能;
6.为规避网络末端接入设备上出现环路影响全网,要求在总部接入设备S3、S4进行防环处理,终端接口开启BPDU防护不能接收BPDU 报文;
主要配置
从下往上进行配置
SW3
sysname SW3
vlan batch 10 20 30 40 (创建vlan)
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
stp loop-protection (环路保护)
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
stp loop-protection (环路保护)
#
interface Ethernet0/0/3
port link-type access
port default vlan 10
stp edged-port enable (开启边缘端口)
#
interface Ethernet0/0/4
port link-type access
port default vlan 20
stp edged-port enable (开启边缘端口)
#
interface Ethernet0/0/5
port link-type access
port default vlan 30
stp edged-port enable (开启边缘端口)
#
interface Ethernet0/0/6
port link-type access
port default vlan 40
stp edged-port enable (开启边缘端口)
#
stp region-configuration
region-name huawei
instance 1 vlan 10 30
instance 2 vlan 20 40
active region-configuration
#
stp bpdu-protection (BPDU防护)
SW4 交换机3和交换机4的配置一样
sysname SW4
vlan batch 10 20 30 40 (创建vlan)
interface Ethernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
stp loop-protection (环路保护)
#
interface Ethernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
stp loop-protection (环路保护)
#
interface Ethernet0/0/3
port link-type access
port default vlan 10
stp edged-port enable (开启边缘端口)
#
interface Ethernet0/0/4
port link-type access
port default vlan 20
stp edged-port enable (开启边缘端口)
#
interface Ethernet0/0/5
port link-type access
port default vlan 30
stp edged-port enable (开启边缘端口)
#
interface Ethernet0/0/6
port link-type access
port default vlan 40
stp edged-port enable (开启边缘端口)
#
stp region-configuration
region-name huawei
instance 1 vlan 10 30
instance 2 vlan 20 40
active region-configuration
#
stp bpdu-protection (BPDU防护)
SW1
sysname SW1
#
vlan batch 10 20 30 40
#
stp region-configuration
region-name huawei
instance 1 vlan 10 30
instance 2 vlan 20 40
active region-configuration
#
interface Vlanif1
#
interface Vlanif10
ip address 192.168.10.251 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 priority 200
vrrp vrid 10 track interface Vlanif1 reduced 150
vrrp vrid 10 authentication-mode simple huawei
#
interface Vlanif20
ip address 192.168.20.251 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 authentication-mode simple huawei
#
interface Vlanif30
ip address 192.168.30.251 255.255.255.0
vrrp vrid 30 virtual-ip 192.168.30.254
vrrp vrid 30 priority 200
vrrp vrid 30 track interface Vlanif1 reduced 150
vrrp vrid 30 authentication-mode simple huawei
#
interface Vlanif40
ip address 192.168.40.251 255.255.255.0
vrrp vrid 40 virtual-ip 192.168.40.254
vrrp vrid 40 authentication-mode simple huawei
##
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
stp instance 1 root primary (交换机1为实例1的根桥)
stp instance 2 root secondary
SW2 交换机1和交换机2的配置也是大同小异
sysname SW2
#
vlan batch 10 20 30 40
#
stp region-configuration
region-name huawei
instance 1 vlan 10 30
instance 2 vlan 20 40
active region-configuration
#
interface Vlanif1
#
interface Vlanif10
ip address 192.168.10.252 255.255.255.0
vrrp vrid 10 virtual-ip 192.168.10.254
vrrp vrid 10 authentication-mode simple huawei
#
interface Vlanif20
ip address 192.168.20.252 255.255.255.0
vrrp vrid 20 virtual-ip 192.168.20.254
vrrp vrid 20 priority 20
vrrp vrid 20 track interface Vlanif1 reduced 150
vrrp vrid 20 authentication-mode simple huawei
#
interface Vlanif30
ip address 192.168.30.252 255.255.255.0
vrrp vrid 30 virtual-ip 192.168.30.254
vrrp vrid 30 authentication-mode simple huawei
#
interface Vlanif40
ip address 192.168.40.252 255.255.255.0
vrrp vrid 40 virtual-ip 192.168.40.254
vrrp vrid 40 priority 200
vrrp vrid 40 track interface Vlanif1 reduced 150
vrrp vrid 40 authentication-mode simple huawei
#
interface Eth-Trunk1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#
stp instance 2 root primary (交换机2为实例2的根桥)
stp instance 1 root secondary