网络拓朴:
 
 
实验目标:
 
目标1.在SWITCH1和SWITCH2之间开启以太网通道
目标2.使用VTP分别在各个交换机上配置VLAN2,VLAN3,VLAN4四个VLAN【包含VLAN1】
目标3.将SWITCH1配置为VLAN1、VLAN3的根桥,VLAN2、VLAN4的次根桥   
      将SWITCH2配置为VLAN2、VLAN4的根桥,VLAN1、VLAN3的次根桥
目标4.关闭所有SWITCH1端口观察VLAN1、VLAN3的根桥变换.
目标5.查看SWITCH3的F0/1口是否对于VLAN4是BLOCK的,并实现VLAN3在SWITCH3上的上  行链路切换
 
 
实验环境描述:
 
  三台交换机形成局域网交换网络,通过配置PVST<每VLAN生成树>实现VLAN负载分担.
 
实验步骤:
 
1. 在所有的交换机端口上开启Trunk模式,开启VTP。(配置第一章已做
2. SW1和SW2之间开启以网通道

sw1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
sw1(config)#interface range f0/14 - 15
sw1(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel1
sw1#show ip in br          
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  up                    down   
FastEthernet0/1            unassigned      YES unset  up                    up     
FastEthernet0/2            unassigned      YES unset  up                    up     
FastEthernet0/3            unassigned      YES unset  up                    up     
FastEthernet0/4            unassigned      YES unset  up                    down   
FastEthernet0/5            unassigned      YES unset  up                    down   
FastEthernet0/6            unassigned      YES unset  up                    down   
FastEthernet0/7            unassigned      YES unset  up                    down   
FastEthernet0/8            unassigned      YES unset  up                    down   
FastEthernet0/9            unassigned      YES unset  up                    down   
FastEthernet0/10           unassigned      YES unset  up                    down   
FastEthernet0/11           unassigned      YES unset  up                    down   
FastEthernet0/12           unassigned      YES unset  up                    down   
FastEthernet0/13           unassigned      YES unset  up                    down   
FastEthernet0/14           unassigned      YES unset  up                    up     
FastEthernet0/15           unassigned      YES unset  up                    up     
Port-channel1              unassigned      YES unset  up                    up     
Vlan1                      unassigned      YES unset  up                    up     

sw2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
sw2(config)#interface range f0/14 - 15
sw2(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel1
sw2(config-if-range)#
 
sw2#show ip in br
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  up                    down   
FastEthernet0/1            unassigned      YES unset  up                    up     
FastEthernet0/2            unassigned      YES unset  up                    up     
FastEthernet0/3            unassigned      YES unset  up                    up     
FastEthernet0/4            unassigned      YES unset  up                    down   
FastEthernet0/5            unassigned      YES unset  up                    down   
FastEthernet0/6            unassigned      YES unset  up                    down   
FastEthernet0/7            unassigned      YES unset  up                    down   
FastEthernet0/8            unassigned      YES unset  up                    down   
FastEthernet0/9            unassigned      YES unset  up                    down   
FastEthernet0/10           unassigned      YES unset  up                    down   
FastEthernet0/11           unassigned      YES unset  up                    down   
FastEthernet0/12           unassigned      YES unset  up                    down   
FastEthernet0/13           unassigned      YES unset  up                    down   
FastEthernet0/14           unassigned      YES unset  up                    up     
FastEthernet0/15           unassigned      YES unset  up                    up     
Port-channel1              unassigned      YES unset  up                    up     
Vlan1                      unassigned      YES unset  up                    up     

3. VTP分别在各个交换机上配置VLAN2,VLAN3,VLAN4四个VLAN【包含VLAN1】如下所示:
sw1#vl da
sw1(vlan)#vlan 2 name v2
VLAN 2 added:
    Name: v2
sw1(vlan)#apply
APPLY completed.
sw1(vlan)#vlan 3 name v3
VLAN 3 added:
    Name: v3
sw1(vlan)#apply
APPLY completed.
sw1(vlan)#vlan 4 name v4
VLAN 4 added:
    Name: v4
sw1(vlan)#apply
APPLY completed.
sw1(vlan)#exit
APPLY completed.
Exitin
 
sw1#show vlan-switch
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13
2    v2                               active   
3    v3                               active   
4    v4                               active   
1002 fddi-default                     active   
1003 trcrf-default                    active   
1004 fddinet-default                  active   
1005 trbrf-default                    active   
 
测试其他的交换机有没有学的VLAN信息
 
sw2#show vlan-switch
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/4, Fa0/5, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13
2    v2                               active   
3    v3                               active   
4    v4                               active   
1002 fddi-default                     active   
1003 trcrf-default                    active   
1004 fddinet-default                  active   
1005 trbrf-default                    active   

sw3#show vlan-switch
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15
2    v2                               active   
3    v3                               active   
4    v4                               active   
1002 fddi-default                     active   
1003 trcrf-default                    active   
1004 fddinet-default                  active   
1005 trbrf-default                    active  

sw4#show vlan-switch
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15
2    v2                               active   
3    v3                               active   
4    v4                               active   
1002 fddi-default                     active   
1003 trcrf-default                    active   
1004 fddinet-default                  active   
1005 trbrf-default                    active   

sw5#show vlan-switch
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/3, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15
2    v2                               active   
3    v3                               active   
4    v4                               active   
1002 fddi-default                     active   
1003 trcrf-default                    active   
1004 fddinet-default                  active   
1005 trbrf-default                    active   

4.将SWITCH1配置为VLAN1、VLAN3的根桥,VLAN2、VLAN4的次根桥   
   将SWITCH2配置为VLAN2、VLAN4的根桥,VLAN1、VLAN3的次根桥
 
SW1:
sw1(config)#spanning-tree vlan 1 root primary
 VLAN 1 bridge priority set to 8192
 VLAN 1 bridge max aging time unchanged at 20
 VLAN 1 bridge hello time unchanged at 2
 VLAN 1 bridge forward delay unchanged at 15
sw1(config)#spanning-tree vlan 3 root primary
 VLAN 3 bridge priority set to 8192
 VLAN 3 bridge max aging time unchanged at 20
 VLAN 3 bridge hello time unchanged at 2
 VLAN 3 bridge forward delay unchanged at 15
sw1(config)#spanning-tree vlan 2 root secondary
 VLAN 2 bridge priority set to 16384
 VLAN 2 bridge max aging time unchanged at 20
 VLAN 2 bridge hello time unchanged at 2
 VLAN 2 bridge forward delay unchanged at 15
sw1(config)#spanning-tree vlan 4 root secondary
 VLAN 4 bridge priority set to 16384
 VLAN 4 bridge max aging time unchanged at 20
 VLAN 4 bridge hello time unchanged at 2
 VLAN 4 bridge forward delay unchanged at 15
 
SW2:
sw2(config)#spanning-tree vlan 2 root primary
 VLAN 2 bridge priority set to 8192
 VLAN 2 bridge max aging time unchanged at 20
 VLAN 2 bridge hello time unchanged at 2
 VLAN 2 bridge forward delay unchanged at 15
sw2(config)#spanning-tree vlan 4 root primary
 VLAN 4 bridge priority set to 8192
 VLAN 4 bridge max aging time unchanged at 20
 VLAN 4 bridge hello time unchanged at 2
 VLAN 4 bridge forward delay unchanged at 15
sw2(config)#spanning-tree vlan 1 root secondary
 VLAN 1 bridge priority set to 16384
 VLAN 1 bridge max aging time unchanged at 20
 VLAN 1 bridge hello time unchanged at 2
 VLAN 1 bridge forward delay unchanged at 15
sw2(config)#spanning-tree vlan 3 root secondary
 VLAN 3 bridge priority set to 16384
 VLAN 3 bridge max aging time unchanged at 20
 VLAN 3 bridge hello time unchanged at 2
 VLAN 3 bridge forward delay unchanged at 15
sw2(config)#exit

用SW3进行测试上面的配置结果:

sw3#show spanning-tree br
VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     cc00.0b70.0000
             Cost        19
             Port        2 (FastEthernet0/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    32768
             Address     cc00.0da8.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 FWD     0  8192 cc00.0b70.0000 128.2 
FastEthernet0/2      128.3    128    19 BLK    12 16384 cc00.0234.0000 128.2 
         
VLAN2    
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     cc00.0234.0001
             Cost        19
             Port        3 (FastEthernet0/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
         
  Bridge ID  Priority    32768
             Address     cc00.0da8.0001
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
         
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 BLK    12 16384 cc00.0b70.0001 128.2 
FastEthernet0/2      128.3    128    19 FWD     0  8192 cc00.0234.0001 128.2 
         
         
VLAN3    
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     cc00.0b70.0002
             Cost        19
             Port        2 (FastEthernet0/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
         
  Bridge ID  Priority    32768
             Address     cc00.0da8.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
         
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 FWD     0  8192 cc00.0b70.0002 128.2 
FastEthernet0/2      128.3    128    19 BLK    12 16384 cc00.0234.0002 128.2 
         
         
VLAN4    
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     cc00.0234.0003
             Cost        19
             Port        3 (FastEthernet0/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
         
  Bridge ID  Priority    32768
             Address     cc00.0da8.0003
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
         
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 BLK    12 16384 cc00.0b70.0003 128.2 
FastEthernet0/2      128.3    128    19 FWD     0  8192 cc00.0234.0003 128.2 
 
5 。关闭所有SWITCH1端口观察VLAN1、VLAN3的根桥变换

sw3#show spanning-tree br
VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    16384
             Address     cc00.0234.0000
             Cost        19
             Port        3 (FastEthernet0/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    32768
             Address     cc00.0da8.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 FWD    19 32768 cc00.0da8.0000 128.2 
FastEthernet0/2      128.3    128    19 LRN     0 16384 cc00.0234.0000 128.2 
         
         
         
VLAN3    
  Spanning tree enabled protocol ieee
  Root ID    Priority    16384
             Address     cc00.0234.0002
             Cost        19
             Port        3 (FastEthernet0/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
         
  Bridge ID  Priority    32768
             Address     cc00.0da8.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
         
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 FWD    19 32768 cc00.0da8.0002 128.2 
FastEthernet0/2      128.3    128    19 LRN    0 16384 cc00.0234.0002 128.2 

  分析: 很明显VLNA 1 和VLAN 3 根网桥在向SW2学习中
         
         
6.查看SWITCH3的F0/1口是否对于VLAN4是BLOCK的
sw3#show spanning-tree br
VLAN4    
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     cc00.0234.0003
             Cost        19
             Port        3 (FastEthernet0/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
         
  Bridge ID  Priority    32768
             Address     cc00.0da8.0003
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
         
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 FWD    19 32768 cc00.0da8.0003 128.2 
FastEthernet0/2      128.3    128    19 FWD     0  8192 cc00.0234.0003 128.2 
 

7.打开SW1上所有的端口,再次用SW3查看VLAN 1 和VLAN 3的变化。

sw3#show spanning-tree br   
VLAN1
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     cc00.0b70.0000
             Cost        19
             Port        2 (FastEthernet0/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
  Bridge ID  Priority    32768
             Address     cc00.0da8.0000
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 FWD     0  8192 cc00.0b70.0000 128.2 
FastEthernet0/2      128.3    128    19 BLK    12 16384 cc00.0234.0000 128.2 

VLAN3    
  Spanning tree enabled protocol ieee
  Root ID    Priority    8192
             Address     cc00.0b70.0002
             Cost        19
             Port        2 (FastEthernet0/1)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
         
  Bridge ID  Priority    32768
             Address     cc00.0da8.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
         
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128    19 FWD     0  8192 cc00.0b70.0002 128.2 
FastEthernet0/2      128.3    128    19 BLK    12 16384 cc00.0234.0002 128.2 
         
          如上显示,当打开所有的SW1端口后,VLAN1 和 VLAN 3 根桥以转回了SW1。

8.并实现VLAN3在SWITCH3上的上行链路切换,并再次关掉所有SW1上面的端口进行验证

sw3(config)#spanning-tree uplinkfast
sw3#show spanning-tree br
VLAN3    
  Spanning tree enabled protocol ieee uplinkfast enabled
  Root ID    Priority    16384
             Address     cc00.0234.0002
             Cost        3019
             Port        3 (FastEthernet0/2)
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
         
  Bridge ID  Priority    49152
             Address     cc00.0da8.0002
             Hello Time   2 sec  Max Age 20 sec  Forward Delay 15 sec
             Aging Time 300
         
Interface                                   Designated
Name                 Port ID Prio Cost  Sts Cost  Bridge ID            Port ID
-------------------- ------- ---- ----- --- ----- -------------------- -------
FastEthernet0/1      128.2    128  3019 LRN  3019 49152 cc00.0da8.0002 128.2 
FastEthernet0/2      128.3    128  3019 FWD     0 16384 cc00.0234.0002 128.2 

分析:从上面的结果可以看到,当配置了上行速链路后,关掉SW1上所有的端口后,VLAN3上阻塞的端口不用经过侦听和学习,而直接进入了转发状态。