18

企业网络拓扑MSTP功能实例(二)

 3 years ago
source link: http://www.cnblogs.com/zhangwencheng/p/13992643.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

组网图形

qUnUFjv.png!mobile

MSTP简介

  • 以太网交换网络中为了进行链路备份,提高网络可靠性,通常会使用冗余链路。但是使用冗余链路会在交换网络上产生环路,引发广播风暴以及MAC地址表不稳定等故障现象,从而导致用户通信质量较差,甚至通信中断。为解决交换网络中的环路问题,提出了生成树协议STP(Spanning Tree Protocol)。STP(Spanning Tree Protocol)是用来解决网络中环路问题的协议。运行该协议的设备通过彼此交互信息而发现网络中的环路,并对某些端口进行阻塞以消除环路。
  • 与众多协议的发展过程一样,生成树协议也是随着网络的发展而不断更新的,从最初的IEEE 802.1D中定义的STP到IEEE 802.1W中定义的快速生成树协议RSTP(Rapid Spanning Tree Protocol),再到最新的IEEE 802.1S中定义的多生成树协议MSTP(Multiple Spanning Tree Protocol)。
  • 生成树协议中,MSTP兼容RSTP、STP,RSTP兼容STP。三种生成树协议的比较如表1所示。
表1 三种生成树协议的比较

生成树协议

特点

应用场景

STP

  • 形成一棵无环路的树,解决广播风暴并实现冗余备份。

  • 收敛速度较慢。

无需区分用户或业务流量,所有VLAN共享一棵生成树。

RSTP(详情见实例)

  • 形成一棵无环路的树,解决广播风暴并实现冗余备份。
  • 收敛速度快。

MSTP

  • 形成多棵无环路的树,解决广播风暴并实现冗余备份。
  • 收敛速度快。
  • 多棵生成树在VLAN间实现负载均衡,不同VLAN的流量按照不同的路径转发。

需要区分用户或业务流量,并实现负载分担。不同的VLAN通过不同的生成树转发流量,每棵生成树之间相互独立。

组网需求

  • 在一个复杂的网络中,由于冗余备份的需要,网络规划者一般都倾向于在设备之间部署多条物理链路,其中一条作为主用链路,其他作为备份链路。这样就难免会形成环路,若网络中存在环路,可能会引起广播风暴和MAC表项被破坏。为此,可以在网络中部署MSTP协议预防环路。MSTP可阻塞二层网络中的冗余链路,将网络修剪成树状,达到消除环路的目的。
  • 如图1所示,SwitchA、SwitchB、SwitchC和SwitchD都运行MSTP。为实现VLAN2~VLAN10和VLAN11~VLAN20的流量负载分担,MSTP引入了多实例。MSTP可设置VLAN映射表,把VLAN和生成树实例相关联。

配置思路

  • 在处于环形网络中的交换设备上配置MSTP基本功能。
  • 配置保护功能,实现对设备或链路的保护。例如:在各实例的根桥设备指定端口配置根保护功能。
  • 配置设备的二层转发功能。
说明: 

设备配置根保护功能后,如果根桥和备份根桥之间的链路down了,则配置根保护的端口状态会因为根保护功能生效直接变成discarding状态。

为了提高可靠性,建议根桥和备份根桥之间的链路绑定Eth-Trunk。

操作步骤

  • 配置MSTP基本功能

a.配置SwitchA、SwitchB、SwitchC和SwitchD到域名为RG1的域内,创建实例MSTI1和实例MSTI2

# 配置实例1的根桥SwitchA的MST域。

1 <HUAWEI> system-view
2 [HUAWEI] sysname SwitchA
3 [SwitchA] stp region-configuration
4 [SwitchA-mst-region] region-name RG1 //配置域名为RG1。
5 [SwitchA-mst-region] instance 1 vlan 2 to 10 //将VLAN 2至VLAN 10映射到实例1上。
6 [SwitchA-mst-region] instance 2 vlan 11 to 20 //将VLAN 11至VLAN 20映射到实例2上。
7 [SwitchA-mst-region] active region-configuration //激活MST域的配置。
8 [SwitchA-mst-region] quit

# 配置实例2的根桥SwitchB的MST域。

1 <HUAWEI> system-view
2 [HUAWEI] sysname SwitchB
3 [SwitchB] stp region-configuration
4 [SwitchB-mst-region] region-name RG1 //配置域名为RG1。
5 [SwitchB-mst-region] instance 1 vlan 2 to 10 //将VLAN 2至VLAN 10映射到实例1上。
6 [SwitchB-mst-region] instance 2 vlan 11 to 20 //将VLAN 11至VLAN 20映射到实例2上。
7 [SwitchB-mst-region] active region-configuration //激活MST域的配置。
8 [SwitchB-mst-region] quit

# 配置接入交换机SwitchC的MST域。

1 <HUAWEI> system-view
2 [HUAWEI] sysname SwitchC
3 [SwitchC] stp region-configuration
4 [SwitchC-mst-region] region-name RG1 //配置域名为RG1。
5 [SwitchC-mst-region] instance 1 vlan 2 to 10 //将VLAN 2至VLAN 10映射到实例1上。
6 [SwitchC-mst-region] instance 2 vlan 11 to 20 //将VLAN 11至VLAN 20映射到实例2上。
7 [SwitchC-mst-region] active region-configuration //激活MST域的配置。
8 [SwitchC-mst-region] quit

# 配置接入交换机SwitchD的MST域。

1 <HUAWEI> system-view
2 [HUAWEI] sysname SwitchD
3 [SwitchD] stp region-configuration
4 [SwitchD-mst-region] region-name RG1 //配置域名为RG1。
5 [SwitchD-mst-region] instance 1 vlan 2 to 10 //将VLAN 2至VLAN 10映射到实例1上。
6 [SwitchD-mst-region] instance 2 vlan 11 to 20 //将VLAN 11至VLAN 20映射到实例2上。
7 [SwitchD-mst-region] active region-configuration //激活MST域的配置。
8 [SwitchD-mst-region] quit

b.在域RG1内,配置MSTI1与MSTI2的根桥与备份根桥

配置MSTI1的根桥与备份根桥

# 配置SwitchA为MSTI1的根桥。

1 [SwitchA] stp instance 1 root primary

# 配置SwitchB为MSTI1的备份根桥。

1 [SwitchB] stp instance 1 root secondary

配置MSTI2的根桥与备份根桥

# 配置SwitchB为MSTI2的根桥。

1 [SwitchB] stp instance 2 root primary

# 配置SwitchA为MSTI2的备份根桥。

1 [SwitchA] stp instance 2 root secondary

c.配置实例MSTI1和MSTI2中将要被阻塞端口的路径开销值大于缺省值

说明: 

•端口路径开销值取值范围由路径开销计算方法决定,这里选择使用华为计算方法为例,配置实例MSTI1和MSTI2中将被阻塞端口的路径开销值为20000。

•同一网络内所有交换设备的端口路径开销应使用相同的计算方法。

# 配置实例1的根桥SwitchA的端口路径开销。

1 [SwitchA] stp pathcost-standard legacy

# 配置实例2的根桥SwitchB的端口路径开销。

1 [SwitchB] stp pathcost-standard legacy

# 配置接入交换机SwitchC的端口路径开销,将端口 GE0/0/2在实例MSTI2中的路径开销值配置为20000。

1 [SwitchC] stp pathcost-standard legacy
2 [SwitchC] interface gigabitethernet 0/0/2
3 [SwitchC-GigabitEthernet0/0/2] stp instance 2 cost 20000
4 [SwitchC-GigabitEthernet0/0/2] quit

# 配置接入交换机SwitchD的端口路径开销,将端口 GE0/0/2在实例MSTI1中的路径开销值配置为20000。

1 [SwitchD] stp pathcost-standard legacy
2 [SwitchD] interface gigabitethernet 0/0/2
3 [SwitchD-GigabitEthernet0/0/2] stp instance 1 cost 20000
4 [SwitchD-GigabitEthernet0/0/2] quit

d.使能MSTP,实现破除环路

设备全局使能MSTP

# 在SwitchA/B/C/D上启动MSTP。

1 [SwitchA] stp enable
2 
3 [SwitchB] stp enable
4 
5 [SwitchC] stp enable
6 
7 [SwitchD] stp enable

将与终端相连的端口设置为边缘端口并使能端口的BPDU报文过滤功能

# 配置SwitchC端口 GE0/0/1设置为边缘端口并使能端口的BPDU报文过滤功能。

1 [SwitchC] interface gigabitethernet 0/0/1
2 [SwitchC-GigabitEthernet0/0/1] stp edged-port enable
3 [SwitchC-GigabitEthernet0/0/1] stp bpdu-filter enable
4 [SwitchC-GigabitEthernet0/0/1] quit

# 配置SwitchD端口 GE0/0/1设置为边缘端口并使能端口的BPDU报文过滤功能。

1 [SwitchD] interface gigabitethernet 0/0/1
2 [SwitchD-GigabitEthernet0/0/1] stp edged-port enable
3 [SwitchD-GigabitEthernet0/0/1] stp bpdu-filter enable
4 [SwitchD-GigabitEthernet0/0/1] quit
  • 配置保护功能,如在各实例的根桥设备的指定端口配置根保护功能

# 在实例1根桥SwitchA端口 GE0/0/1上启动根保护。

1 [SwitchA] interface gigabitethernet 0/0/1
2 [SwitchA-GigabitEthernet0/0/1] stp root-protection
3 [SwitchA-GigabitEthernet0/0/1] quit

# 在实例2根桥SwitchB端口 GE0/0/1上启动根保护。

1 [SwitchB] interface gigabitethernet 0/0/1
2 [SwitchB-GigabitEthernet0/0/1] stp root-protection
3 [SwitchB-GigabitEthernet0/0/1] quit
  • 配置处于环网中的设备的二层转发功能

在交换设备SwitchA、SwitchB、SwitchC和SwitchD上创建VLAN2~20

1 [SwitchA] vlan batch 2 to 20
2 
3 [SwitchB] vlan batch 2 to 20
4 
5 [SwitchC] vlan batch 2 to 20
6 
7 [SwitchD] vlan batch 2 to 20

将交换设备上接入环路中的端口加入VLAN

# 将实例1的根桥SwitchA端口 GE0/0/1加入VLAN。

1 [SwitchA] interface gigabitethernet 0/0/1
2 [SwitchA-GigabitEthernet0/0/1] port link-type trunk
3 [SwitchA-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 20
4 [SwitchA-GigabitEthernet0/0/1] quit

# 将实例1的根桥SwitchA端口Eth-Trunk1加入VLAN。

1 [SwitchA] interface Eth-Trunk 1
2 [SwitchA-Eth-Trunk1] trunkport gigabitethernet 0/0/2
3 [SwitchA-Eth-Trunk1] trunkport gigabitethernet 0/0/3
4 [SwitchA-Eth-Trunk1] port link-type trunk
5 [SwitchA-Eth-Trunk1] port trunk allow-pass vlan 2 to 20
6 [SwitchA-Eth-Trunk1] quit

# 将实例2的根桥SwitchB端口 GE0/0/1加入VLAN。

1 [SwitchB] interface gigabitethernet 0/0/1
2 [SwitchB-GigabitEthernet0/0/1] port link-type trunk
3 [SwitchB-GigabitEthernet0/0/1] port trunk allow-pass vlan 2 to 20
4 [SwitchB-GigabitEthernet0/0/1] quit

# 将实例2的根桥SwitchB端口Eth-Trunk1加入VLAN。

1 [SwitchB] interface Eth-Trunk 1
2 [SwitchB-Eth-Trunk1] trunkport gigabitethernet 0/0/2
3 [SwitchB-Eth-Trunk1] trunkport gigabitethernet 0/0/3
4 [SwitchB-Eth-Trunk1] port link-type trunk
5 [SwitchB-Eth-Trunk1] port trunk allow-pass vlan 2 to 20
6 [SwitchB-Eth-Trunk1] quit

# 将接入交换机SwitchC端口 GE0/0/1加入VLAN。

1 [SwitchC] interface gigabitethernet 0/0/1
2 [SwitchC-GigabitEthernet0/0/1] port link-type access
3 [SwitchC-GigabitEthernet0/0/1] port default vlan 2
4 [SwitchC-GigabitEthernet0/0/1] quit

# 将接入交换机SwitchC端口 GE0/0/2加入VLAN。

1 [SwitchC] interface gigabitethernet 0/0/2
2 [SwitchC-GigabitEthernet0/0/2] port link-type trunk
3 [SwitchC-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 20
4 [SwitchC-GigabitEthernet0/0/2] quit

# 将接入交换机SwitchC端口 GE0/0/3加入VLAN。

1 [SwitchC] interface gigabitethernet 0/0/3
2 [SwitchC-GigabitEthernet0/0/3] port link-type trunk
3 [SwitchC-GigabitEthernet0/0/3] port trunk allow-pass vlan 2 to 20
4 [SwitchC-GigabitEthernet0/0/3] quit

# 将接入交换机SwitchD端口 GE0/0/1加入VLAN。

1 [SwitchD] interface gigabitethernet 0/0/1
2 [SwitchD-GigabitEthernet0/0/1] port link-type access
3 [SwitchD-GigabitEthernet0/0/1] port default vlan 11
4 [SwitchD-GigabitEthernet0/0/1] quit

# 将接入交换机SwitchD端口 GE0/0/2加入VLAN。

1 [SwitchD] interface gigabitethernet 0/0/2
2 [SwitchD-GigabitEthernet0/0/2] port link-type trunk
3 [SwitchD-GigabitEthernet0/0/2] port trunk allow-pass vlan 2 to 20
4 [SwitchD-GigabitEthernet0/0/2] quit

# 将接入交换机SwitchD端口 GE0/0/3加入VLAN。

1 [SwitchD] interface gigabitethernet 0/0/3
2 [SwitchD-GigabitEthernet0/0/3] port link-type trunk
3 [SwitchD-GigabitEthernet0/0/3] port trunk allow-pass vlan 2 to 20
4 [SwitchD-GigabitEthernet0/0/3] quit
  • 验证配置结果
说明: 

本配置举例以实例1和实例2为例,因此不用关注实例0中端口的状态。

# 在实例1的根桥SwitchA上执行 display stp brief 命令,查看端口状态和端口的保护类型,结果如下:

1 [SwitchA] display stp brief
2  MSTID  Port                        Role  STP State       Protection
3    0    GigabitEthernet0/0/1        DESI  FORWARDING      ROOT
4    0    Eth-Trunk1                  DESI  FORWARDING      NONE
5    1    GigabitEthernet0/0/1        DESI  FORWARDING      ROOT
6    1    Eth-Trunk1                  DESI  FORWARDING      NONE
7    2    GigabitEthernet0/0/1        DESI  FORWARDING      ROOT
8    2    Eth-Trunk1                  ROOT  FORWARDING      NONE

在MSTI1中,由于SwitchA是根桥,SwitchA的端口Eth-Trunk1和 GE0/0/1成为指定端口。在MSTI2中,SwitchA的端口 GE0/0/1成为指定端口,端口Eth-Trunk1成为根端口。

# 在实例2的根桥SwitchB上执行 display stp brief 命令,结果如下:

1 [SwitchB] display stp brief
2  MSTID  Port                        Role  STP State       Protection
3    0    GigabitEthernet0/0/1        DESI  FORWARDING      ROOT
4    0    Eth-Trunk1                  ROOT  FORWARDING      NONE
5    1    GigabitEthernet0/0/1        DESI  FORWARDING      ROOT
6    1    Eth-Trunk1                  ROOT  FORWARDING      NONE
7    2    GigabitEthernet0/0/1        DESI  FORWARDING      ROOT
8    2    Eth-Trunk1                  DESI  FORWARDING      NONE

在MSTI2中,由于SwitchB是根桥,端口 GE0/0/1和Eth-Trunk1在MSTI2中成为指定端口。在MSTI1中,SwitchB的端口 GE0/0/1成为指定端口,端口Eth-Trunk1成为根端口。

# 在接入交换机SwitchC上执行 display stp interface brief 命令,结果如下:

1 [SwitchC] display stp interface gigabitethernet 0/0/3 brief
2  MSTID  Port                        Role  STP State       Protection
3    0    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE
4    1    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE
5    2    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE
1 [SwitchC] display stp interface gigabitethernet 0/0/2 brief
2  MSTID  Port                        Role  STP State       Protection
3    0    GigabitEthernet0/0/2        DESI  FORWARDING      NONE
4    1    GigabitEthernet0/0/2        DESI  FORWARDING      NONE
5    2    GigabitEthernet0/0/2        ALTE  DISCARDING      NONE

SwitchC的端口 GE0/0/3在MSTI1和MSTI2中为根端口。SwitchC的另一个端口 GE0/0/2,在MSTI2中被阻塞,在MSTI1中被计算为指定端口。

# 在接入交换机SwitchD上执行 display stp interface brief 命令,结果如下:

1 [SwitchD] display stp interface gigabitethernet 0/0/3 brief
2  MSTID  Port                        Role  STP State       Protection
3    0    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE
4    1    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE
5    2    GigabitEthernet0/0/3        ROOT  FORWARDING      NONE
1 [SwitchD] display stp interface gigabitethernet 0/0/2 brief
2  MSTID  Port                        Role  STP State       Protection
3    0    GigabitEthernet0/0/2        ALTE  DISCARDING      NONE
4    1    GigabitEthernet0/0/2        ALTE  DISCARDING      NONE
5    2    GigabitEthernet0/0/2        DESI  FORWARDING      NONE

SwitchD的端口 GE0/0/3在MSTI1和MSTI2中为根端口。SwitchD的另一个端口 GE0/0/2,在MSTI1中被阻塞,在MSTI2中被计算为指定端口。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK