之前已经讲了STP算法,这一篇讲命令
1、查看STP
SW1#sh spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 4097
Address 0090.21BD.4AE6
This bridge is the root //RB才会有这句话
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1)
Address 0090.21BD.4AE6
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
SW1(config)#spanning-tree vlan 1 priority 12345
% Bridge Priority must be in increments of 4096.
% Allowed values are:
0 4096 8192 12288 16384 20480 24576 28672
32768 36864 40960 45056 49152 53248 57344 61440
SW1(config)#spanning-tree vlan 1 priority 4096
如果优先级写错了,他会提示你必须是4096的倍数。
3、修改端口优先级
这张图上一篇博客已经讲过了,那如果我想让Switch4的F0/1口通,阻塞F0/2口,那我应该调整的就是Switch3的端口ID,不懂的可以看一下前一篇
Switch(config-if)#spanning-tree vlan 1 port-priority 64
补充提示:Switch(config-if)#spanning-tree vlan 1 port-priority ?
<0-240> port priority in increments of 16
注意是16的倍数