PVST+(每一個VLAN 的生成樹PVST 加)spa
實驗拓撲:it
分別在 SW1 和SW2 上show spanning-tree 查看結果:io
SW1#show spanning-treeast
VLAN0001配置
Spanning tree enabled protocol ieee方法
Root ID Priority 32769im
Address 0008.20ff.6400端口
This bridge is the rootco
Hello Time 2 sec Max Age 20 sec Forward Delay 15 secblock
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0008.20ff.6400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 15
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Desg FWD 19 128.23 P2p
Fa0/24 Desg FWD 19 128.24 P2p
SW2#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0008.20ff.6400
Cost 19
Port 23 (FastEthernet0/23)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 000d.bce7.5940
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Root FWD 19 128.23 P2p
Fa0/24 Altn BLK 19 128.24 P2p
注:以上拓撲中通過選舉最終SW1 爲根網橋,SW2 的F0/24 爲blocking 端口,也是就線路2 成爲了備
份鏈路。
分別在 SW1 和SW2 上建立VLAN2,VLAN3,VLAN4,按以下拓撲要求完成本實驗:
在 SW1 上建立VLAN2,VLAN3,VLAN4 並查看:
SW1(config)#vlan 2-4
SW1#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22
2 VLAN0002 active
3 VLAN0003 active
4 VLAN0004 active
在 SW2 上建立VLAN2,VLAN3,VLAN4 並查看:
SW2(config)#vlan 2-4
SW2#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22
2 VLAN0002 active
3 VLAN0003 active
4 VLAN0004 active
按以下拓撲要求完成本實驗:
要求:SW2 的VLAN1 和VLAN2 流量經過線路1 到達SW1 , SW2 的VLAN3 和VLAN4 的流量
通過線路2 到達SW1,當其中一條鏈路有問題走同一鏈路.
分別在 SW1 和SW2 上建立了VLAN2-4 後查看目前的生成樹狀態.
在SW1 上查看:
命令:show spanning-tree vlan 1
show spanning-tree vlan 2
show spanning-tree vlan 3
show spanning-tree vlan 4
SW1#show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0008.20ff.6400
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0008.20ff.6400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Desg FWD 19 128.23 P2p
Fa0/24 Desg FWD 19 128.24 P2p
SW1#show spanning-tree vlan 2
VLAN0002
Spanning tree enabled protocol ieee
Root ID Priority 32770
Address 0008.20ff.6400
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32770 (priority 32768 sys-id-ext 2)
Address 0008.20ff.6400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Desg FWD 19 128.23 P2p
Fa0/24 Desg FWD 19 128.24 P2p
SW1#show spanning-tree vlan 3
VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 32771
Address 0008.20ff.6400
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32771 (priority 32768 sys-id-ext 3)
Address 0008.20ff.6400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Desg FWD 19 128.23 P2p
Fa0/24 Desg FWD 19 128.24 P2p
SW1#show spanning-tree vlan 4
VLAN0004
Spanning tree enabled protocol ieee
Root ID Priority 32772
Address 0008.20ff.6400
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32772 (priority 32768 sys-id-ext 4)
Address 0008.20ff.6400
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Desg FWD 19 128.23 P2p
Fa0/24 Desg FWD 19 128.24 P2p
結果:查看生成樹狀態後發現針對VLAN1,VLAN2,VLAN3,VLAN3,SW1 都是扮演根網橋角
色.SW1 鏈接SW2 的兩個端口F0/23,F0/24 都是指定端口.
在SW2 上查看:
命令:show spanning-tree vlan 1
show spanning-tree vlan 2
show spanning-tree vlan 3
show spanning-tree vlan 4
SW2#show spanning-tree vlan 1
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0008.20ff.6400
Cost 19
Port 23 (FastEthernet0/23)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 000d.bce7.5940
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Root FWD 19 128.23 P2p
Fa0/24 Altn BLK 19 128.24 P2p
SW2#show spanning-tree vlan 2
VLAN0002
Spanning tree enabled protocol ieee
Root ID Priority 32770
Address 0008.20ff.6400
Cost 19
Port 23 (FastEthernet0/23)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32770 (priority 32768 sys-id-ext 2)
Address 000d.bce7.5940
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Root FWD 19 128.23 P2p
Fa0/24 Altn BLK 19 128.24 P2p
SW2#show spanning-tree vlan 3
VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 32771
Address 0008.20ff.6400
Cost 19
Port 23 (FastEthernet0/23)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32771 (priority 32768 sys-id-ext 3)
Address 000d.bce7.5940
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Root FWD 19 128.23 P2p
Fa0/24 Altn BLK 19 128.24 P2p
SW2#show spanning-tree vlan 4
VLAN0004
Spanning tree enabled protocol ieee
Root ID Priority 32772
Address 0008.20ff.6400
Cost 19
Port 23 (FastEthernet0/23)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32772 (priority 32768 sys-id-ext 4)
Address 000d.bce7.5940
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Root FWD 19 128.23 P2p
Fa0/24 Altn BLK 19 128.24 P2p
結果:查看生成樹狀態後發現針對VLAN1,VLAN2,VLAN3,VLAN3,SW2 都是扮演非根網橋角色,
SW2 的端口F0/24 都處在blocking 狀態.
問題所在:經過在SW1 和SW2 查看獲得的結果咱們來分析一下,如今SW1 的VLAN1 和VLAN2
是經過線路1 到達SW1 的,這符合本實驗的要求,但VLAN3,VLAN4 到SW1 走線路1 不符合本實驗的要
求,VLAN3,VLAN4 到SW1 要求走線路2.
分析:SW2 的VLAN3,VLAN4 到SW1 爲何走線路1 呢?由於SW2 相對於VLAN3,VLAN4 來講到
達SW1 F0/24 都是blocking 狀態,F0/23 爲轉發狀態,致使VLNA3,VLAN3 經過F0/23 走線路1 到達SW1.
解決方法:在SW2 上VLAN2,VLAN3 要到達SW1 只要SW2 的F0/23 爲blocking 狀態,F0/24 爲轉發
狀態,就達到本實驗的要求(SW2 的VLAN3,VLAN4 到SW1 走線路2)
之因此SW2 的F0/24 爲blocking 狀態,是由於相對於VLAN3,VLAN4 來講在經過生成樹決策的第4
步時,F0/23 端口號小於F0/23,小的優先,Lowest sender port ID 當兩臺交換機之間有兩條線路直連
時會用到這一項,<本實驗就是這樣>。經過以上分析,在SW2 上相對於VLAN3,VLAN4 來講,咱們能夠
更改參數,也就是在生成樹決策的第2 步就能夠作出決策,即便用Lowest path cost to root bridge
(到達根的最小路徑開銷)。
在SW2 上相對於VLAN3,VLAN4 更F0/24 到根(SW1)的花費,目前爲19,F0/23 到根也爲19,咱們更
改F0/24 端口到達SW1 的花費爲18 就能夠知足本實驗的要求.
在SW2 上配置如下命令:
SW2(config)#interface fastEthernet 0/24
SW2(config-if)#spanning-tree vlan 3-4 cost 18
查看更改的配置:
SW2#show run int f0/24
interface FastEthernet0/24
spanning-tree vlan 3-4 cost 18
end
作上以上配置後在SW2 上查看當前的VLAN3,VLAN4 的生成樹狀態:
SW2#show spanning-tree vlan 3
VLAN0003
Spanning tree enabled protocol ieee
Root ID Priority 32771
Address 0008.20ff.6400
Cost 18
Port 24 (FastEthernet0/24)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32771 (priority 32768 sys-id-ext 3)
Address 000d.bce7.5940
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Altn BLK 19 128.23 P2p
Fa0/24 Root FWD 18 128.24 P2p
SW2#show spanning-tree vlan 4
VLAN0004
Spanning tree enabled protocol ieee
Root ID Priority 32772
Address 0008.20ff.6400
Cost 18
Port 24 (FastEthernet0/24)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32772 (priority 32768 sys-id-ext 4)
Address 000d.bce7.5940
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 300
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/23 Altn BLK 19 128.23 P2p
Fa0/24 Root FWD 18 128.24 P2p
經過命令show spanning-tree vlan 3 , show spanning-tree vlan 4 查看,咱們發現F0/23 爲blocking 狀
態,SW2 的VLAN3,VLAN4 到達SW1 的經過F0/24 到達,也就是走線路2,實如今本實驗的要求。最終線
路1,線路2 流量走勢圖: