LAB5:Spanning Tree Protocol (STP 802.1D)
一、实验目的
1、掌握标准生成树(STP)的应用及配置
二、实验内容
拓扑图:
需求:
1、确保PC和服务器间通信路径最短 (注:橙色端口为阻塞端口)
三、实验配置
配置:
1、查看生成树
SW1#show spanning-tree (查看生成树)
VLAN0001 (VLAN1 的生成树实例)
Spanning tree enabled protocol ieee (生成树的模式为802.1D标准生成树)
Root ID Priority 32769 (指示生成树根的Root ID,SW1为根桥)
Address 0004.9A8B.7C69
This bridge is the root (指示此交换机为Vlan1生成树的根)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec (生成树计时器)
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) (指示此交换机的BridgeID)
Address 0004.9A8B.7C69
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/21 Desg FWD 19 128.21 P2p (端口角色、状态及端口优先级)
Fa0/22 Desg FWD 19 128.22 P2p
SW3#show spanning-tree (SW3为非根桥)
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 0004.9A8B.7C69
Cost 19
Port 22(FastEthernet0/22)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 00E0.A39D.C5A3
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/22 Root FWD 19 128.22 P2p
Fa0/24 Desg FWD 19 128.24 P2p
Gi0/1 Altn BLK 4 128.25 P2p
Gi0/2 Desg FWD 4 128.26 P2p
2、根据需求,应该让SW3为STP的Root最为合理
SW3(config)#spanning-tree vlan 1 root primary (修改SW3的VLAN1生成树实例为根桥)
验证:
SW3#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 24577
Address 00E0.A39D.C5A3
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 24577 (priority 24576 sys-id-ext 1)
Address 00E0.A39D.C5A3
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/22 Desg FWD 19 128.22 P2p
Fa0/24 Desg FWD 19 128.24 P2p
Gi0/1 Desg FWD 4 128.25 P2p
Gi0/2 Desg FWD 4 128.26 P2p
四、应用场景
STP协议对用户是透明的。自动会选举出block端口,阻止环路。但我们一定注意STP选举有可能选择出的路径不是最优的。这时候我们就要调整STP参数。达到流量优化的目的