文档库 最新最全的文档下载
当前位置:文档库 › Cisco的MSTP配置(多生成树)

Cisco的MSTP配置(多生成树)

Cisco的MSTP配置(多生成树)
Cisco的MSTP配置(多生成树)

Cisco MSTP配置(多生成树)

时间:2010-01-18 15:29来源:未知作者:admin 点击: 367次

一、什么是MSTP 当前和STP相关的协议有:IEEE 802.1D(STP),802.1W(RSTP),802.1(MSTP)。其中802.1D是最早关于STP的标准。RSTP(Rapid Spanning Tree Protocol)是STP的扩展,其主要特点是增加了端口状态快速切换的机制,能够实现网络拓扑的快速转换。

一、什么是MSTP

当前和STP相关的协议有:IEEE 802.1D(STP),802.1W(RSTP),802.1(MSTP)。其中802.1D是最早关于STP的标准。RSTP(Rapid Spanning Tree Protocol)是STP的扩展,其主要特点是增加了端口状态快速切换的机制,能够实现网络拓扑的快速转换。MSTP(Multiple Spanning Tree Protocol)提出了多生成树的概念,可以把不同的vlan映射到不同的生成树,从而达到网络负载均衡的目的。

1.1 配置MSTP

1.1.1 设置模式

STP分为CST,MST两种模式,用户可以根据需要选择合理的模式:

CST模式

CST(Common Spanning Tree)整个网络形成一颗生成树,STP基于端口设置状态。如STP设置端口阻塞,则所有VLAN在该端口上都处于阻塞状态。该模式的特点是配置、实现简单,适合小型网络。缺点是没有vlan的概念,当用户VLAN的拓扑配置不一样的时候,可能造成部分VLAN不能正常通信。

MST模式

MST(Multiple Spanning Tree)是对CST的扩展,其有如下特点:

可以把多台交换机虚拟成一个MST域,该MST域类似CST的一个桥,和CST桥互通。

在MST域内,可以把具有相同拓扑的多个vlan映射到一个生成树实例,即MSTI(Multiple Spanning Tree Instance)。每个MSTI在域内可以有不同的拓扑,实现流量均衡的目的。

配置生成树模式的步骤如下:

步骤1 config spanning-tree 进入spanning-tree配置模式并配置生成树模式

步骤2 spanning-tree mode [cst | mst] 选择生成树模式

步骤3 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

12.1.2 设置快速特性

RSTP引入了快速状态转换的机制,合理的配置端口属性,可以达到网络快速转换。

Edge属性

处于网络边缘的交换机一般与终端设备相连,如PC机、工作站。把和这些终端设备相连的端口配置成为Edge 端口,可以实现端口状态的快速转换,而不需要DiscardingàLearningàForwarding的转换过程。

Edge属性配置步骤

步骤1 config spanning-tree 进入spanning-treespanning-tree配置模式

步骤2 Spanning-tree mode mst 配置mst工作模式

步骤3 spanning-tree port [edge] [yes | no] {}*1 配置交换机的指定端口是否参与指定域的STP协议计算,缺省为参与计算

步骤4 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

P2P属性

交换机端口和交换机端口直连,则该端口就是P2P接口。RSTP针对P2P接口采用协商机制,可以实现端口状态的快速转换(DiscardingàForwarding)。

P2P属性配置步骤

步骤1 config spanning-tree 进入spanning-tree配置模式

步骤2 spanning-tree port [none-stp] [yes | no] {}*1 配置交换机的指定端口是否参与指定域的STP协议计算,缺省为参与计算

步骤3 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

/*如果端口没有和共享介质相连,尽量把端口设置为P2P属性。*/

1.1.3 设置时间参数

MST有四个可以配置的时间参数:

Hello-time:STP报文发送的间隔;

Forward-delay:端口处于从DiscardingàLearning,LearningàForwarding状态的时间

Maximum-age:报文最大的生存周期;

Max-hops:MST域内报文的最大生存周期。

下面说明MST模式接口的时间参数配置:

设置时间参数配置步骤

步骤1 config spanning-tree 进入spanning-tree配置模式

步骤2 Spanning-tree mode mst 配置mst工作模式

步骤3 spanning-tree [hello-time] {}*1 配置当本交换机被选为根桥时发送BPDU的时间间隔,单位为秒, 缺省为2。hello-time必须小于等于forward-delay – 2

步骤4 spanning-tree [forward-delay] {}*1 设置当本交换机被选为根桥时端口状态切换的时间间隔,单位为秒, 缺省为15。forward-delay的时间必须大于等于hello-time + 2

步骤5 spanning-tree [maximum-age] {}*1 配置交换机在指定域上的BPDU报文老化的最长时间间隔,单位为秒,缺省为20,收到超过这个时间的BPDU报文,就直接丢弃。

maximum-age的时间必须大于等于2 *(hello-time + 1),小于等于2 * (forward-delay–1)

步骤6 spanning-tree max-hops mst 配置桥Forward delay 参数

步骤7 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

1.1.4 设置桥实例优先级

用户可以手动配置桥优先级对网络进行合理规划。优先级最高的桥(数值越小)就是网络的根桥。当两条链路到根桥的距离一样的时候,选择指定桥优先级高的路径。配置交换机在指定MSTID上的MSTI桥优先级,缺省为32768, MSTI桥优先级必须是4096的倍数。

桥实例优先级配置步骤

步骤1 config spanning-tree 进入spanning-tree配置模式并配置生成树模式

步骤2 Spanning-tree mode mst 配置mst工作模式

步骤3 spanning-tree priority mst 配置桥实例优先级

步骤4 exit 退出spanning-tree 配置模式

步骤5 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

1.1.5 设置端口优先级

当两条链路到根桥的距离一样,指定桥优先级一样,根据端口优先级决定拓扑结构。

端口优先级配置步骤

步骤1 config spanning-tree 进入spanning-tree配置模式并配置生成树模式

步骤2 Spanning-tree mode mst 配置mst工作模式

步骤3 spanning-tree port priority mst 配置端口的优先级

步骤4 exit 退出spanning-tree 配置模式

步骤5 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

1.1.6 设置端口路径

在根桥选定以后,端口路径对网络拓扑有着重大意义。到根的距离越小,就越有可能成为通路。选择好根桥以后,根据端口速率等情况,合理的配置端口路径,可以形成理想的拓扑。

端口pathcost配置步骤

步骤1 config spanning-tree 进入spanning-tree配置模式并配置生成树模式

步骤2 Spanning-tree mode mst 配置mst工作模式

步骤3 spanning-tree port path-cost [auto | ] mst 配置端口的pathcost

步骤4 exit 退出spanning-tree 配置模式

步骤5 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

1.1.7 设置端口non-stp特性

MSTP可以将某些端口设置为不参与协议计算的端口,其方法是设置non-stp属性。

non-stp属性配置步骤

步骤1 config spanning-tree 进入spanning-tree配置模式并配置生成树模式

步骤2 spanning-tree port [none-stp] [yes|no] {}*1 配置端口是否参加STP运算,端口不参加STP运算后,处于Forward状态。

步骤3 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

1.1.8 设置MSTP域

属于MSTP同一个域必须满足:在设备之间有物理连接的情况下,name,revision,Vlan与MSTI的映射关系完全一致。

MSTP域配置步骤

步骤1 config spanning-tree 进入spanning-tree配置模式

步骤2 Spanning-tree mode mst 配置mst工作模式

步骤3 spanning-tree mst name 配置MSTP域标识符名称

步骤4 spanning-tree mst revision 配置MSTP域标识符版本

步骤5 spanning-tree map vlan mst 配置MSTP域与vlans的映射

步骤6 exit 退出spanning-tree 配置模式

步骤7 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

1.1.9 设置MSTP使能

接口配置

MSTP在只二层接口上起作用,包括普通以太网和Trunk端口,以太网和Trunk缺省都为二层接口。当用户希望使能某以太网或trunk的二层转发功能,以使其参与生成树计算时,可以进行以下配置:

MSTP在二层接口上的配置步骤

步骤1 interface ethernet 进入以太网接口

步骤2 forward l2 enable 禁止该接口的二层转发功能

步骤3 exit 退出以太网配置模式

VLAN配置

MST模式涉及到VLAN。MSTP关心的是VLAN的二层属性;而SuperVlan,基于协议的Vlan等都不是MSTP考虑的情况。

MST在VLAN上的配置步骤

步骤1 interface vlan 进入vlan配置模式

步骤2 add port untagged 将端口以untagged的方式加入VLAN

步骤3 exit 退出VLAN配置模式

使能MSTP

使能MSTP的配置步骤

步骤1 config spanning-tree 进入spanning-tree配置模式

步骤2 Spanning-tree mode mst 配置mst工作模式

步骤3 Spanning-tree enable 使能MSTP

步骤4 exit 退出spanning-tree 配置模式

步骤5 show spanning-tree mst 显示MSTP配置, mst-instance为0时候显示的是IST的信息,其他的为MSTI的参数

配置案列:

案例描述

本例主要为交换机配置MSTP域。在三台交换机上分别创建单MST Region,并在其中创建3个Instance。通过配置实例优先级使得在Instance1 中bridge1(MAC: 0005:3b80:03cf)为根桥,Instance 2中bridge2(MAC: 0005.3b81.1278)为根桥,在Instance3中bridge3(MAC: 2222:2222:2222)为根桥。MSTP将整个网络划分为多个域(不同的域用不同的name和revision区分),每个域中最多可包含64个实例,每个实例内部生成一棵生成树;每个实例又可包含多个VLAN,多个vlan映射到一个Spaning Tree,所有的VLAN缺省都在Instance 0中。

在MST配置中,若配置最后带Instance ,生成树改变就只在特定的Instance中有效,对其它Instance 的生成树没有影响;缺省情况下,改变参数只对该Region(Instance 0)中的生成树计算有影响。

在Bridge1上的配置步骤

步骤1 创建vlan,并添加端口

Harbour (config )#interface vlan vlan10 10

Harbour (config -vlan-vlan10)#add port 2/1-5 tag

Harbour (config -vlan-vlan10)#exit

Harbour (config )#interface vlan vlan20 20

Harbour (config -vlan-vlan20)#add port 2/1-5 tag

Harbour (config -vlan-vlan20)#exit

Harbour (config )#interface vlan vlan30 30

Harbour (config -vlan-vlan30)#add port 2/1-5 tag

Harbour (config -vlan-vlan30)#exit

步骤2 进入config -mstp配置模式

Harbour (config ) # config spanning-tree

Harbour(config -cst) # spanning-tree mode mst

步骤3 创建一个mst region

Harbour(config -mst)# spanning-tree mst name region2

Harbour(config -mst)# spanning-tree mst revision 2

步骤4 使能MSTP

Harbour(config -mst)# spanning-tree enable

步骤5 创建三个实例

Harbour(config -mst)# spanning-tree map vlan 10-19 mst 1

Harbour(config -mst)# spanning-tree map vlan 20-29 mst 2

Harbour(config -mst)# spanning-tree map vlan 30-39 mst 3

步骤6 配置实例优先级

Harbour(config -mst)# spanning-tree priority 4096 mst 1

Harbour(config -mst)# spanning-tree priority 32768 mst 2

Harbour(config -mst)# spanning-tree priority 61440 mst 3

在Bridge2上的配置步骤

步骤1 创建vlan,并添加端口

Harbour (config )#interface vlan vlan10 10

Harbour (config -vlan-vlan10)#add port 2/1-5 tag

Harbour (config -vlan-vlan10)#exit

Harbour (config )#interface vlan vlan20 20

Harbour (config -vlan-vlan20)#add port 2/1-5 tag(责任编辑:admin)

Harbour (config -vlan-vlan20)#exit Harbour (config )#interface vlan vlan30 30 Harbour (config -vlan-vlan30)#add port 2/1-5 tag Harbour (config -vlan-vlan30)#exit 步骤2 进入config -mstp配置模式Harbou

Harbour (config -vlan-vlan20)#exit

Harbour (config )#interface vlan vlan30 30

Harbour (config -vlan-vlan30)#add port 2/1-5 tag

Harbour (config -vlan-vlan30)#exit

步骤2 进入config -mstp配置模式

Harbour (config ) # config spanning-tree

Harbour(config -cst) # spanning-tree mode mst

步骤3 创建一个mst region

Harbour(config -mst)# spanning-tree mst name region2

Harbour(config -mst)# spanning-tree mst revision 2

步骤4 使能MSTP

Harbour(config -mst)# spanning-tree enable

步骤5 创建三个实例

Harbour(config -mst)# spanning-tree map vlan 10-19 mst 1

Harbour(config -mst)# spanning-tree map vlan 20-29 mst 2

Harbour(config -mst)# spanning-tree map vlan 30-39 mst 3

步骤6 配置实例优先级

Harbour(config -mst)# spanning-tree priority 61440 mst 1

Harbour(config -mst)# spanning-tree priority 4096 mst 2

Harbour(config -mst)# spanning-tree priority 32768 mst 3

在Bridge3上的配置步骤

步骤1 创建vlan,并添加端口

Harbour (config )#interface vlan vlan10 10

Harbour (config -vlan-vlan10)#add port 2/1-5 tag

Harbour (config -vlan-vlan10)#exit

Harbour (config )#interface vlan vlan20 20

Harbour (config -vlan-vlan20)#add port 2/1-5 tag

Harbour (config -vlan-vlan20)#exit

Harbour (config )#interface vlan vlan30 30

Harbour (config -vlan-vlan30)#add port 2/1-5 tag

Harbour (config -vlan-vlan30)#exit

步骤2 进入config -mstp配置模式

Harbour (config ) # config spanning-tree

Harbour(config -cst) # spanning-tree mode mst

步骤3 创建一个mst region

Harbour(config -mst)# spanning-tree mst name region2

Harbour(config -mst)# spanning-tree mst revision 2

步骤4 使能MSTP

Harbour(config -mst)# spanning-tree enable

步骤5 创建三个实例

Harbour(config -mst)# spanning-tree map vlan 10-19 mst 1

Harbour(config -mst)# spanning-tree map vlan 20-29 mst 2

Harbour(config -mst)# spanning-tree map vlan 30-39 mst 3

步骤6 配置实例优先级

Harbour(config -mst)# spanning-tree priority 32768 mst 1

Harbour(config -mst)# spanning-tree priority 61440 mst 2

Harbour(config -mst)# spanning-tree priority 4096 mst 3

分别显示三个交换机的配置结果:

brideg1上显示结果:

Harbour(config -mst)# sh sp mst 1

MSTID : 1

Vlans : 10-19

Region Root ID : 00:05:3b:80:03:cf

Region Root Priority : 4096

Region Root Path Cost : 0

Root Port : none

Bridge ID MAC Address : 00:05:3b:80:03:cf

Bridge ID Priority : 4096

------------------------- All ports information in msti 1 ------------------ Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port 2/1 128 2000000 Dis Discarding N N N

2/2 128 2000000 Dis Discarding N N N

2/3 128 20000 Desi Forwarding Y Y N 4096:00053b8003cf 0 0x8083 2/4 128 20000 Desi Forwarding Y Y N 4096:00053b8003cf 0 0x8084 2/5 128 2000000 Dis Discarding N N N

---------------------------------------------------------------------------

Harbour(config -mst)# sh sp mst 2

MSTID : 2

Vlans : 20-29

Region Root ID : 00:05:3b:81:12:78

Region Root Priority : 4096

Region Root Path Cost : 20000

Root Port : 2/4

Bridge ID MAC Address : 00:05:3b:80:03:cf

Bridge ID Priority : 32768

------------------------- All ports information in msti 2 ------------------

Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port

2/1 128 2000000 Dis Discarding N N N

2/2 128 2000000 Dis Discarding N N N

2/3 128 20000 Desi Forwarding Y Y N 32768:00053b8003cf 20000 0x8083 2/4 128 20000 Root Forwarding Y Y N 4096:00053b811278 20000 0x8081 2/5 128 2000000 Dis Discarding N N N

---------------------------------------------------------------------------

Harbour(config -mst)# sh sp mst 3

MSTID : 3

Vlans : 30-39

Region Root ID : 22:22:22:22:22:22

Region Root Priority : 4096

Region Root Path Cost : 20000

Root Port : 2/3

Bridge ID MAC Address : 00:05:3b:80:03:cf

Bridge ID Priority : 61440

------------------------- All ports information in msti 3 ------------------

Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port

2/1 128 2000000 Dis Discarding N N N

2/2 128 2000000 Dis Discarding N N N

2/3 128 20000 Root Forwarding Y Y N 4096:222222222222 20000 0x8081 2/4 128 20000 Alt Discarding Y Y N 32768:00053b811278 40000 0x8081 2/5 128 2000000 Dis Discarding N N N

bridge2上显示结果:

Harbour(config -mst)# sh sp mst 1

MSTID &n, bsp; : 1

Vlans : 10-19

Region Root ID : 00:05:3b:80:03:cf

Region Root Priority : 4096

Region Root Path Cost : 20000

Root Port : 2/1

Bridge ID MAC Address : 00:05:3b:81:12:78

Bridge ID Priority : 61440

------------------------- All ports information in msti 1 ------------------

Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port

2/1 128 20000 Root Forwarding Y Y N 4096:00053b8003cf 20000 0x8084

2/2 128 2000000 Dis Discarding N N N

2/3 128 20000 Alt Discarding Y Y N 32768:222222222222 40000 0x8082

2/4 128 2000000 Dis Discarding N N N

2/5 128 2000000 Dis Discarding N N N

Harbour(config -mst)# sh sp mst 2

MSTID : 2

Vlans : 20-29

Region Root ID : 00:05:3b:81:12:78

Region Root Priority : 4096

Region Root Path Cost : 0

Root Port : none

Bridge ID MAC Address : 00:05:3b:81:12:78

Bridge ID Priority : 4096

------------------------- All ports information in msti 2 ------------------

Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port

2/1 128 20000 Desi Forwarding Y Y N 4096:00053b811278 0 0x8081

2/2 128 2000000 Dis Discarding N N N

2/3 128 20000 Desi Forwarding Y Y N 4096:00053b811278 0 0x8083

2/4 128 2000000 Dis Discarding N N N

2/5 128 2000000 Dis Discarding N N N

---------------------------------------------------------------------------

Harbour(config -mst)# sh sp mst 3

MSTID : 3

Vlans : 30-39(责任编辑:admin)

Region Root ID : 22:22:22:22:22:22 Region Root Priority : 4096 Region Root Path Cost : 20000 Root Port : 2/3 Bridge ID MAC Address : 00:05:3b:81:12:78 Bridge ID Priority : 32768 ---------------------

Region Root ID : 22:22:22:22:22:22

Region Root Priority : 4096

Region Root Path Cost : 20000

Root Port : 2/3

Bridge ID MAC Address : 00:05:3b:81:12:78

Bridge ID Priority : 32768

------------------------- All ports information in msti 3 ------------------

Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port

2/1 128 20000 Desi Forwarding Y Y N 32768:00053b811278 20000 0x8081 2/2 128 2000000 Dis Discarding N N N

2/3 128 20000 Root Forwarding Y Y N 4096:222222222222 20000 0x8082 2/4 128 2000000 Dis Discarding N N N

2/5 128 2000000 Dis Discarding N N N

---------------------------------------------------------------------------

bridge3上显示结果:

Harbour(config )# sh sp mst 1

MSTID : 1

Vlans : 10-19

Region Root ID : 00:05:3b:80:03:cf

Region Root Priority : 4096

Region Root Path Cost : 20000

Root Port : 2/1

Bridge ID MAC Address : 22:22:22:22:22:22

Bridge ID Priority : 32768

------------------------- All ports information in msti 1 ------------------

Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port

2/1 128 20000 Root Forwarding Y Y N 4096:00053b8003cf 20000 0x8083 2/2 128 20000 Desi Forwarding Y Y N 32768:222222222222 20000 0x8082 2/3 128 2000000 Dis Discarding N N N

2/4 128 2000000 Dis Discarding N N N

2/5 128 2000000 Dis Discarding N N N

---------------------------------------------------------------------------

Harbour(config )# sh sp mst 2

MSTID : 2

Vlans : 20-29

Region Root ID : 00:05:3b:81:12:78

Region Root Priority : 4096

Region Root Path Cost : 20000

Root Port : 2/2

Bridge ID MAC Address : 22:22:22:22:22:22

Bridge ID Priority : 61440

------------------------- All ports information in msti 2 ------------------

Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port

2/1 128 20000 Alt Discarding Y Y N 32768:00053b8003cf 40000 0x8083

2/2 128 20000 Root Forwarding Y Y N 4096:00053b811278 20000 0x8083 2/3 128 2000000 Dis Discarding N N N

2/4 128 2000000 Dis Discarding N N N

2/5 128 2000000 Dis Discarding N N N

---------------------------------------------------------------------------

Harbour(config )# sh sp mst 3

MSTID : 3

Vlans : 30-39

Region Root ID : 22:22:22:22:22:22

Region Root Priority : 4096

Region Root Path Cost : 0

Root Port : none

Bridge ID MAC Address : 22:22:22:22:22:22

Bridge ID Priority : 4096

------------------------- All ports information in msti 3 ------------------ Name pri cost role span-state lk p2p eg Desi-bridge-id Dcost D-port

2/1 128 20000 Desi Forwarding Y Y N 4096:222222222222 0 0x8081 2/2 128 20000 Desi Forwarding Y Y N 4096:222222222222 0 0x8082 2/3 128 2000000 Dis Discarding N N N

2/4 128 2000000 Dis Discarding N N N

2/5 128 2000000 Dis Discarding N N N

相关文档