Packet Tracer 5.0实验(五) 快速生成树配置

一、实验目标

  • 理解生成树协议工作原理;
  • 掌握快速生成树协议RSTP基本配置方法;

 

二、实验背景

学校为了开展计算机教学和网络办公,建立了一个计算机教室和一个校办公区,这两处的计算机网络通过两台交换机互相连接组成内部校园网,为了提高网络的可靠性,作为网络管理员,你要用2条链路将交换机互连,现要求在交换机上做适当的配置,使网络避免环路。

 

三、技术原理

生成树协议(spanning-tree),作用是在交换网络中提供冗余备份链路,并且解决交换网络中的环路问题;

生成树协议是利用SPA算法,在存在交换环路的网络中生成一个没有环路的树形网络。运用该算法将交换网络的冗余备份链路从逻辑上断开,当主链路出现故障时,能够自动的切换到备份链路,保证数据的正常转发;

生成树协议版本:STP、RSTP(快速生成树)、MSTP(多生成树协议);

生成树协议的特点是收敛时间长,从主要链路出现故障到切换至备份链路需要50秒的时间;

快速生成树协议在生成树协议的基础上增加了两种端口角色:替换端口和备份端口,分别做为根端口和指定端口的冗余端口。当根端口或指定端口出现故障时,冗余端口不需要经过50秒的收敛时间,可以直接切换到替换端口或备份端口,从而实现RSTP协议小于1秒的快速收敛。

 

四、实验步骤

实验拓扑

默认情况下STP协议启用的,通过两台交换机之间传送BPDU协议数据单元,选出根交换机、根端口等,以便确定端口的转发状态。上图中标记为橙色的端口处于block堵塞状态。

设置RSTP

查看交换机 show spanning-tree 状态,了解根交换机和根端口情况;

通过更改交换机生成树的优先级spanning-tree vlan * priority 4096 可以变化根交换机的角色;

S1:

Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname S1
S1(config)#end
S1#
%SYS-5-CONFIG_I: Configured from console by console

S1#show spanning-tree                                    //查看交换机spanning-tree 状态
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0060.5C36.5620
             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     0060.7078.8BDE
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time  20

Interface        Role Sts Cost      Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/10           Desg FWD 19        128.10   P2p
Fa0/1            Root FWD 19        128.1    P2p
Fa0/2            Altn BLK 19        128.2    P2p

S1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
S1(config)#interface fa0/10
S1(config-if)#switchport access vlan 10                            //将fa0/10划分到vlan 10
% Access VLAN does not exist. Creating vlan 10
S1(config-if)#exit
S1(config)#interface range fa0/1 - 2                               //设置fa0/1,fa0/2端口状态为trunk模式
S1(config-if-range)#switchport mode trunk 

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up


%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

S1(config-if-range)#exit
S1(config)#spanning-tree mode ?                                    //设置spanning-tree 为RSTP模式
  pvst        Per-Vlan spanning tree mode
  rapid-pvst  Per-Vlan rapid spanning tree mode
S1(config)#spanning-tree mode rapid-pvst 
S1(config)#

S2:

Switch>en
Switch#show spanning-tree 
VLAN0001
  Spanning tree enabled protocol ieee
  Root ID    Priority    32769
             Address     0060.5C36.5620
             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     0060.5C36.5620
             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
Fa0/10           Desg FWD 19        128.10   P2p

Switch#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

Switch#
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname S2
S2(config)#interface fa0/10
S2(config-if)#switchport access vlan 10
% Access VLAN does not exist. Creating vlan 10
S2(config-if)#exit
S2(config)#interface range fa0/1 - 2
S2(config-if-range)#switchport mode trunk 
S2(config-if-range)#exit
S2(config)#spanning-tree mode rapid-pvst 
S2(config)#

 

五、测试

当主链路处于down状态时,能够自动的切换到备份链路,保证数据的正常转发。

在S2上shutdown 掉 fa0/1

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int
Switch(config)#interface fa0/1
Switch(config-if)#shu
Switch(config-if)#shutdown                                         //shutdown fa0/1端口

Switch(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to administratively down

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down


Switch#show spanning-tree
VLAN0001
  Spanning tree enabled protocol rstp
  Root ID    Priority    32769
             Address     0001.63E2.4A7A
             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.63E2.4A7A
             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    32778
             Address     0001.63E2.4A7A
             This bridge is the root
             Hello Time  2 sec  Max Age 20 sec  Forward Delay 15 sec

  Bridge ID  Priority    32778  (priority 32768 sys-id-ext 10)
             Address     0001.63E2.4A7A
             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
Fa0/10           Desg FWD 19        128.10   P2p

Switch#

 PC1:

PC>ipconfig

IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1

PC>ping -t 192.168.1.3

Pinging 192.168.1.3 with 32 bytes of data:

Reply from 192.168.1.3: bytes=32 time=78ms TTL=128
Reply from 192.168.1.3: bytes=32 time=94ms TTL=128
Reply from 192.168.1.3: bytes=32 time=78ms TTL=128
Reply from 192.168.1.3: bytes=32 time=78ms TTL=128
Reply from 192.168.1.3: bytes=32 time=78ms TTL=128
Reply from 192.168.1.3: bytes=32 time=94ms TTL=128
Reply from 192.168.1.3: bytes=32 time=93ms TTL=128
Reply from 192.168.1.3: bytes=32 time=93ms TTL=128
Reply from 192.168.1.3: bytes=32 time=62ms TTL=128
Reply from 192.168.1.3: bytes=32 time=94ms TTL=128
Reply from 192.168.1.3: bytes=32 time=79ms TTL=128
Reply from 192.168.1.3: bytes=32 time=94ms TTL=128
......


测试效果:

posted @ 2012-07-15 21:25  Merlin_Tang  阅读(28918)  评论(4编辑  收藏  举报