SW1配置: 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)#exit APPLY completed. Exiting.... SW1#vlan database SW1(vlan)#vtp server Device mode already VTP SERVER. SW1(vlan)#vtp domain zhen Changing VTP domain name from NULL to zhen SW1(vlan)#vtp password cisco Setting device VLAN database password to cisco. SW1(vlan)#exit APPLY completed. Exiting.... SW1#show vtp status VTP Version : 2 Configuration Revision : 1 Maximum VLANs supported locally : 256 Number of existing VLANs : 8 VTP Operating Mode : Server VTP Domain Name : zhen VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0x08 0xB4 0x36 0x38 0xE0 0x28 0x51 0x65 Configuration last modified by 0.0.0.0 at 3-1-02 00:03:05 Local updater ID is 0.0.0.0 (no valid interface found) SW1#conf t Enter configuration commands, one per line. End with CNTL/Z. SW1(config)#int f0/1 SW1(config-if)#switchport mode trunk SW1(config-if)#switchport trunk encapsulation dot1q SW1(config-if)#int f0/2 SW1(config-if)#switchport mode access SW1(config-if)#switchport access vlan 10 SW1(config-if)#end SW1#show int f0/1 switchport Name: Fa0/1 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: Disabled Access Mode VLAN: 0 ((Inactive)) Trunking Native Mode VLAN: 1 (default) Trunking VLANs Enabled: ALL Trunking VLANs Active: 1,10,20,30 Priority for untagged frames: 0 Override vlan tag priority: FALSE Voice VLAN: none Appliance trust: none
SW2配置: SW2#vlan database SW2(vlan)#vtp client Setting device to VTP CLIENT mode. SW2(vlan)#vtp domain zhen Changing VTP domain name from NULL to zhen SW2(vlan)#vtp password cisco Setting device VLAN database password to cisco. SW2(vlan)#exit In CLIENT state, no apply attempted. Exiting.... SW2#show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 256 Number of existing VLANs : 5 VTP Operating Mode : Client VTP Domain Name : zhen VTP Pruning Mode : Disabled VTP V2 Mode : Disabled VTP Traps Generation : Disabled MD5 digest : 0xD1 0x4D 0x99 0xC4 0x39 0x0F 0x22 0x2F Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 SW2#conf t Enter configuration commands, one per line. End with CNTL/Z. SW2(config)#int f0/1 SW2(config-if)#switchport mode trunk SW2(config-if)#switchport trunk encapsulation dot1q SW2(config-if)#en SW2#show vlan-sw VLAN Name Status Ports
1 default active Fa0/0, 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
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
SW2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
SW2(config)#int f0/2
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 10
SW2(config-if)#end
客户机配置: 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 = 44/76/144 ms