生成树协议
拓扑图:
 

STP(生成树协议)_休闲

SwA的配置
Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int ra fa0/1-4
Switch(config-if-range)#sw
Switch(config-if-range)#switchport mod
Switch(config-if-range)#switchport mode tr
Switch(config-if-range)#switchport mode tru把端口设为truck模式
% Unrecognized command
 <1-6> Channel group number
Switch(config-if-range)#channel-group 1
Switch(config-if-range)#channel-group 1 mode
Switch(config-if-range)#channel-group 1 mode on
Switch(config-if-range)#channel-group 1 mode on
Switch#vlan database
Switch(vlan)#vlan 2
VLAN 2 added:
    Name: VLAN0002
Switch(vlan)#vlan 3
VLAN 3 added:
    Name: VLAN0003
Switch(vlan)#vlan 4
VLAN 4 added:
    Name: VLAN0004
Switch(vlan)#
Switch(vlan)#vtp server
Device mode already VTP SERVER.
Switch(vlan)#vtp
Switch(vlan)#vtp do
Switch(vlan)#vtp domain hong
Changing VTP domain name from NULL to hong
Switch(vlan)#vtp
Switch(vlan)#vtp pas
Switch(vlan)#vtp password hong
Setting device VLAN database password to hong
Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#sp
Switch(config)#spanning-tree vlan 2 root
Switch(config)#spanning-tree vlan 2 root pri
Switch(config)#spanning-tree vlan 2 root primary  vlan 2设为桥根
Switch(config)#spanning-tree vlan 1 root primary  vlan 1设为桥根
 
Switch(config)#end
Switch#
SWA#show spanning-tree summary
Root bridge for: VLAN1, VLAN2.
SWB的配置
Switch>
Switch>en
Switch#conf
Switch(config)#int ra fa0/1-4
Switch(config-if-range)#sw
Switch(config-if-range)#switchport mod
Switch(config-if-range)#switchport mode tr
 
Switch(config-if-range)#
Switch(config-if-range)#ch
Switch(config-if-range)#channel-g
Switch(config-if-range)#channel-group 1 mod
Switch(config-if-range)#channel-group 1 mode on
 
Switch(vlan)#vtp se
Switch(vlan)#vtp server
Device mode already VTP SERVER.
Switch(vlan)#vtp do
Switch(vlan)#vtp domain hong
Domain name already set to hong.
Switch(vlan)#vtp pa
Switch(vlan)#vtp password
% Incomplete command.
Switch(vlan)#vtp password hong
Setting device VLAN database password to hong
Switch(vlan)#
Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#sp
Switch(config)#spanning-tree vlan
Switch(config)#spanning-tree vlan 3 ro
Switch(config)#spanning-tree vlan 3 root pri
Switch(config)#spanning-tree vlan 3 root primary
Switch(config)#spanning-tree vlan 4 root primary
Switch(config)#end
Switch#
SWB#show spanning-tree summary
Root bridge for: VLAN3, VLAN4.
SWC的配置
Switch(config)#int ra fa0/1-2
Switch(config-if-range)#sw
Switch(config-if-range)#switchport mod
Switch(config-if-range)#switchport mode tr
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#end
Switch#
Switch(vlan)#vtp cl
Switch(vlan)#vtp client
Setting device to VTP CLIENT mode.
Switch(vlan)#vtp do
Switch(vlan)#vtp domain hong
Domain name already set to hong.
Switch(vlan)#vtp pas
Switch(vlan)#vtp password hong
Setting device VLAN database password to hong
Switch(vlan)#
Switch(config)#int fa0/3
Switch(config-if)#sw
Switch(config-if)#switchport ac
Switch(config-if)#switchport access vlan 2
Switch(config-if)#int ra fa0/1-13
Switch(config-if-range)#spa
Switch(config-if-range)#spanning-tree por
Switch(config-if-range)#spanning-tree portfast
SWD的配置
Switch>
Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#int ra fa0/1-2
Switch(config-if-range)#sw
Switch(config-if-range)#switchport mod
Switch(config-if-range)#switchport mode tr
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#end
Switch#
Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
 as VLAN database mode is being deprecated. Please consult user
 documentation for configuring VTP/VLAN in config mode.
 
Switch(vlan)#vtp cl
Switch(vlan)#vtp client
Setting device to VTP CLIENT mode.
Switch(vlan)#vtp do
Switch(vlan)#vtp domain hong
Domain name already set to hong.
Switch(vlan)#vtp pas
Switch(vlan)#vtp password hong
Setting device VLAN database password to hong
Switch(vlan)#end
Switch#sho vtp status
VTP Version                     : 2
Configuration Revision          : 3
Maximum VLANs supported locally : 255
Number of existing VLANs        : 8
VTP Operating Mode              : Client
VTP Domain Name                 : hong
VTP Pruning Mode                : Disabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0x4F 0x23 0x6C 0x94 0xF8 0x68 0x79 0xF1
Configuration last modified by 0.0.0.0 at 3-1-93 00:17:28
Switch#
Switch#sho vlan bri
Switch#sho vlan brief
 
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    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, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig1/1, Gig1/2
2    VLAN0002                         active   
3    VLAN0003                         active   
4    VLAN0004                         active   
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active   
Switch#
Switch(config)#int fa0/3
Switch(config-if)#sw
Switch(config-if)#switchport ac
Switch(config-if)#switchport access vlan 2
Switch(config-if)#int ra fa0/1-13
Switch(config-if-range)#spa
Switch(config-if-range)#spanning-tree por
Switch(config-if-range)#spanning-tree portfast