zoukankan      html  css  js  c++  java
  • 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
    ......


    测试效果:

  • 相关阅读:
    论.Net 2.0消失的虚拟内存空间
    检查IE版本的方法
    升级.Net 4.0遇到的两个问题
    关于ID生成算法
    探秘.Net 4.0的StringBuilder实现
    关于填充DataTable的效率问题
    [已解决]请教:时间格式“2008109公元 10:43:27,AM”,这种时间格式是该怎么恢复默认设置
    请教:c#中的窗体怎么才能像c++的那窗体一样按键后可以调出输入法?
    在access中执行SQL,SQL中包含IIF,取出来的结果集字符串被截断了,请教各位大侠,这个是为什么呀?谢谢!
    请教:PL/SQL中执行to_date(to_char(a.lastupdatedate, 'YYYYMMDD HH24:MI:SS'),'YYYYMMDD HH24:MI:SS') ,上午12点整为什么格式化出来没有时分秒?
  • 原文地址:https://www.cnblogs.com/mchina/p/2591973.html
Copyright © 2011-2022 走看看