实验工具:在虚拟机中完成,7200
路由1
台,3640
交换机1
台,PC2
台
实验目的:不同网段VLAN
的PC
能够PING
通
单臂路由:通过子借口的设置,使连接在交换机上不同VLNA
网段的PC
能够相互连通
R
Router(config)#interface f0/0
Router(config-if)#no sh
确保连接交换机的端口打开
Router(config-if)#exit
Router(config)#interface f0/0.1
设置
f0/0
的子接口
Router(config-subif)#encapsulation dot1Q 1
封装
Router(config-subif)#ip add 192.168.1.1 255.255.255.0
设置子借口的
IP
Router(config)#interface f0/0.2
Router(config-subif)#encapsulation dot1Q 2
Router(config-subif)#ip add 192.168.2.1 255.255.255.0
Router(config-subif)#exit
Router(config)#ex
Router#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF , IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, FastEthernet0/0.1
直连路由的子借口
C 192.168.2.0/24 is directly connected, FastEthernet0/0.2
S
S#vlan database
设置
VLAN
S(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
S(vlan)#exit
Exiting....
S#conf t
S(config-if)#interface f0/2
把端口
F0/2
分到
VLAN2
S(config-if)#switchport access vlan 2
S(config-if)#exit
S(config)#interface f0/0
把
F0/0
设置成
Trunk
S(config-if)#switchport mode trunk
S(config-if)#no sh
S(config-if)#exit
S#show interface f0/0 switchport Trunk
设置成功
Name: Fa0/0
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1-2
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
两台机器能PING实验成功。