适用产品和版本
CE12800/CE6800/CE5800系列产品V100R001C00或更高版本,CE7800系列产品V100R003C00或更高版本,CE8800系列产品V100R006C00或更高版本,CE12800E系列产品V200R002C50或更高版本。
组网需求
在数据中心场景中,接入层交换机以双上行方式接入核心层。用户希望:
图2-37 配置MSTP+VRRP负载分担组网
需求分析
操作步骤
[~HUAWEI] sysname SwitchA [*HUAWEI] commit [~SwitchA] stp region-configuration [~SwitchA-mst-region] region-name RG1 [*SwitchA-mst-region] instance 1 vlan 2 [*SwitchA-mst-region] commit [~SwitchA-mst-region] quit # 配置SwitchB的MST域。 [~HUAWEI] sysname SwitchB [*HUAWEI] commit [~SwitchB] stp region-configuration [~SwitchB-mst-region] region-name RG1 [*SwitchB-mst-region] instance 1 vlan 2 [*SwitchB-mst-region] commit [~SwitchB-mst-region] quit # 配置SwitchC的MST域。 [~HUAWEI] sysname SwitchC [*HUAWEI] commit [~SwitchC] stp region-configuration [~SwitchC-mst-region] region-name RG1 [*SwitchC-mst-region] instance 1 vlan 2 [*SwitchC-mst-region] commit [~SwitchC-mst-region] quit 在域RG1内,配置MSTI1的根桥与备份根桥 配置MSTI1的根桥与备份根桥 # 配置SwitchA为MSTI1的根桥。 [~SwitchA] stp instance 1 root primary [*SwitchA] commit # 配置SwitchB为MSTI1的备份根桥。 [~SwitchB] stp instance 1 root secondary [*SwitchB] commit 配置实例MSTI1中将要被阻塞端口的路径开销值大于缺省值 说明: 端口路径开销值取值范围由路径开销计算方法决定,这里选择使用华为私有计算方法为例,配置实例MSTI1中将被阻塞端口的路径开销值为20000。 同一网络内所有交换设备的端口路径开销应使用相同的计算方法。 # 配置SwitchA的端口路径开销的计算方法为华为私有计算方法。 [~SwitchA] stp pathcost-standard legacy [*SwitchA] commit # 配置SwitchB的端口路径开销的计算方法为华为的私有计算方法。 [~SwitchB] stp pathcost-standard legacy [*SwitchB] commit # 配置SwitchC的端口路径开销的计算方法为华为的私有计算方法,将端口10GE1/0/4在实例MSTI1中的路径开销值配置为20000。 [~SwitchC] stp pathcost-standard legacy [*SwitchC] interface 10ge 1/0/4 [*SwitchC-10GE1/0/4] stp instance 1 cost 20000 [*SwitchC-10GE1/0/4] commit [~SwitchC-10GE1/0/4] quit 使能MSTP,实现破除环路 说明: 设备上MSTP功能默认使能。 设备全局使能MSTP # 在SwitchA上启动MSTP。 [~SwitchA] stp enable [*SwitchA] commit # 在SwitchB上启动MSTP。 [~SwitchB] stp enable [*SwitchB] commit # 在SwitchC上启动MSTP。 [~SwitchC] stp enable [*SwitchC] commit 将与Host相连的端口配置为边缘端口 # 配置SwitchC端口10GE1/0/2和10GE1/0/3为边缘端口。 [~SwitchC] interface 10ge 1/0/2 [~SwitchC-10GE1/0/2] stp edged-port enable [*SwitchC-10GE1/0/2] commit [~SwitchC-10GE1/0/2] quit [~SwitchC] interface 10ge 1/0/3 [~SwitchC-10GE1/0/3] stp edged-port enable [*SwitchC-10GE1/0/3] commit [~SwitchC-10GE1/0/3] quit 配置保护功能,如在各实例的根桥设备的指定端口配置根保护功能 # 在SwitchA端口10GE1/0/1上启动根保护。 [~SwitchA] interface 10ge 1/0/1 [~SwitchA-10GE1/0/1] stp root-protection [*SwitchA-10GE1/0/1] commit [~SwitchA-10GE1/0/1] quit 配置处于环网中的设备的二层转发功能 在交换设备SwitchA、SwitchB、SwitchC上创建VLAN2 # 在SwitchA上创建VLAN2。 [~SwitchA] vlan batch 2 # 在SwitchB上创建VLAN2。 [~SwitchB] vlan batch 2 # 在SwitchC上创建VLAN2。 [~SwitchC] vlan batch 2 将交换设备上接入环路中的端口加入VLAN # 将SwitchA端口10GE1/0/1加入VLAN。 [~SwitchA] interface 10ge 1/0/1 [~SwitchA-10GE1/0/1] port link-type trunk [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 2 [*SwitchA-10GE1/0/1] undo port trunk allow-pass vlan 1 [*SwitchA-10GE1/0/1] commit [~SwitchA-10GE1/0/1] quit # 将SwitchA端口10GE1/0/2加入VLAN。 [~SwitchA] interface 10ge 1/0/2 [~SwitchA-10GE1/0/2] port link-type trunk [*SwitchA-10GE1/0/2] port trunk allow-pass vlan 2 [*SwitchA-10GE1/0/2] undo port trunk allow-pass vlan 1 [*SwitchA-10GE1/0/2] commit [~SwitchA-10GE1/0/2] quit # 将SwitchB端口10GE1/0/1加入VLAN。 [~SwitchB] interface 10ge 1/0/1 [~SwitchB-10GE1/0/1] port link-type trunk [*SwitchB-10GE1/0/1] port trunk allow-pass vlan 2 [*SwitchB-10GE1/0/1] undo port trunk allow-pass vlan 1 [*SwitchB-10GE1/0/1] commit [~SwitchB-10GE1/0/1] quit # 将SwitchB端口10GE1/0/2加入VLAN。 [~SwitchB] interface 10ge 1/0/2 [~SwitchB-10GE1/0/2] port link-type trunk [*SwitchB-10GE1/0/2] port trunk allow-pass vlan 2 [*SwitchB-10GE1/0/2] undo port trunk allow-pass vlan 1 [*SwitchB-10GE1/0/2] commit [~SwitchB-10GE1/0/2] quit # 将SwitchC端口10GE1/0/1加入VLAN。 [~SwitchC] interface 10ge 1/0/1 [~SwitchC-10GE1/0/1] port link-type trunk [*SwitchC-10GE1/0/1] port trunk allow-pass vlan 2 [*SwitchC-10GE1/0/1] undo port trunk allow-pass vlan 1 [*SwitchC-10GE1/0/1] commit [~SwitchC-10GE1/0/1] quit # 将SwitchC端口10GE1/0/2加入VLAN。 [~SwitchC] interface 10ge 1/0/2 [~SwitchC-10GE1/0/2] port link-type access [*SwitchC-10GE1/0/2] port default vlan 2 [*SwitchC-10GE1/0/2] commit [~SwitchC-10GE1/0/2] quit # 将SwitchC端口10GE1/0/3加入VLAN。 [~SwitchC] interface 10ge 1/0/3 [~SwitchC-10GE1/0/3] port link-type access [*SwitchC-10GE1/0/3] port default vlan 2 [*SwitchC-10GE1/0/3] commit [~SwitchC-10GE1/0/3] quit # 将SwitchC端口10GE1/0/4加入VLAN。 [~SwitchC] interface 10ge 1/0/4 [~SwitchC-10GE1/0/4] port link-type trunk [*SwitchC-10GE1/0/4] port trunk allow-pass vlan 2 [*SwitchC-10GE1/0/4] commit [~SwitchC-10GE1/0/4] quit 配置设备间的网络互连 # 配置设备各接口的IP地址,以SwitchA为例。SwitchB的配置与之类似,详见配置文件。 [~SwitchA] vlan batch 4 [*SwitchA] interface 10ge 1/0/3 [*SwitchA-10GE1/0/3] port link-type trunk [*SwitchA-10GE1/0/3] port trunk allow-pass vlan 4 [*SwitchA-10GE1/0/3] undo port trunk allow-pass vlan 1 [*SwitchA-10GE1/0/3] quit [*SwitchA] interface vlanif 2 [*SwitchA-Vlanif2] ip address 10.1.2.102 24 [*SwitchA-Vlanif2] quit [*SwitchA] interface vlanif 4 [*SwitchA-Vlanif4] ip address 10.1.4.102 24 [*SwitchA-Vlanif4] quit [*SwitchA] commit # 配置SwitchA、SwitchB和路由器间采用OSPF协议进行互连。以SwitchA为例,SwitchB的配置与之类似,详见配置文件。 [~SwitchA] ospf 1 [*SwitchA-ospf-1] area 0 [*SwitchA-ospf-1-area-0.0.0.0] network 10.1.2.0 0.0.0.255 [*SwitchA-ospf-1-area-0.0.0.0] network 10.1.4.0 0.0.0.255 [*SwitchA-ospf-1-area-0.0.0.0] quit [*SwitchA-ospf-1] quit [*SwitchA] commit 配置VRRP备份组 # 在SwitchA和SwitchB上创建VRRP备份组1,配置SwitchA的优先级为120,抢占延时为20秒,作为Master设备;SwitchB的优先级为缺省值,作为Backup设备。 [~SwitchA] interface vlanif 2 [~SwitchA-Vlanif2] vrrp vrid 1 virtual-ip 10.1.2.100 [*SwitchA-Vlanif2] vrrp vrid 1 priority 120 [*SwitchA-Vlanif2] vrrp vrid 1 preempt-mode timer delay 20 [*SwitchA-Vlanif2] commit [~SwitchA-Vlanif2] quit [~SwitchB] interface vlanif 2 [~SwitchB-Vlanif2] vrrp vrid 1 virtual-ip 10.1.2.100 [*SwitchB-Vlanif2] commit [~SwitchB-Vlanif2] quit # 配置HostA和HostB的缺省网关为备份组1的虚拟IP地址10.1.2.100。 验证 完成上述配置后,在SwitchA上执行display vrrp命令,可以看到SwitchA在备份组1中作为Master设备。 Vlanif2 | Virtual Router 1 State : Master Virtual IP : 10.1.2.100 Master IP : 10.1.2.102 PriorityRun : 120 PriorityConfig : 120 MasterPriority : 120 Preempt : YES Delay Time : 20 s Remain : -- TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Create time : 2013-05-11 11:39:18 Last change time : 2013-05-26 11:38:58 在SwitchB上执行display vrrp命令,可以看到SwitchB在备份组1中作为Backup设备。 Vlanif2 | Virtual Router 1 State : Backup Virtual IP : 10.1.2.100 Master IP : 10.1.2.102 PriorityRun : 100 PriorityConfig : 100 MasterPriority : 120 Preempt : YES Delay Time : 0 s Remain : -- TimerRun : 1 s TimerConfig : 1 s Auth type : NONE Virtual MAC : 0000-5e00-0101 Check TTL : YES Config type : normal-vrrp Create time : 2012-05-11 11:39:18 Last change time : 2013-05-26 11:40:38 配置文件 SwitchA的配置文件 # sysname SwitchA # vlan batch 2 4 # stp instance 1 root primary stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 # interface Vlanif2 ip address 10.1.2.102 255.255.255.0 vrrp vrid 1 virtual-ip 10.1.2.100 vrrp vrid 1 priority 120 vrrp vrid 1 preempt-mode timer delay 20 # interface Vlanif4 ip address 10.1.4.102 255.255.255.0 # interface 10GE1/0/1 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 stp root-protection # interface 10GE1/0/2 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 # interface 10GE1/0/3 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 4 # ospf 1 area 0.0.0.0 network 10.1.2.0 0.0.0.255 network 10.1.4.0 0.0.0.255 # return SwitchB的配置文件 # sysname SwitchB # vlan batch 2 5 # stp instance 1 root secondary stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 # interface Vlanif2 ip address 10.1.2.103 255.255.255.0 vrrp vrid 1 virtual-ip 10.1.2.100 # interface Vlanif5 ip address 10.1.5.103 255.255.255.0 # interface 10GE1/0/1 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 stp root-protection # interface 10GE1/0/2 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 # interface 10GE1/0/3 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 5 # ospf 1 area 0.0.0.0 network 10.1.2.0 0.0.0.255 network 10.1.5.0 0.0.0.255 # return SwitchC的配置文件 # sysname SwitchC # vlan batch 2 # stp pathcost-standard legacy # stp region-configuration region-name RG1 instance 1 vlan 2 # interface 10GE1/0/1 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 # interface 10GE1/0/2 port link-type access port default vlan 2 stp edged-port enable # interface 10GE1/0/3 port link-type access port default vlan 2 stp edged-port enable # interface 10GE1/0/4 port link-type trunk undo port trunk allow-pass vlan 1 port trunk allow-pass vlan 2 stp instance 1 cost 20000 # return
联系客服