Cisco STP Enhance

STP加快convergence
主要有以下方法
portfast:access-layer node
uplinkfast:access-layer uplinks
backbonefast:core-layer redundant backbone paths
ps:此三個是為了解決802.1d標準的缺點

啟用portfast
(config-if)#spanning-tree portfast
or global enable portfast
(config)# spanning-tree portfast default
將listen和learn狀態所需時間縮到極短,因此感應到link up時(workstation連入網路)會立刻到forward狀態
 可減少30sec
 會保持loop偵測功能,若有偵測到則將port改成blocking state
 啟動或關閉時不會發送tcnbpdu 
 通常用在連接end user的介面 
 預設每個介面都關閉
Verifying method
 show running-config interface < interface>
ps:
(config-if)#switchport host會執行三個指令,其中一個會啟用portfast
ps:
也可支援trunk port,可縮短trunk介面到forward狀態之時間
(config-if)#spanning-tree portfast trunk


啟用uplinkfast
(config)#spanning-tree uplinkfast [max-update-rate < pkts-per-second>]
當root port斷線則馬上將alternate port從blocking status變成forwarding status
 可減少30sec
 alternate port是指下個有最低root path cost的root port
 會記錄每一條到root bridge的路徑
 會修改bridge priority為49152以避免成為root bridge,並把所有port cost提高至3000以成為end switch
 不可在root bridge上使用,通常用在end switch(edge switch)上
 利用Dummy Frame去偵測,每秒150frame
參數說明如下: 
[max-update-rate] 可設範圍為0-65535,預設150,每秒通知上游switch資訊的packet數量
 主要傳送dummy multicast frames到0100.0ccd.cdcd
ex:啟用uplinkfast
(config)# spanning-tree uplinkfast
# show spanning-tree uplinkfast
UplinkFast is enabled
Station update rate set to 150 packets/sec.
UplinkFast statistics
Number of transitions via uplinkFast (all VLANs) : 2
Number of proxy multicast addresses transmitted (all VLANs) : 52
Name   ,Interface List
VLAN0001 ,Gi0/1(fwd)
VLAN0010 ,Gi0/1(fwd)
VLAN0100 ,Gi0/1(fwd)

啟用backbonefast
(config)#spanning-tree backbonefast
偵測間接鏈路故障,加快收斂速度
 將Max Age 20 sec時間縮短(將收斂時間從50秒變到30秒)
 會啟用RLQ protocol
ps:該網路所有switch都啟用backbonefast才可正確的運作,預設是關閉

… 

顯示uplinkfast狀態
#show spanning-tree uplinkfast

顯示backbonefast狀態
#show spanning-tree backbonefast

……………………………………………………………………………………………………..

RSTP Configuration
By default, a switch operates in PVST+ mode using traditional 802.1D STP.
Therefore, RSTP cannot be used until a different spanning-tree mode(MST or RPVST+) is enabled
ps:
RSTP is just the underlying mechanism that a spanning-tree mode can use to detect topology changes and converge a network into a loop-free topology

enable the RPVST+ mode
Switch(config)# spanning-tree mode rapid-pvst
要將該區所有switch啟用rstp,該區才會形成rstp網路
ps:
After enable the RPVST+, the switch must begin supporting both RSTP and 802.1D STP neighbors. The switch can detect the neighbor’s STP type by the BPDU version that is received
ps
enable the PVST+ mode:#spanning-tree mode pvst


To configure an RSTP edge port
Switch(config-if)# spanning-tree portfast

To force the port to act as a point-to-point link, if port is operating in half duplex mode
Switch(config-if)# spanning-tree link-type point-to-point
ps:
By default, RSTP automatically decides that a port is a point-to-point link if it is operating
in full-duplex mode

shows information about the RSTP
#show spanning-tree [vlan < vlan-id> ]
ps
Switch# show spanning-tree vlan 171 為例,畫面大致如下
VLAN0171
 Spanning tree enabled protocol rstp
 Root ID Priority 4267
      Address 00d0.0457.38aa
      Cost 3
      Port 833 (Port-channel1)
      Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32939 (priority 32768 sys-id-ext 171)
      Address 0007.0d55.a800
      Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
      Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
—————- —- —- ——— ——– ——————————-
Gi7/8 Desg FWD 4 128.392 P2p
Gi9/6 Altn BLK 4 128.518 P2p Peer(STP)
Po1 Root FWD 3 128.833 P2p
Po2 Desg FWD 3 128.834 P2p
Po3 Desg FWD 3 128.835 P2p
說明如下
P2p denotes a point-to-point RSTP port type in which a full-duplex link connects two neighboring switches that both are running RSTP.
P2p Peer(STP), the port is a point-to-point type but the neighboring device is running traditional 802.1D STP

………………………………………………………………………………………

MST Configuration
1.
to must manually configure the MST configuration attributes on each switch in a region
ps:There is currently no method to propagate this information from one switch to another, as is done with a protocol such as VTP
2.
A switch cannot run both MST and PVST+ at the same time.

Enable MST on the switch:
Switch(config)# spanning-tree mode mst
After MST is enabled and configured, PVST+ operation stops and the switch changes to RSTP operation.

MST configuration
1
Enter the MST configuration mode:
Switch(config)# spanning-tree mst configuration
2
Assign a “MST configuration name” for MST region
Switch(config-mst)# name < name>
< name> :up to 32 characters
3
Assign a “region configuration revision number” for MST region
Switch(config-mst)# revision < version>
< version> :0 to 65,535
4
Map VLANs to an MST instance in MST region:
Switch(config-mst)# instance < instance-id> vlan < vlan-list>
< instance-id> :maximum of 16 MSTIs in each region.
The IST always exists as MSTI 0, leaving MSTIs 1-15 available for use.
< vlan-list> :1 to 4,094
ps:
by default, all VLANs are mapped to instance 0, the IST.
5
Show the pending changes you have made:
Switch(config-mst)# show pending

ex:
設定mst,
region name=buildmst
revision=1
MST instance-to-VLAN mapping為 msti1=vlan 51,52;msti2=vlan53-55
device1設定如下
device1(config)#spanning-tree mode mst
device1(config-mst)#spanning-tree mst configuration
device1(config-mst)#name buildmst
device1(config-mst)#revision 1 //所有的switch都要相同
device1(config-mst)#instance 1 vlan 51,52
device1(config-mst)#instance 2 vlan 53-55
device2設定如下
device2(config)#spanning-tree mode mst
device2(config-mst)#spanning-tree mst configuration
device2(config-mst)#name buildmst
device2(config-mst)#revision 1 //所有的switch都要相同
device2(config-mst)#instance 1 vlan 51,52
device2(config-mst)#instance 2 vlan 53-55

tune the parameters that MST uses when it interacts with CST or 802.1D.

Set root bridge(macro).
Switch(config)# spanning-tree mst < instance-id> root < primary |secondary> [diameter < diameter>]

Set bridge priority.
Switch(config)# spanning-tree mst < instance-id> priority < bridge-priority>
Set port cost.
Switch(config)# spanning-tree mst < instance-id> cost < cost>
Set port priority.
Switch(config)# spanning-tree mst < instance-id> port-priority < port-priority>

Set STP timers.
Switch(config)# spanning-tree mst hello-time < seconds>
Switch(config)# spanning-tree mst forward-time < seconds>
Switch(config)# spanning-tree mst max-age < seconds>

Displays mst configuration information
Switch#show spanning-tree mst configuration
ps:
畫面大致如下
Name [cisco]
Revision 1
Instance Vlans mapped
——– ———————————————————————
0 11-4094
1 1-10


Displays MSTP instance
Switch#show spanning-tree mst < instance_number>
ps:
Switch#show spanning-tree mst 1 為例,畫面大致如下
###### MST01 vlans mapped: 1-10
Bridge address 00d0.00b8.1400 priority 32769 (32768 sysid 1)
Root this switch for MST01
Interface Role Sts Cost Prio.Nbr Status
—————- —- — ——— ——– ——————————–
Fa4/4 Back BLK 1000 240.196 P2p
Fa4/5 Desg FWD 200000 128.197 P2p
Fa4/48 Boun FWD 200000 128.240 P2p Bound(STP)


參考資料
http://life.iiietc.ncu.edu.tw/xms/read_attach.php?id=21303
http://baike.baidu.com/view/123854.htm
http://networking.ctocio.com.cn/StandardProtocol/164/9080664.shtml
http://www.china-ccie.com/ccie/lilun/switching/switching.html#11
http://wenku.baidu.com/view/2b8f2f0790c69ec3d5bb7530.html