跨交换机的VLAN配置实验_VLAN配置实验
跨交换机的VLAN配置实验_休闲_02
SW1:
添加VLAN
SW1#vlan database
SW1(vlan)#vlan 10
VLAN 10 added:
    Name: VLAN0010
SW1(vlan)#vlan 20
VLAN 20 added:
    Name: VLAN0020
SW1(vlan)#vlan 30
VLAN 30 added:
    Name: VLAN0030
SW1(vlan)#vlan 40
VLAN 40 added:
    Name: VLAN0040
SW1(vlan)#vlan 50
VLAN 50 added:
    Name: VLAN0050
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#show vlan-sw brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/1, Fa0/2, 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
10   VLAN0010                         active   
20   VLAN0020                         active   
30   VLAN0030                         active   
40   VLAN0040                         active   
50   VLAN0050                         active   

1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active
设置中继并配置以太通道捆绑
SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#interface range fastethernet0/1 - 4
SW1(config-if-range)#switchport mode trunk
*Mar  1 01:12:29.463: %DTP-5-TRUNKPORTON: Port Fa0/1-4 has become dot1q trunk
SW1(config-if-range)#switchport trunk encapsulation dot1q
SW1(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel1
SW1(config-if-range)#
*Mar  1 01:12:45.775: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1
*Mar  1 01:12:45.991: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po1
*Mar  1 01:12:46.159: %EC-5-BUNDLE: Interface Fa0/3 joined port-channel Po1
*Mar  1 01:12:46.339: %EC-5-BUNDLE: Interface Fa0/4 joined port-channel Po1
*Mar  1 01:12:48.487: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
SW1(config-if-range)#int range f0/5 - 8
SW1(config-if-range)#switchport mode trunk
*Mar  1 01:13:15.699: %DTP-5-TRUNKPORTON: Port Fa0/5-8 has become dot1q trunk
SW1(config-if-range)#switchport trunk encapsulation dot1q
SW1(config-if-range)#channel-group 2 mode on
Creating a port-channel interface Port-channel2
SW1(config-if-range)#
*Mar  1 01:13:22.123: %EC-5-BUNDLE: Interface Fa0/5 joined port-channel Po2
*Mar  1 01:13:22.411: %EC-5-BUNDLE: Interface Fa0/6 joined port-channel Po2
*Mar  1 01:13:22.591: %EC-5-BUNDLE: Interface Fa0/7 joined port-channel Po2
*Mar  1 01:13:22.795: %EC-5-BUNDLE: Interface Fa0/8 joined port-channel Po2
SW1(config-if-range)#
*Mar  1 01:13:24.831: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel2, changed state to up
SW1(config-if-range)#end
SW1#show etherchannel summary
Flags:  D - down        P - in port-channel
        I - stand-alone s - suspended
        R - Layer3      S - Layer2
        U - in use
Group Port-channel  Ports
-----+------------+-----------------------------------------------------------
1     Po1(SU)     Fa0/1(P)   Fa0/2(P)   Fa0/3(P)   Fa0/4(P)  
2     Po2(SU)     Fa0/5(P)   Fa0/6(P)   Fa0/7(P)   Fa0/8(P) 
 
配置VTP域:
SW1#vlan database
SW1(vlan)#vtp server
Device mode already VTP SERVER.
SW1(vlan)#vtp domain TK
Changing VTP domain name from NULL to TK
SW1(vlan)#vtp password cisco
Setting device VLAN database password to cisco.
SW1(vlan)#vtp pruning
Pruning switched ON
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#show vtp status
VTP Version                     : 2
Configuration Revision          : 2
Maximum VLANs supported locally : 256
Number of existing VLANs        : 10
VTP Operating Mode              : Server
VTP Domain Name                 : TK
VTP Pruning Mode                : Enabled
VTP V2 Mode                     : Disabled
VTP Traps Generation            : Disabled
MD5 digest                      : 0xAA 0x90 0x65 0x7A 0x72 0x0C 0x31 0x6A
Configuration last modified by 0.0.0.0 at 3-1-02 01:15:38
Local updater ID is 0.0.0.0 (no valid interface found)
配置以太通道不承载vlan 40和vlan50的流量:
SW1(config)#int range f0/1 - 4
SW1(config-if-range)#switchport trunk allowed vlan remove 40
SW1(config-if-range)#switchport trunk allowed vlan remove 50
SW1#show int f0/1 switchport

Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: down (suspended member of bundle Po1)
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: 1-39,41-49,51-1005
Trunking VLANs Active: none
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#int range f0/5 - 8
SW1(config-if-range)#switchport trunk allowed vlan remove 40
SW1(config-if-range)#switchport trunk allowed vlan remove 50
SW1(config-if-range)#end
SW1#show int f0/5 switchport

Name: Fa0/5
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: down (suspended member of bundle Po2)
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: 1-39,41-49,51-1005
Trunking VLANs Active: none
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
SW2:
设置中继并配置以太通道捆绑:
SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW2(config)#int range f0/1 - 4
SW2(config-if-range)#switchport mode trunk

*Mar  1 01:16:14.267: %DTP-5-TRUNKPORTON: Port Fa0/1-4 has become dot1q trunk
SW2(config-if-range)#switchport trunk encapsulation dot1q
SW2(config-if-range)#channel-group 1 mode on

Creating a port-channel interface Port-channel1
SW2(config-if-range)#
*Mar  1 01:16:20.703: %EC-5-BUNDLE: Interface Fa0/1 joined port-channel Po1
*Mar  1 01:16:20.847: %EC-5-BUNDLE: Interface Fa0/2 joined port-channel Po1
*Mar  1 01:16:20.991: %EC-5-BUNDLE: Interface Fa0/3 joined port-channel Po1
*Mar  1 01:16:21.111: %EC-5-BUNDLE: Interface Fa0/4 joined port-channel Po1
*Mar  1 01:16:23.447: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
SW2(config-if-range)#end 
配置VTP域:
SW2#vlan database
SW2(vlan)#vtp client
Setting device to VTP CLIENT mode.
SW2(vlan)#vtp domain TK
Changing VTP domain name from NULL to TK
SW2(vlan)#vtp password cisco
Setting device VLAN database password to cisco.
SW2(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
SW2#show vlan-sw brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/15
10   VLAN0010                         active   
20   VLAN0020                         active   
30   VLAN0030                         active   
40   VLAN0040                         active   
50   VLAN0050                         active  
 
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active
端口f0/11-f0/15分配到VLAN10中:
SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW2(config)#int range f0/11 - 15
SW2(config-if-range)#switchport mode access
SW2(config-if)#switchport access vlan 10
SW2(config-if)#end
SW2#show vlan-sw brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10
10   VLAN0010                         active    Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15
20   VLAN0020                         active   
30   VLAN0030                         active   
40   VLAN0040                         active   
50   VLAN0050                         active   
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active
SW3:
设置中继并配置以太通道捆绑:
SW3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW3(config)#int range f0/5 - 8
SW3(config-if-range)#switchport mode trunk
SW3(config-if-range)#switchport trunk encapsulation dot1q
SW3(config-if-range)#channel-group 2 mode on
SW3(config-if-range)#end
配置VTP域:
SW3#vlan database
SW3(vlan)#vtp client

Setting device to VTP CLIENT mode.
SW3(vlan)#vtp domain TK
Changing VTP domain name from NULL to TK
SW3(vlan)#vtp password cisco
Setting device VLAN database password to cisco.
SW3(vlan)#exit
In CLIENT state, no apply attempted.
Exiting....
SW3#show vlan-sw brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/5, Fa0/6, Fa0/7
                                                Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/15
10   VLAN0010                         active   
20   VLAN0020                         active   
30   VLAN0030                         active   
40   VLAN0040                         active   
50   VLAN0050                         active 
  
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active 
端口f0/11-f0/15分配到VLAN10中:
SW3#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW3(config)#int range f0/11 - 15
SW3(config-if-range)#switchport mode access
SW3(config-if-range)#switchport access vlan 10
SW3(config-if-range)#end
SW3#show vlan-sw brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/1, Fa0/2, Fa0/3
                                                Fa0/4, Fa0/9, Fa0/10
10   VLAN0010                         active    Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/15

20   VLAN0020                         active   
30   VLAN0030                         active   
40   VLAN0040                         active   
50   VLAN0050                         active   
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active   
客户机配置:
PC1:
IP:192.168.1.1/24
PC2:
IP:192.168.1.2/24
测试连通性:
PC1>ping 192.168.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 72/298/1092 ms