单臂路由
二层交换机是让不同vlan之间不能通信,单臂路由主要实现不同VLAN之间可以通信(从逻辑上分成多个网络,缩小网络,有效控制广播风暴),缺点是容易形成网络单点故障。
通信原理:
路由器重新封装MAC地址、转换vlan标签
链路类型:
交换机连接主机的端口为access链路 交换机连接路由器的端口为Trunk链路
子接口:
路由器的物理接口可以被划分成多个逻辑子接口(例如:int f0/0.1 int f0/0.2 ...) 每个子接口对应一个vlan网段的网关
网络拓扑图:
本实验在GNS3中模拟操作
交换机sw配置命令:
sw#conf t Enter configuration commands, one per line. End with CNTL/Z. sw(config)#vlan 10,20 //创建vlan10,vlan20 sw(config-vlan)#ex sw(config)#int f1/1 sw(config-if)#sw mo acc //access链路 sw(config-if)#sw acc vlan 10 //加入到vlan10中 sw(config-if)#ex sw(config)#int f1/2 sw(config-if)#sw mo acc sw(config-if)#sw acc vlan 20 sw(config-if)#ex sw(config)#int f1/0 sw(config-if)#sw mo tr //trunk链路 sw(config-if)#sw tr en dot //封装dot1q协议 sw(config-if)#speed 100 sw(config-if)#dup full sw(config-if)#ex
路由器R1配置命令:
R1#conf t Enter configuration commands, one per line. End with CNTL/Z. R1(config)#int f0/0 R1(config-if)#no shut R1(config-if)#speed 100 *Mar 1 00:03:07.695: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up *Mar 1 00:03:08.695: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up *Mar 1 00:03:11.403: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up R1(config-if)#dup full R1(config-if)#ex *Mar 1 00:03:17.727: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up R1(config)#int f0/0.1 R1(config-subif)#encapsulation dot1Q 10 *Mar 1 00:03:32.111: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up R1(config-subif)#ip add 192.168.1.1 255.255.255.0 R1(config-subif)#no shut R1(config-subif)#ex R1(config)#int f0/0.2 R1(config-subif)#en dot1q 20 R1(config-subif)#ip add 192.168.2.1 255.255.255.0 R1(config-subif)#no shut R1(config-subif)#ex
测试
两台电脑C1、C2 使用GNS软件中的VPCS模拟测试