实验环境:PacketTracer5.0
实验设备:2620路由器一台,2950交换机一台,PC两台
拓扑如下:
单臂路由实验_休闲
说明:路由器配两个子接口f0/0.100和f0/0.200,ip地址分别为192.168.0.1和192.168.1.1,802.1q封装。
      交换机f0/1与路由器f0/0连接,起Trunk。f0/2与PC0连接,f0/3与PC1连接,交换机划分两个VLAN——vlan100、vlan200。f0/2分配到vlan100,f0/3分配到vlan200。
       PC0配置—— 192.168.0.2   255.255.255.0   192.168.0.1
       PC0配置—— 192.168.1.2   255.255.255.0   192.168.1.1
 
路由配置:
interface FastEthernet0/0
 no ip address
 duplex auto
 speed auto
!
interface FastEthernet0/0.100
 encapsulation dot1Q 100
 ip address 192.168.0.1 255.255.255.0
!
interface FastEthernet0/0.200
 encapsulation dot1Q 200
 ip address 192.168.1.1 255.255.255.0
 
交换机配置:
interface FastEthernet0/1
 switchport mode trunk
!
interface FastEthernet0/2
 switchport access vlan 100
 switchport mode access
!
interface FastEthernet0/3
 switchport access vlan 200
 switchport mode access
 
实验结果:
PC>ping 192.168.1.2
Pinging 192.168.1.2 with 32 bytes of data:
Reply from 192.168.1.2: bytes=32 time=125ms TTL=127
Reply from 192.168.1.2: bytes=32 time=125ms TTL=127
Reply from 192.168.1.2: bytes=32 time=125ms TTL=127
Reply from 192.168.1.2: bytes=32 time=125ms TTL=127
Ping statistics for 192.168.1.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 125ms, Maximum = 125ms, Average = 125ms
 
PC>ping 192.168.0.2
Pinging 192.168.0.2 with 32 bytes of data:
Reply from 192.168.0.2: bytes=32 time=125ms TTL=127
Reply from 192.168.0.2: bytes=32 time=125ms TTL=127
Reply from 192.168.0.2: bytes=32 time=125ms TTL=127
Reply from 192.168.0.2: bytes=32 time=125ms TTL=127
Ping statistics for 192.168.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 125ms, Maximum = 125ms, Average = 125ms
 
不同vlan的两台主机可以相互ping通,完成单臂路由实验!