题目说明:设置pc0的ip地址为192.168.1.10,接交换机的f0/1口;设置pc1的ip地址为192.168.2.10,接交换机的f3/1口。交换机划分为vlan100、vlan200
通过单臂实现vlan间的互访
交换机Swith0上的配置:
>en
Switch#conf
Switch(config)#vlan 100
Switch(config-vlan)#exit
Switch(config)#int f0/1
Switch(config-if)#sw
Switch(config-if)#switchport ac
Switch(config-if)#switchport access vlan 100
Switch(config)#vlan 200
Switch(config-vlan)#exi
Switch(config)#int f3/1
Switch(config-if)#sw
Switch(config-if)#switchport acc
Switch(config-if)#switchport access vlan 200
Switch(config)#int f2/1
Switch(config-if)#switchport mode ?
access Set trunking mode to ACCESS unconditionally
dynamic Set trunking mode to dynamically negotiate access or trunk mode
trunk Set trunking mode to TRUNK unconditionally
Switch(config-if)#switchport mode trunk
路由器1上的配置:
Router>en
Router#conf
Router(config)#int f0/0.1
Router(config-subif)#
Router(config-subif)#encapsulation dot1Q 100
Router(config-subif)#ip add 192.168.1.1 255.255.255.0
Router(config-subif)#no sh
Router(config-subif)#int f0/0.2
Router(config-subif)#encapsulation dot1Q 200
Router(config-subif)#ip add 192.168.2.1 255.255.255.0
Router(config-subif)#no sh
配置完毕!
验证:
PC0>ping 192.168.2.10
Pinging 192.168.2.10 with 32 bytes of data:
Reply from 192.168.2.10: bytes=32 time=125ms TTL=127
Reply from 192.168.2.10: bytes=32 time=125ms TTL=127
Reply from 192.168.2.10: bytes=32 time=125ms TTL=127
Reply from 192.168.2.10: bytes=32 time=125ms TTL=127
Ping statistics for 192.168.2.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 125ms, Maximum = 125ms, Average = 125ms
配置成功!!