单臂路由:同一台交换机下不同vlan进行互访

拓扑:

 

配置信息:

路由器配置
en
conf t
no ip domain-lookup
hostname R1
line cons 0
logging syn
no exec-timeout
exit
int f0/0
no shut
int f0/0.1
encapsulation dot1q 2
ip add 172.16.1.1 255.255.255.0
no shut
int f0/0.2
encapsulation dot1q 3
ip add 172.16.2.1 255.255.255.0
no shut
int f0/0.3
encapsulation dot1q 4
ip add 172.16.3.1 255.255.255.0
no shut

 

交换机配置
en
conf t
hostname S1
enable secret cisco
line vty 0 15
pass cisco
login
exit
vlan 2
name vlan2
vlan 3
name vlan3
vlan 4
name vlan4
exit
int f0/2
switchport mode access
switchport access vlan 2
int f0/3
switchport mode access
switchport access vlan 3
int f0/4
switchport mode access
switchport access vlan 4
int f0/1
switch mode trunk
no shut


客户机配置:
pc1
ip :172.16.1.2/24
ip default-gateway:172.16.1.1

pc2
ip :172.16.2.2/24
ip default-gateway:172.16.2.1

pc3
ip :172.16.3.2/24
ip default-gateway:172.16.3.1

实验完成:

pc1.pc2.pc3.互通!