实验:RSTP快速生成树配置
1.实验目标
� 理解生成树协议工作原理;
� 掌握快速生成树协议RSTP基本配置方法;
� 实验背景 学校为了开展计算机教学和网络办公,建立了一个计算机教室和一个校办公区,这两处的计算机网络通过两台交换机互连组成内部校园网,为了提高网络的可靠性,作为网络管理员,你要用2条链路将交换机互连,现要求在交换机上做适当配置,使网络避免环路。
2.生成树配置技术原理 � 生成树协议(spanning-tree),作用是在交换网络中提供冗余 备份链路,并且解决交换网络中的环路问题 ;
� 生成树协议是利用SPA算法,在存在交换环路的网络中生成一个没有环路的树形网络。运用该算法将交换网络的冗余备份链路从逻辑上断开,当主链路出现故障时,能够自动的切换到备份链路,保证数据的正常转发;
� 生成树协议版本:STP、RSTP(快速生成树)、MSTP(多生成树协议)
� 生成树协议的特点收敛时间长。从主要链路出现故障到切换至 备份链路需要50秒的时间。
� 快速生成树在生成树协议的基础上增加了两种端口角色:替换 端口和备份端口,分别做为根端口和指定端口的冗余端口。当 根端口或指定端口出现故障时,冗余端口不需要经过 50秒的收 敛时间,可以直接切换到替换端口或备份端口,从而实现 RSTP 协议小于1秒的快速收敛。
3.实验步骤
� 新建packet tracer 拓扑图(如图)
� 默认情况下STP协议启用的。通过两台交换 机之间传送BPDU协议数据单元,选出根交 换机、根端口等,以便确定端口的转发状态。 上图中标记为黄色的端口处于block堵塞状态。
� 设置rstp;
� 查看交换机show spanning-tree状态,了解 根交换机和根端口情况;
� 通过更改交换机生成树的优先级spanningtree vlan * priority 4096 可以变化根交换机 的角色。
� 测试。当主链路处于down状态时候,能够自动的切换到备份链路,保证数据的正常转发。
查看SW1生成树信息 Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#host
Switch(config)#hostname SW1 SW1(config)#exit SW1#show sp
SW1#show spanning-tree VLAN0001
Spanning tree enabled protocol ieee Root ID Priority 32769 //优先级 Address 0001.C769.D1C0
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 0001.C769.D1C0
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20
Interface Role Sts Cost Prio.Nbr Type //端口信息 ---------------- ---- --- --------- -------- -------------------------------- Fa0/24 Desg FWD 19 128.24 P2p Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
SW1配置 同SW2一样
查看SW2生成树信息 SW2#show spanning-tree VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769 //根网桥信息 Address 0001.C769.D1C0
Cost 19 //cost花费 19 Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 00E0.B023.E7A4
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20
Interface Role Sts Cost Prio.Nbr Type //端口信息 ---------------- ---- --- --------- -------- -------------------------------- Fa0/1 Root FWD 19 128.1 P2p Fa0/2 Altn BLK 19 128.2 P2p Fa0/24 Desg FWD 19 128.24 P2p
配置SW2
SW2(config)#int f0/24 SW2(config-if)#sw
SW2(config-if)#switchport a
SW2(config-if)#switchport access vlan 10
% Access VLAN does not exist. Creating vlan 10 //f0/24划分到vlan SW2(config-if)#exit SW2(config)#int ra
SW2(config)#int range f0/1-2 SW2(config-if-range)#sw
SW2(config-if-range)#switchport m
SW2(config-if-range)#switchport mode t
SW2(config-if-range)#switchport mode trunk //f0/1 f0/2配置trunk SW2(config-if-range)#sp SW2(config-if-range)#exit SW2(config)#spa
SW2(config)#spanning-tree m
SW2(config)#spanning-tree mode r
SW2(config)#spanning-tree mode rapid-pvst //定义生成树类型 SW2(config)#exit SW2#
%SYS-5-CONFIG_I: Configured from console by console
SW2#show spa
SW2#show spanning-tree VLAN0001
Spanning tree enabled protocol rstp Root ID Priority 32769
Address 0001.C769.D1C0 Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 00E0.B023.E7A4
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20
Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/1 Root LRN 19 128.1 P2p Fa0/2 Altn BLK 19 128.2 P2p
VLAN0010
Spanning tree enabled protocol rstp Root ID Priority 32778
Address 0001.C769.D1C0 Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32778 (priority 32768 sys-id-ext 10) SW2#
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z. SW2(config)#int f0/1 SW2(config-if)#shu
SW2(config-if)#shutdown
当主链路处于down状态时候,能够 自动的切换到备份链路,保证数据的正常转发。 在SW2关掉fa0/1端口如下图
在vlan2 上更改它的生成树优先级为4096,并查看生成树看结果,SW2变成了根交换机
SW2(config)#spa
SW2(config)#spanning-tree vlan 1 p
SW2(config)#spanning-tree vlan 1 priority 4096 SW2(config)#exit SW2#
%SYS-5-CONFIG_I: Configured from console by console
SW2#show spanning-tree VLAN0001
Spanning tree enabled protocol rstp Root ID Priority 4097
Address 00E0.B023.E7A4 This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4097 (priority 4096 sys-id-ext 1) Address 00E0.B023.E7A4
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20
Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
VLAN0010
Spanning tree enabled protocol rstp Root ID Priority 4106
Address 00E0.B023.E7A4 This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 4106 (priority 4096 sys-id-ext 10) Address 00E0.B023.E7A4
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec --More-- SW2#
%SYS-5-CONFIG_I: Configured from console by console show
% Incomplete command.
实验心得:一正一副,一主一次关系。
因篇幅问题不能全部显示,请点此查看更多更全内容