Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2046982
  • 博文数量: 433
  • 博客积分: 4775
  • 博客等级: 上校
  • 技术积分: 8054
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-19 16:15
文章存档

2014年(9)

2013年(20)

2012年(77)

2011年(323)

2009年(4)

分类:

2012-02-07 20:06:01

如果发生了一个二层环路,STP在选择一个LAN端口置于转发状态(对环路中的其他端口进行阻塞)时需要考虑其端口优先值。你可以为首先要选择转换成转发状态的端口(这是要你在有具体的分析后得出的)指派一个更高的优先级值,而为后面选择的端口指派一个较低的优先级值。如果所有端口都具有相同的端口优先级值,STP就会首先把具有最低LAN端口号的端口置于转发状态,而阻塞其他端口。端口优先级值的取值范围是1240,默认为128,步长为16

当一个LAN端口配置为访问端口时,STP会使用端口优先级值;当LAN端口配置为中继端口时,STP可以使用以该端口在对应VLAN上配置的端口优先级值(默认情况下,中继端口的端口优先级值应用到它所属于的所有VLAN中)。具体配置步骤如表12-6所示。

12-6  配置二层接口STP优先值的步骤

步骤

命令

用途说明

1

Switch#configure terminal

进入全局配置模式

Switch(config)#interface {{gigabitethernet 1/port} |
{port-channel port_channel_number}}

选择要配置端口优先级值的接口并进入接口配置模式

Switch(config-if)# spanning-tree port-priority
port_priority

配置LAN端口的端口优先值,参数port_priority的范围是1240,步长为16

该命令在12.1(8a)EW12.2(53)SE212.2(54)SG12.2(55)SE2IOS版本中支持

Switch(config-if)# no spanning-tree port-priority

重置端口优先值为默认值,默认为128

Switch(config-if)# spanning-tree vlan vlan_ID port-
priority
port_priority

(可选)为LAN端口所属的某个VLAN配置端口优先值。仅当需要改变该接口在某个VLAN中的优先级值时才进行(一般是针对中继端口)

参数port_priority的范围是1252,步长为4,参数vlan_ID的范围是14094,保留VLAN除外

Switch(config-if)# no spanning-tree vlan vlan_ID
port-priority

重置VLAN端口优先级值为默认值

Switch(config-if)# end

退出接口配置模式

Switch#show spanning-tree interface {gigabitethernet 1/
port
} | {port-channel port_channel_number}

校验以上端口配置

Switch# show spanning-tree vlan vlan_ID

7

Switch#copy running-config startup-config

把以上配置更改保存在启动配置文件中

【示例1配置Gigabit Ethernet 1/4的端口优先级值为160

Switch# configure terminal

Switch(config)# interface gigabitethernet 1/4

Switch(config-if)# spanning-tree port-priority 160

Switch(config-if)# end

Switch#

【示例2校验上面示例中对Gigabit Ethernet 1/4的端口优先级值的配置(注意输出信息中的粗体字部分)。从中可以看出Gigabit Ethernet 1/4端口是中继端口(因为它隶属于多个VLAN),所配置的端口优先级值将应用到此接口的所有VLAN中。

Switch# show spanning-tree interface gigabitethernet 1/4

Vlan             Role Sts Cost      Prio.Nbr Status

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

VLAN0001         Back BLK 200000    160.196  P2p

VLAN0006         Back BLK 200000    160.196  P2p

...

VLAN0198         Back BLK 200000    160.196  P2p

VLAN0199         Back BLK 200000    160.196  P2p

VLAN0200         Back BLK 200000    160.196  P2p

Switch#

【说明】如果配置的端口当前是连接的,并且正在工作,则show spanning-tree interface命令仅查看配置信息,否则要用show running-config interface命令来校验配置。

【示例3配置Gigabit Ethernet 1/4端口的VLAN端口优先级值为64

Switch# configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Switch(config)# interface gigabitethernet 1/4

Switch(config-if)# spanning-tree vlan 200 port-priority 64

Switch(config-if)# end

Switch#

本示例中的配置仅应用于VLAN 200中,所有其他VLAN的端口优先值为160。可以通过以下示例进行验证。

Switch# show spanning-tree interface gigabitethernet 1/4

Vlan             Role Sts Cost      Prio.Nbr Status

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

VLAN0001         Back BLK 200000    160.196  P2p

VLAN0006         Back BLK 200000    160.196  P2p

...

VLAN0199         Back BLK 200000    160.196  P2p

VLAN0200         Desg FWD 200000     64.196  P2p

 

Switch#

也可以使用以下命令显示VLAN 200的生成树信息。

Switch# show spanning-tree vlan 200 interface gigabitethernet 1/4

Interface        Role Sts Cost      Prio.Nbr Status

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

Gi1/4            Desg LRN 200000     64.196  P2p

阅读(1864) | 评论(0) | 转发(0) |
0

上一篇:配置从根交换机

下一篇:配置端口开销

给主人留下些什么吧!~~