【实验环境】
Cisco Packet Tracer 5.3.2
【实验目的】
使用单臂路由技术实现VLAN间通信。
【实验拓扑】
【实验步骤】
1、PC0:
IP:192.168.1.1/24
默认网关:192.168.1.254
2、PC1:
IP:192.168.2.1/24
默认网关:192.168.2.254
3、交换机:
接口F0/1:mode access,VLAN 10
接口F0/1:mode access,VLAN 20
接口F0/24:mode trunk
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#int f0/1
Switch(config-if)#swi mod acc
Switch(config-if)#swi acc vlan 10
Switch(config-if)#int f0/2
Switch(config-if)#swi mod acc
Switch(config-if)#swi acc vlan 20
//与路由器相连的接口必须配制成trunk模式
Switch(config-if)#int f0/24
Switch(config-if)#swi mod trunk
Switch(config-if)#exit
4、路由器:
接口F0/0.1:192.168.1.254/24,dot1q,VLAN 10
接口F0/0.2:192.168.2.254/24,dot1q,VLAN 20
//物理接口需要no shutdown且不能配置IP地址
Router(config)#int f0/0
Router(config-if)#no sh
//逻辑子接口上配置IP地址并封装dot1q协议,指定所属VLAN
Router(config-if)#int f0/0.1
Router(config-subif)#encapsulation dot1q 10
Router(config-subif)#ip add 192.168.1.254 255.255.255.0
Router(config-subif)#int f0/0.2
Router(config-subif)#encapsulation dot1q 20
Router(config-subif)#ip add 192.168.2.254 255.255.255.0
Router(config-subif)#end
5、验证
PC>ipconfig
IP Address......................: 192.168.1.1
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.254
PC>ping 192.168.2.1
Pinging 192.168.2.1 with 32 bytes of data:
Reply from 192.168.2.1: bytes=32 time=125ms TTL=127
Reply from 192.168.2.1: bytes=32 time=109ms TTL=127
Reply from 192.168.2.1: bytes=32 time=109ms TTL=127
Reply from 192.168.2.1: bytes=32 time=109ms TTL=127
Ping statistics for 192.168.2.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 109ms, Maximum = 125ms, Average = 113ms
PC>