SW1的配置
Router>en
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#ho SW1
SW1(config)#en
SW1#
*Mar  1 00:03:30.939: %SYS-5-CONFIG_I: Configured from console by console
SW1#vlan da
SW1#vlan database
SW1(vlan)#vlan 2
VLAN 2 added:
    Name: VLAN0002
SW1(vlan)#vlan 3
VLAN 3 added:
    Name: VLAN0003
SW1(vlan)#exit
APPLY completed.
Exiting....
SW1#config
SW1#configure
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#in
SW1(config)#interface f0/2
SW1(config-if)#sw
SW1(config-if)#switchport acc
SW1(config-if)#switchport access vlan 2
SW1(config-if)#no shut
SW1(config-if)#interface f0/3         
SW1(config-if)#switchport access vlan 3
SW1(config-if)#no shut                
SW1(config-if)#exit
SW1#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#in
SW1(config)#interface f0/0
SW1(config-if)#switchport mode tr
SW1#show vlan-Sw
 
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/1, Fa0/4, Fa0/5
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15
4    VLAN0004                         active    Fa0/2
5    VLAN0005                         active    Fa0/3
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active   
 
VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
4    enet  100004     1500  -      -      -        -    -        0      0  
5    enet  100005     1500  -      -      -        -    -        0      0  
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0  
1005 trnet 101005     1500  -      -      1        ibm  -        0      0  
 
SW2的配置
Router>en
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host SW2
SW2(config)#en
SW2#vlan da
SW2(vlan)#vlan 4
VLAN 4 added:
    Name: VLAN0004
SW2(vlan)#vlan 5
VLAN 5 added:
    Name: VLAN0005
SW2(vlan)#exit
APPLY completed.
Exiting....
SW2#confit
SW2(config)#in
SW2(config)#interface f0/4
SW2(config-if)#sw
SW2(config-if)#switchport acc
SW2(config-if)#switchport access vlan 4
SW2(config-if)#no shut
SW2(config-if)#interface f0/5         
SW2(config-if)#no shut      
SW2(config-if)#switchport access vlan 5
SW2(config-if)#end
SW2#show vlan-Sw
 
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/0, Fa0/1, Fa0/2, Fa0/3
                                                Fa0/6, Fa0/7, Fa0/8, Fa0/9
                                                Fa0/10, Fa0/11, Fa0/12, Fa0/13
                                                Fa0/14, Fa0/15
4    VLAN0004                         active    Fa0/4
5    VLAN0005                         active    Fa0/5
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active   
 
VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        1002   1003
4    enet  100004     1500  -      -      -        -    -        0      0  
5    enet  100005     1500  -      -      -        -    -        0      0  
1002 fddi  101002     1500  -      -      -        -    -        1      1003
1003 tr    101003     1500  1005   0      -        -    srb      1      1002
1004 fdnet 101004     1500  -      -      1        ibm  -        0      0  
1005 trnet 101005     1500  -      -      1        ibm  -        0      0  
 
SW2(config-if)#sw
SW2(config-if)#switchport mo
SW2(config-if)#switchport mo
SW2(config-if)#switchport mode tr
SW2(config-if)#
*Mar  1 00:30:08.943: %DTP-5-TRUNKPORTON: Port Fa0/0 has become dot1q trunk
SW2(config-if)#no shut
SW2(config-if)#
 
PC机的配置
 
VPCS 1 >2
VPCS 2 >ip 192.168.1.1 192.168.1.30 27
PC2 : 192.168.1.1 255.255.255.224 gateway 192.168.1.
 
VPCS 3 >ip 192.168.1.33 192.168.1.62 27
PC3 : 192.168.1.33 255.255.255.224 gateway 192.168.1
 
VPCS 3 >4
VPCS 4 >ip 192.168.1.65 192.168.1.94 27
PC4 : 192.168.1.65 255.255.255.224 gateway 192.168.1
 
VPCS 4 >5
VPCS 5 >ip 192.168.1.97 192.168.1.126 27
PC5 : 192.168.1.97 255.255.255.224 gateway 192.168.1
 
VPCS 5 >ping 192.168.1.65
192.168.1.65 icmp_seq=1 time=62.000 ms
192.168.1.65 icmp_seq=2 time=63.000 ms
192.168.1.65 icmp_seq=3 time=63.000 ms
192.168.1.65 icmp_seq=4 time=62.000 ms
192.168.1.65 icmp_seq=5 time=63.000 ms
 
VPCS 5 >
VPCS 5 >ping 192.168.1.1
192.168.1.1 icmp_seq=1 time=109.000 ms
192.168.1.1 icmp_seq=2 time=141.000 ms
192.168.1.1 icmp_seq=3 time=234.000 ms
192.168.1.1 icmp_seq=4 time=125.000 ms
192.168.1.1 icmp_seq=5 time=125.000 ms
 
 
VPCS 2 >ping 192.168.1.33
192.168.1.33 icmp_seq=1 timeout
192.168.1.33 icmp_seq=2 time=63.000 ms
192.168.1.33 icmp_seq=3 time=62.000 ms
192.168.1.33 icmp_seq=4 time=94.000 ms
192.168.1.33 icmp_seq=5 time=62.000 ms
相互都能ping通