pvst的实验解析
PVST: Per-VLAN Spanning Tree(每VLAN生成树)
PVST是解决在虚拟局域网上处理生成树的CISCO特有解决方案.PVST为每个虚拟局域网运行单独的生成树实例.一般情况下PVST要求在交换机之间的中继链路上运行CISCO的ISL.
每VLAN生成树 (PVST)为每个在网络中配置的VLAN维护一个生成树实例。它使用ISL中继和允许一个VLAN中继当被其它VLANs的阻塞时将一些VLANs转发。尽管PVST对待每个VLAN作为一个单独的网络,它有能力(在第2层)通过一些在主干和其它在另一个主干中的不引起生成树循环的Vlans中的一些VLANs来负载平衡通信。
试验要求:
分别将sw1和sw2的fa1/1和fa1/2封装进trunk并采用802.1q的标准
分别在sw1 和sw2上创建vlan2 vlan3
配置:
Sw1:
Router>en
Router#conf t
Router(config)#host SW1
SW1(config)#no ip do lo
SW1(config)#line cons 0
SW1(config-line)#no exec-t
SW1(config-line)#logg sync
SW1(config-line)#exi
SW1(config)#int rang fa1/1 -2
SW1(config-if-range)#sw tr encapsulation dot1q
(将fa1/1和fa1/2封装进trunk并采用802.1q的标准)
SW1(config-if-range)#sw mo tr
SW1(config-if-range)#end
SW1#vlan da
SW1(vlan)#vlan 2 (创建vlan)
VLAN 2 added:
Name: VLAN0002
SW1(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
SW1(vlan)#exi
APPLY completed.
Exiting....
Sw2配置与SW1相同
查看stp状态:
(1)SW1#show spanning-tree vlan 2
VLAN2 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address cc02.09bc.0001
Configured hello time 2, max age 20, forward delay 15
We are the root of the spanning tree (为根)
Topology change flag not set, detected flag not set
Number of topology changes 1 last change occurred 00:03:16 ago
from FastEthernet1/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 1, topology change 0, notification 0, aging 300
Port 42 (FastEthernet1/1) of VLAN2 is forwarding (处于转发状态)
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address cc02.09bc.0001
Designated bridge has priority 32768, address cc02.09bc.0001
Designated port id is 128.42, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 114, received 1
Port 43 (FastEthernet1/2) of VLAN2 is forwarding(处于转发状态)
Port path cost 19, Port priority 128, Port Identifier 128.43.
Designated root has priority 32768, address cc02.09bc.0001
Designated bridge has priority 32768, address cc02.09bc.0001
Designated port id is 128.43, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 114, received 1
SW1#show spanning-tree vlan 3
VLAN3 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address cc02.09bc.0002
Configured hello time 2, max age 20, forward delay 15
We are the root of the spanning tree
Topology change flag not set, detected flag not set
Number of topology changes 1 last change occurred 00:05:23 ago
from FastEthernet1/1
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
Port 42 (FastEthernet1/1) of VLAN3 is forwarding
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address cc02.09bc.0002
Designated bridge has priority 32768, address cc02.09bc.0002
Designated port id is 128.42, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 177, received 1
Port 43 (FastEthernet1/2) of VLAN3 is forwarding
Port path cost 19, Port priority 128, Port Identifier 128.43.
Designated root has priority 32768, address cc02.09bc.0002
Designated bridge has priority 32768, address cc02.09bc.0002
Designated port id is 128.43, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 177, received 1
(2)SW2#show spanning-tree vlan 2
VLAN2 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address cc03.09bc.0001
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address cc02.09bc.0001
Root port is 43 (FastEthernet1/2), cost of root path is 19
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:07:33 ago
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
Port 42 (FastEthernet1/1) of VLAN2 is blocking
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address cc02.09bc.0001
Designated bridge has priority 32768, address cc02.09bc.0001
Designated port id is 128.43, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 0
BPDU: sent 3, received 224
Port 43 (FastEthernet1/2) of VLAN2 is forwarding
Port path cost 19, Port priority 128, Port Identifier 128.43.
Designated root has priority 32768, address cc02.09bc.0001
Designated bridge has priority 32768, address cc02.09bc.0001
Designated port id is 128.42, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 3, received 224
SW2#show spanning-tree vlan 3
VLAN3 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, address cc03.09bc.0002
Configured hello time 2, max age 20, forward delay 15
Current root has priority 32768, address cc02.09bc.0002
Root port is 43 (FastEthernet1/2), cost of root path is 19
Topology change flag not set, detected flag not set
Number of topology changes 0 last change occurred 00:09:06 ago
Times: hold 1, topology change 35, notification 2
hello 2, max age 20, forward delay 15
Timers: hello 0, topology change 0, notification 0, aging 300
Port 42 (FastEthernet1/1) of VLAN3 is blocking (处于阻塞状态)
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address cc02.09bc.0002
Designated bridge has priority 32768, address cc02.09bc.0002
Designated port id is 128.43, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 0
BPDU: sent 3, received 271
Port 43 (FastEthernet1/2) of VLAN3 is forwarding
Port path cost 19, Port priority 128, Port Identifier 128.43.
Designated root has priority 32768, address cc02.09bc.0002
Designated bridge has priority 32768, address cc02.09bc.0002
Designated port id is 128.42, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 3, received 271
通过查看STP状态会发现,sw2上的vlan2和vlan3在trunk口FA1/1上都是blocking (处于阻塞状态)
这样就会造成链路的堵塞,vlan2和vlan3所有的负担都承载在上面一条链路上,这时需做负载平衡
只需将sw2上vlan2下的fa1/1口从blocking变为 forwarding,只要在根上设置相关参数
SW1(config)#int fa1/2
SW1(config-if)#spanning-tree vlan 2 port-priority 100
更改端口的优先级
再查看sw2的fa1/1状态:
SW2#sh spanning-tree int fa1/1
Port 42 (FastEthernet1/1) of VLAN1 is blocking
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address cc02.09bc.0000
Designated bridge has priority 32768, address cc02.09bc.0000
Designated port id is 128.43, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 0
BPDU: sent 2, received 626
Port 42 (FastEthernet1/1) of VLAN2 is forwarding (变为转发状态了)
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address cc02.09bc.0001
Designated bridge has priority 32768, address cc02.09bc.0001
Designated port id is 100.43, designated path cost 0
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 4, received 620
Port 42 (FastEthernet1/1) of VLAN3 is blocking
Port path cost 19, Port priority 128, Port Identifier 128.42.
Designated root has priority 32768, address cc02.09bc.0002
Designated bridge has priority 32768, address cc02.09bc.0002
Designated port id is 128.43, designated path cost 0
这样的修改不影响valn3,让vlan2的数据都从fa1/1口走,让vlan3的数据都从FA1/2走,这样就完成的负载平衡