SW之間配置以太網通道, SW2與SW1一樣
SW1(config)#default interface range ethernet 1/0 - 1
SW1(config)#interface port-channel 10
SW1(config-if)#no switchport
SW1(config-if)#ip address 10.1.1.1 255.255.255.0
SW1(config)#interface range ethernet 1/0-1
SW1(config-if-range)#no switchport
SW1(config-if-range)#channel-group 10 mode active
SW2(config)#port-channel load-balance ? ---負載
dst-ip Dst IP Addr
dst-mac Dst Mac Addr
src-dst-ip Src XOR Dst IP Addr
src-dst-mac Src XOR Dst Mac Addr
src-ip Src IP Addr
src-mac Src Mac Addr
STP:
802.1D:STP 802.1w: RSTP 802.1s: mst
思科默認PVST+
SW2(config)#spanning-tree mode ?
mst Multiple spanning tree mode
pvst Per-Vlan spanning tree mode
rapid-pvst Per-Vlan rapid spanning tree mode
生成樹基本原理:
Port ID : 端口優先級(默認128)+端口ID
BID: 優先級+MAC地址(MAC不改變)
1、SW2成為VLNA1的主根,VLAN10的備份,SW1成為VLAN10的主,VLAN1的備份
SW2(config)#spanning-tree vlan 10 root secondary
SW2(config)#spanning-tree vlan 1 roo primary
SW1(config)#spanning-tree vlan 10 root primary
SW1(config)#spanning-tree vlan 1 root secondary
SW2#show run | include spann
spanning-tree mode rapid-pvst
spanning-tree extend system-id
spanning-tree vlan 1 priority 24576
spanning-tree vlan 10 priority 28672
如果配置優先級為0則最大可能性成為主根
SW1(config)#spanning-tree vlan 10 priority 0
SW2(config)#spanning-tree vlan 1 priority 0
根端口選舉: 接收最優的BPDU
(1、Cost 2、BID 3、Port ID )
2、Vlan10 中的sw2的E1/1變為轉發狀態
A、SW2上修改
SW2(config-if)#spanning-tree vlan 10 cost 99
B、SW1(根)修改端口優先級
(1、Cost 2、BID 3、Port ID )
SW1(config)#interface e1/1
SW1(config-if)#spanning-tree vlan 10 port-priority 64
SW1修改完成後顯示的是影響鄰居的端口優先級
DP:指定端口發送、中繼最優的BPDU
SW3的f0/2通過目前阻塞狀態,需要通過修改成為指定端口
SW3(config)#spanning-tree vlan 10 priority 4096
Backbonefast:
SW3的2口(RP)關閉,收不到最優的BPDU,發送自己為根的BPDU給SW2(SW3的3口是DP);SW2的3口不接受該BPDU,SW2的3口從BLK切換到LIS需要20秒的maxage,另外兩個15秒的轉發延遲,SW2的3口變為DP發送來自SW1的最優的BPDU
SW3的E1/2接口shutdown
SW3(config)#interface e1/2
SW3(config-if)#shutdown
SW2(config)#spanning-tree backbonefast ---backbonefast每臺設備都要配置節省掉20S秒時間maxage
======================================================
快速生成樹802.1w:
SW1(config)#spanning-tree mode rapid-pvst
SW1#show spanning-tree summary totals
Switch is in rapid-pvst mode
類型shr和P2P,10M為shr,10M以上為P2P
SW1(config)#spanning-tree mode mst --修改成MST模式
SW1(config)#spanning-tree mst configuration
SW1(config-mst)#name CCIE
SW1(config-mst)#instance 1 vlan 1
SW1(config-mst)#instance 2 vlan 10
SW1#show spanning-tree mst configuration
Name [CCIE]
Revision 0 Instances configured 3
Instance Vlans mapped
-------- ---------------------------------------------------------------------
0 2-9,11-4094
1 1
2 10
=======================================================
802.1S
SW1#sho run | s mst
spanning-tree mode mst
spanning-tree mst configuration
name CCIE
instance 1 vlan 1
instance 2 vlan 10
MST:cost 2000000變化 ,版本變為3 flag相同
=======================================================
Bpdugard:
SW1(config)#spanning-tree portfast defaul ---全局下針對Portfast終端
SW1(config)#spanning-tree portfast edge bpduguard
SW1(config)#spanning-tree portfast defaul ---全局下針對Portfast終端
SW1(config)#no spanning-tree portfast edge bpduguard
SW1(config)#interface range ethernet 1/0-1
SW1(config-if-range)#shu
SW1(config-if-range)#no sh
SW1(config-if-range)#switchport trunk encapsulation dot1q
SW1(config-if-range)#switchport mode trunk
SW1(config-if-range)#switchport nonegotiate
注意: 接口下面開啟Bpdugard即使沒有配置portfast,也會生效
SW1(config)#interface range ethernet 1/0-1
SW1(config-if-range)#spanning-tree bpduguard enabl
==================================================
Bpdufilte:
SW1(config)#spanning-tree portfast edge bpdufilter default
如果把SW1的E1/1配置為bpdufilter則該接口不會發送BPDU報文,則對端SW2 E1/1接口收不到任何BPDU報文從BLK狀態變為轉發FWD,此時就產生環路。---不建議使用
====================================================
Loopbuard: 在DP指定端口配置Loopbuard:
SW1(config)#spanning-tree mode rapid-pvs ----R1R2R3配置快速生成樹
SW1(config)#interface e1/2
SW1(config-if)#spanning-tree guard root
SW1:spanning-tree vlan 10 priority 4096
SW3:spanning-tree vlan 10 priority 0 ---讓SW3成為根橋
SW1(config-if)#
*Nov 30 08:08:35.335: %SPANTREE-2-ROOTGUARD_BLOCK: Root guard blocking port Ethernet1/2 on VLAN0010.
SW2(config)#interface e1/0 ----在RP或備份端口配置
SW2(config-if)#spanning-tree guard loop
SW1(config)#interface e1/0
SW1(config-if)#spanning-tree bpdufilter enable
===================================================
UDLD: 單向鏈路檢測
SW2(config)#udld aggressive
SW1(config)#errdisable recovery cause udld ---自動恢復
閱讀更多 專注分享網絡技術 的文章