一、实验目的
1、通过单臂路由器实现不同VLAN之间的通信。
二、实验设备
pc2台,Router_2811 1台,Switch_2960 1台。
三、实验原理
单臂路由:是为实现VLAN间通信的三层网络设备路由器,它只需要一个以太网,通过创建子接口可以承担所有VLAN的网关,而在不同的VLAN间转发数据。(使用路由器的一个接口来解决多VLAN通信的问题。)
使用IEEE802.1Q来启动一个路由器上的子接口成为干道模式,实现VLAN间的通信。
四、单臂路由配置步骤
1、给交换机换分两个VLAN(分别为vlan 10和vlan 20),设置trunk口,将所在口分配给相应的VLAN
Switch>enable Switch#config Configuring from terminal, memory, or network [terminal]? Enter configuration commands, one per line. End with CNTL/Z. Switch(config)#vlan 10 Switch(config-vlan)#exit Switch(config)#vlan 20 Switch(config-vlan)#exit Switch(config)#interface fastEthernet 0/24 Switch(config-if)#switchport mode trunk
Switch(config)#interface fastEthernet 0/6 Switch(config-if)#switchport access vlan 10 Switch(config-if)#exit Switch(config)#interface fastEthernet 0/16 Switch(config-if)#switchport access vlan 20
2、在路由器下,创建子接口、封装协议、分配IP
(VLAN 10)
Router(config)#interface fastEthernet 0/0.11 Router(config-subif)#encapsulation dot1Q 10 Router(config-subif)#ip address 192.168.10.1 255.255.255.0 Router(config-subif)#no shutdown
(VLAN 20)
Router(config)#interface fastEthernet 0/0.12 Router(config-subif)#encapsulation dot1Q 20 Router(config-subif)#ip address 192.168.20.1 255.255.255.0 Router(config-subif)#no shutdown
3、给主机设置IP、和网关
4、测试两台主机的连通性(ping)
五、实验结果
在路由器上利用子接口可以实现不同VLAN间的通信。
六、注意事项:
1、用直通线连接交换机和路由器
2、交换机连接路由器的接口设置trunk模式
3、路由器端口默认为关闭,需要开启路由器接口
4、在路由器子接口配置模式下封装IEEE802.3协议,并指明对应的VLAN号
补充:
1、开启路由器端口
(点击路由器,配置,接口,选择与交换机相连的接口,端口状态,开启)
参考于:http://mooc1.chaoxing.com/nodedetailcontroller/visitnodedetail?courseId=202091179&knowledgeId=321368742
想了解更多:http://mooc1.chaoxing.com/course/202091179.html