单臂路由
- 外接一个路由器。
- 采用Trunk 链路连接。
- 为f0/0配置虚拟子接口,使每个子接口逻辑对应于一个VLAN。
- 设置子接口的相关参数(封装方式 isl / dot1q 对应的VLAN IP)
搭建网络
除路由器外,其他部署请参考路由交换练习——VLAN的中继进行搭建。
进如路由器连接交换机的端口,并清除物理IP,端口给电:
R1(config)#int f0/0
R1(config-if)#no ip address
R1(config-if)#no shutdown
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
进入虚拟端口0.1,设置通信协议及VLAN IP:
R1(config)#int f0/0.1
R1(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up
R1(config-subif)#encapsulation dot1Q 1
R1(config-subif)#ip address 172.16.1.251 255.255.255.0
进入虚拟端口0.2,设置通信协议及VLAN IP:
R1(config)#int f0/0.2
R1(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to up
R1(config-subif)#encapsulation dot1Q 2
R1(config-subif)#ip address 172.16.2.251 255.255.255.0
将与路由器连接的交换机端口模式切换为Trunk:
Switch(config)#int f0/23
Switch(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/23, changed state to up
将VLAN1下的设备网关设置为172.16.1.251,VLAN2下的设备网关设置为172.16.2.251。
图为1.1ping2.4操作(跨VLAN通信):
注:
单臂路由方式是一种过时的技术,其采用软件交换,并且所有VLAN间的流量共享R的物理接口带宽,效率低,延迟大。在今天的园区网中,已被三层交换机取代。