想到了就總結一下,以後用起來也方便查詢
Bridge ID包括:
1. Bridge Priority (0-61440 以4096遞增)
2. System ID Extension (0-4095 實際就是vlan id)
3. MAC地址
改變根橋選舉過程
1. 手動更改BID 優先級 - 數字越小越好
Router(config)#spanning-tree vlan 1 priority ?
<0-65535> bridge priority
2. 直接指定根橋 (基於當前root更改本地優先級)
Router(config)#spanning-tree vlan 1 root ?
primary Configure this switch as primary root for this spanning tree
secondary Configure switch as secondary root
3. 驗證
- sh spanning-tree vlan [vlan ID]
- Router#sh spanning-tree root
VLAN1
Root ID Priority 32768
Address cc00.5f24.0000
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
根端口選舉 (RP election)
- RP是上行面向根橋的端口
- 根據最小的鏈路代價來選舉的(lowest Root Path Cost)
- 鏈路代價(帶寬越大,代價約小 且不是線性的)
- 如果鏈路代價一樣:更低的上行交換機BID,更小的上行端口號
DP選舉
DP 是下行遠離根橋的端口,選擇方法和根端口一樣
- 最小鏈路代價
- 最小BID
- 最小端口號
剩餘非根端口,非DP,則進入block mode (根本上講該端口不會錄入MAC地址到CAM table)
- 接收BPDU包
- 忽略所有其他數據包
- 不能發送數據包
更改端口代價
-Router(config-if)#spanning-tree vlan 1 cost ?
<1-65535> Change an interface's per VLAN spanning tree path cost
- bandwidth [bps]
驗證
- sh spanning -tree interface [int ID] detail
- sh spanning-tree vlan [vlan ID] detail
=========
命令輸出讀取root path cost
1. sh spanning-tree vlan [vlan ID] brief (似乎有的版本不需要輸入brief, 如下圖,31是端到端的root path cost)