配置VBST功能示例
组网需求
某企业网如图11-5所示,接入交换机SwitchC和SwitchD分别双归接入到汇聚交换机SwitchA和SwitchB。SwitchC接入VLAN 10、20的业务流量,SwitchD接入VLAN 20、30的业务流量。由于双归接入,在接入层和汇聚层之间形成环形网络。企业希望各VLAN内的业务流量正常转发,同时希望不同VLAN内的业务流量能够在链路上负载分担,以提高链路利用率。
配置思路
可通过部署VBST避免接入层与汇聚层间的环路,使各VLAN内的业务流量正常转发,同时,使不同VLAN内的业务流量能够在链路上负载分担。配置思路如下:
- 配置接入交换机和汇聚交换机的二层转发功能。
在处于环形网络中的交换机(SwitchA~SwitchD)上配置VBST基本功能。为使VBST计算产生如图11-5中所示的VLAN生成树。配置时:
- 将VLAN 10的根桥设置为SwitchA,备份根桥设置为SwitchB;将VLAN20的根桥设置为SwitchA,备份根桥设置为SwitchB;将VLAN30的根桥设置为SwitchB,备份根桥设置为SwitchA,确保根桥设备的可靠性。
- 将SwitchC的端口10GE1/0/2在VLAN10、VLAN20中设置较大的路径开销值,使其分别在VLAN 10、20的生成树中阻塞;将SwitchD的端口10GE1/0/2在VLAN20、VLAN30中设置较大的路径开销值,使其分别在VLAN20、VLAN30的生成树中阻塞。
操作步骤
- 配置处于环网中的设备的二层转发功能。
在交换设备SwitchA、SwitchB、SwitchC和SwitchD上创建VLAN10、VLAN20和VLAN30。
# 在SwitchA上创建VLAN10、VLAN20和VLAN30。
<HUAWEI> system-view [~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] vlan batch 10 20 30 [*SwitchA] commit
# 在SwitchB上创建VLAN10、VLAN20和VLAN30。
<HUAWEI> system-view [~HUAWEI] sysname SwitchB [*HUAWEI] commit [~SwitchB] vlan batch 10 20 30 [*SwitchB] commit
# 在SwitchC上创建VLAN10和VLAN20。
<HUAWEI> system-view [~HUAWEI] sysname SwitchC [*HUAWEI] commit [~SwitchC] vlan batch 10 20 [*SwitchC] commit
# 在SwitchD上创建VLAN20和VLAN30。
<HUAWEI> system-view [~HUAWEI] sysname SwitchD [*HUAWEI] commit [~SwitchD] vlan batch 20 30 [*SwitchD] commit
将交换机上接入环路中的端口加入VLAN。
# 将SwitchA端口10GE1/0/1加入VLAN10、VLAN20和VLAN30。
[~SwitchA] interface 10ge 1/0/1 [~SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 10 20 30 [~SwitchA-10GE1/0/1] undo port trunk allow-pass vlan 1 [*SwitchA-10GE1/0/1] quit [*SwitchA] commit
# 将SwitchA端口10GE1/0/2加入VLAN20和VLAN30。
[~SwitchA] interface 10ge 1/0/2 [~SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan 20 30 [*SwitchA-10GE1/0/2] undo port trunk allow-pass vlan 1 [*SwitchA-10GE1/0/2] quit [*SwitchA] commit
# 将SwitchA端口10GE1/0/3加入VLAN10和VLAN20。
[~SwitchA] interface 10ge 1/0/3 [~SwitchA-10GE1/0/3] port link-type trunk [*SwitchA-10GE1/0/3] port trunk allow-pass vlan 10 20 [*SwitchA-10GE1/0/3] undo port trunk allow-pass vlan 1 [*SwitchA-10GE1/0/3] quit [*SwitchA] commit
# 将SwitchB端口10GE1/0/1加入VLAN10、VLAN20和VLAN30。
[~SwitchB] interface 10ge 1/0/1 [~SwitchB-10GE1/0/1] port link-type trunk [*SwitchB-10GE1/0/1] port trunk allow-pass vlan 10 20 30 [*SwitchB-10GE1/0/1] undo port trunk allow-pass vlan 1 [*SwitchB-10GE1/0/1] quit [*SwitchB] commit
# 将SwitchB端口10GE1/0/2加入VLAN10和VLAN20。
[~SwitchB] interface 10ge 1/0/2 [~SwitchB-10GE1/0/2] port link-type trunk [*SwitchB-10GE1/0/2] port trunk allow-pass vlan 10 20 [*SwitchB-10GE1/0/2] undo port trunk allow-pass vlan 1 [*SwitchB-10GE1/0/2] quit [*SwitchB] commit
# 将SwitchB端口10GE1/0/3加入VLAN20和VLAN30。
[~SwitchB] interface 10ge 1/0/3 [~SwitchB-10GE1/0/3] port link-type trunk [*SwitchB-10GE1/0/3] port trunk allow-pass vlan 20 30 [*SwitchB-10GE1/0/3] undo port trunk allow-pass vlan 1 [*SwitchB-10GE1/0/3] quit [*SwitchB] commit
# 将SwitchC端口10GE1/0/2加入VLAN10和VLAN20。
[~SwitchC] interface 10ge 1/0/2 [~SwitchC-10GE1/0/2] port link-type trunk [*SwitchC-10GE1/0/2] port trunk allow-pass vlan 10 20 [*SwitchC-10GE1/0/2] undo port trunk allow-pass vlan 1 [*SwitchC-10GE1/0/2] quit [*SwitchC] commit
# 将SwitchC端口10GE1/0/3加入VLAN10和VLAN20。
[~SwitchC] interface 10ge 1/0/3 [~SwitchC-10GE1/0/3] port link-type trunk [*SwitchC-10GE1/0/3] port trunk allow-pass vlan 10 20 [*SwitchC-10GE1/0/3] undo port trunk allow-pass vlan 1 [*SwitchC-10GE1/0/3] quit [*SwitchC] commit
# 将SwitchC端口10GE1/0/4加入VLAN10,10GE1/0/5加入VLAN20。
[~SwitchC] interface 10ge 1/0/4 [~SwitchC-10GE1/0/4] port link-type access [*SwitchC-10GE1/0/4] port default vlan 10 [*SwitchC-10GE1/0/4] quit [*SwitchC] interface 10ge 1/0/5 [*SwitchC-10GE1/0/5] port link-type access [*SwitchC-10GE1/0/5] port default vlan 20 [*SwitchC-10GE1/0/5] quit [*SwitchC] commit
# 将SwitchD端口10GE1/0/2加入VLAN20和VLAN30。
[~SwitchD] interface 10ge 1/0/2 [~SwitchD-10GE1/0/2] port link-type trunk [*SwitchD-10GE1/0/2] port trunk allow-pass vlan 20 30 [*SwitchD-10GE1/0/2] undo port trunk allow-pass vlan 1 [*SwitchD-10GE1/0/2] quit [*SwitchD] commit
# 将SwitchD端口10GE1/0/3加入VLAN20和VLAN30。
[~SwitchD] interface 10ge 1/0/3 [~SwitchD-10GE1/0/3] port link-type trunk [*SwitchD-10GE1/0/3] port trunk allow-pass vlan 20 30 [*SwitchD-10GE1/0/3] undo port trunk allow-pass vlan 1 [*SwitchD-10GE1/0/3] quit [*SwitchD] commit
# 将SwitchD端口10GE1/0/4加入VLAN20,10GE1/0/5加入VLAN30。
[~SwitchD] interface 10ge 1/0/4 [~SwitchD-10GE1/0/4] port link-type access [*SwitchD-10GE1/0/4] port default vlan 20 [*SwitchD-10GE1/0/4] quit [*SwitchD] interface 10ge 1/0/5 [*SwitchD-10GE1/0/5] port link-type access [*SwitchD-10GE1/0/5] port default vlan 30 [*SwitchD-10GE1/0/5] quit [*SwitchD] commit
- 配置VBST基本功能。
配置环网中的交换机的生成树协议工作在VBST模式。
# 配置SwitchA的工作模式为VBST。
[~SwitchA] stp mode vbst [*SwitchA] commit
# 配置交换机SwitchB的工作模式为VBST。
[~SwitchB] stp mode vbst [*SwitchB] commit
# 配置交换机SwitchC的工作模式为VBST。
[~SwitchC] stp mode vbst [*SwitchC] commit
# 配置交换机SwitchD的工作模式为VBST。
[~SwitchD] stp mode vbst [*SwitchD] commit
配置根桥和备份根桥设备。
配置VLAN10的根桥和备份根桥。
# 配置SwitchA为VLAN10的根桥。
[~SwitchA] stp vlan 10 root primary [*SwitchA] commit
# 配置SwitchB为VLAN10的备份根桥。
[~SwitchB] stp vlan 10 root secondary [*SwitchB] commit
配置VLAN20的根桥和备份根桥。
# 配置SwitchA为VLAN20的根桥。
[~SwitchA] stp vlan 20 root primary [*SwitchA] commit
# 配置SwitchB为VLAN20的备份根桥。
[~SwitchB] stp vlan 20 root secondary [*SwitchB] commit
配置VLAN30的根桥和备份根桥。
# 配置SwitchB为VLAN30的根桥。
[~SwitchB] stp vlan 30 root primary [*SwitchB] commit
# 配置SwitchA为VLAN30的备份根桥。
[~SwitchA] stp vlan 30 root secondary [*SwitchA] commit
配置各VLAN中端口的路径开销值,实现将该端口阻塞
端口路径开销值取值范围由路径开销计算方法决定,本例选择使用缺省的IEEE 802.1t计算方法,配置将被阻塞端口的路径开销值为2000000。
同一网络内所有交换机的端口路径开销应使用相同的计算方法。
# 将SwitchC上的端口10GE1/0/2在VLAN10中的路径开销值配置为2000000,在VLAN20中的路径开销值配置为2000000。
[~SwitchC] interface 10ge 1/0/2 [~SwitchC-10GE1/0/2] stp vlan 10 cost 2000000 [*SwitchC-10GE1/0/2] stp vlan 20 cost 2000000 [*SwitchC-10GE1/0/2] quit [*SwitchC] commit
# 将SwitchD上的端口10GE1/0/2在VLAN20中的路径开销值配置为2000000,在VLAN30中的路径开销值配置为2000000。
[~SwitchD] interface 10ge 1/0/2 [~SwitchD-10GE1/0/2] stp vlan 20 cost 2000000 [*SwitchD-10GE1/0/2] stp vlan 30 cost 2000000 [*SwitchD-10GE1/0/2] quit [*SwitchD] commit
使能VBST,实现破除环路。
全局使能VBST功能。
缺省情况下,全局VBST功能已使能。
为确保全局VBST使能,可执行命令display stp vlan information查看VBST的使能状态。如果未使能,请在系统视图执行命令undo stp vlan disable全局使能VBST功能。
VLAN使能VBST功能。
缺省情况下,VLAN上的VBST功能处于使能状态。
为确保VLAN的VBST功能使能,可执行命令display stp vlan vlan-id information查看VLAN上的VBST状态。如果提示该VLAN上VBST功能未使能,请在系统视图执行命令undo stp vlan vlan-id disable使能该VLAN的VBST功能。
- 验证配置结果。
经过以上配置,在网络计算稳定后,执行以下操作,验证配置结果。
# 在SwitchA上执行display stp vlan bridge local命令,查看STP工作模式,结果如下:
[~SwitchA] display stp vlan bridge local ------------------------------------------------------------------ VLANID BridgeID HelloTime MaxAge ForwardDelay Protocol ------------------------------------------------------------------ 10 32869.ac94-8400-df01 2 20 15 VBST 20 32970.ac94-8400-df01 2 20 15 VBST 30 33071.ac94-8400-df01 2 20 15 VBST ------------------------------------------------------------------
由上述显示信息可以看出,STP工作在VBST模式。
# 在SwitchA上执行display stp vlan information brief命令,查看端口状态,结果如下:
[~SwitchA] display stp vlan information brief -------------------------------------------------------------------------------- VLANID Interface Role STPState Protection Cost Edged -------------------------------------------------------------------------------- 10 10GE1/0/1 DESI forwarding none 20000 disable 10 10GE1/0/3 DESI forwarding none 2000 disable 20 10GE1/0/1 DESI forwarding none 20000 disable 20 10GE1/0/2 DESI forwarding none 2000 disable 20 10GE1/0/3 DESI forwarding none 2000 disable 30 10GE1/0/1 ALTE discarding none 20000 disable 30 10GE1/0/2 ROOT forwarding none 2000 disable --------------------------------------------------------------------------------
由上述显示信息可以看出,SwitchA分别参加VLAN10、VLAN20和VLAN30的生成树计算。例如,SwitchA在VLAN10和VLAN20中都是根桥,所以在VLAN10中10GE1/0/1和10GE1/0/3都被选举为指定端口;在VLAN20中10GE1/0/1、10GE1/0/2和10GE1/0/3都被选举为指定端口。SwitchA在VLAN30中是备份根桥,所以VLAN30中10GE1/0/1被选举为指定端口,10GE1/0/2被选举为根端口。
# 在SwitchA上执行display stp vlan 10 information命令,查看VLAN10的详细信息,结果如下:
[~SwitchA] display stp vlan 10 information VLAN 10 information: -------------------------------------------------------------------------------- Global information: Protocol Status : Enabled Bpdu-filter Default : Disabled Bpdu-protection : Disabled Tc-protection : Disabled Tc-protection Threshold : 1 Tc-protection Interval(s) : 10 Edged Port Default : Disabled Path Cost Standard : Dot1T Timer Factor : 3 Transit Limit : 6 Bridge ID : 10.ac94-8400-df01 Config Times : Hello 2s MaxAge 20s FwDly 15s MaxHop 20 Active Times : Hello 2s MaxAge 20s FwDly 15s MaxHop 20 Root ID/RPC : 10.ac94-8400-df01 / 0 RootPortId(InterfaceName) : 0.0 (This bridge is the root) Root Type : Primary Port information: Port ID : 5 Interface : 10GE1/0/1 STP State : Forwarding Port Role : Designated Port Port Priority : 128 Path Cost Standard : Dot1T Port Cost(Config/Active) : 0 / 20000 Desg. Bridge/Port : 10.ac94-8400-df01 / 128.5 Port Edged(Config/Active) : Default / Disabled Point-to-point(Config/Active) : Auto / True Transit Limit : 6 packets/hello Protection Type : None Port ID : 8 Interface : 10GE1/0/3 STP State : Forwarding Port Role : Designated Port Port Priority : 128 Path Cost Standard : Dot1T Port Cost(Config/Active) : 0 / 2000 Desg. Bridge/Port : 10.ac94-8400-df01 / 128.8 Port Edged(Config/Active) : Default / Disabled Point-to-point(Config/Active) : Auto / True Transit Limit : 6 packets/hello Protection Type : None --------------------------------------------------------------------------------
由上述显示信息可以看出,在VLAN10中,SwitchA被选举为根桥,两个端口10GE1/0/1和10GE1/0/3都被选举为指定端口,且处于FORWARDING状态。
# 同理,在SwitchB、SwitchC和SwitchD上分别执行display stp vlan information brief命令,查看端口状态,结果如下:
[~SwitchB] display stp vlan information brief ------------------------------------------------------------------------------ VLANID Interface Role STPState Protection Cost Edged ------------------------------------------------------------------------------ 10 10GE1/0/1 ALTE discarding none 20000 disable 10 10GE1/0/2 ROOT forwarding none 2000 disable 20 10GE1/0/1 ALTE discarding none 20000 disable 20 10GE1/0/2 ROOT forwarding none 2000 disable 20 10GE1/0/3 DESI forwarding none 2000 disable 30 10GE1/0/1 DESI forwarding none 20000 disable 30 10GE1/0/3 DESI forwarding none 2000 disable ------------------------------------------------------------------------------
[~SwitchC] display stp vlan information brief ------------------------------------------------------------------------------ VLANID Interface Role STPState Protection Cost Edged ------------------------------------------------------------------------------ 10 10GE1/0/2 ROOT forwarding none 2000 disable 10 10GE1/0/3 DESI forwarding none 2000000 disable 10 10GE1/0/4 DESI forwarding none 2000 disable 20 10GE1/0/2 ROOT forwarding none 2000 disable 20 10GE1/0/3 DESI forwarding none 2000000 disable 20 10GE1/0/5 DESI forwarding none 2000 disable ------------------------------------------------------------------------------
[~SwitchD] display stp vlan information brief ------------------------------------------------------------------------------ VLANID Interface Role STPState Protection Cost Edged ------------------------------------------------------------------------------ 20 10GE1/0/2 ALTE discarding none 2000000 disable 20 10GE1/0/3 ROOT forwarding none 2000 disable 20 10GE1/0/4 DESI forwarding none 2000 disable 30 10GE1/0/2 DESI forwarding none 2000000 disable 30 10GE1/0/3 ROOT forwarding none 2000 disable 30 10GE1/0/5 DESI forwarding none 2000 disable ------------------------------------------------------------------------------
由上述显示信息可以看出,SwitchB参与VLAN10、VLAN20和VLAN30的生成树计算,SwitchC参与VLAN10、VLAN20的生成树计算,SwitchD参与VLAN20、VLAN30的生成树计算,计算完成后,各端口分别选举为不同的角色,实现破除环路。
可见,VLAN 10、VLAN 20和VLAN 30分别形成不同的生成树,VLAN 10、VLAN 20、VLAN 30内的业务流量将沿各自的生成树转发,实现负载分担。
配置文件
SwitchA的配置文件
# sysname SwitchA # stp vlan 30 root secondary stp vlan 10 20 root primary # vlan batch 10 20 30 # stp mode vbst # interface 10GE1/0/1 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 10 20 30 # interface 10GE1/0/2 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 20 30 # interface 10GE1/0/3 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 10 20 # return
SwitchB的配置文件
# sysname SwitchB # stp vlan 10 20 root secondary stp vlan 30 root primary # vlan batch 10 20 30 # stp mode vbst # interface 10GE1/0/1 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 10 20 30 # interface 10GE1/0/2 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 10 20 # interface 10GE1/0/3 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 20 30 # return
SwitchC的配置文件
# sysname SwitchC # vlan batch 10 20 # stp mode vbst # interface 10GE1/0/2 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 10 20 stp vlan 10 20 cost 2000000 # interface 10GE1/0/3 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 10 20 # interface 10GE1/0/4 port default vlan 10 # interface 10GE1/0/5 port default vlan 20 # return
SwitchD的配置文件
# sysname SwitchD # vlan batch 20 30 # stp mode vbst # interface 10GE1/0/2 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 20 30 stp vlan 20 30 cost 2000000 # interface 10GE1/0/3 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 20 30 # interface 10GE1/0/4 port default vlan 20 # interface 10GE1/0/5 port default vlan 30 # return