前言背景企业网络中VLAN用于隔离广播域但不同部门需要通信怎么办单臂路由的作用用路由器的一个物理接口通过子接口实现多个VLAN的三层互通成本低适合中小场景。实验目标通过eNSP模拟实现VLAN4R2和VLAN8R3的跨网段通信。环境准备工具eNSP版本号可写比如1.3.00.100设备路由器AR2220 ×3R1、R2、R3交换机S3700 ×1S1IP规划设备接口IP地址子网掩码VLANR2GE0/0/010.0.4.1255.255.255.04R3GE0/0/010.0.8.1255.255.255.08R1GE0/0/0.110.0.4.254255.255.255.04R1GE0/0/0.210.0.8.254255.255.255.08拓扑结构详细配置步骤1. 交换机S1配置VLAN划分Trunk# 进入系统视图关闭信息中心可选 system-view undo info-center enable sysname S1 # 批量创建VLAN 4和8 vlan batch 4 8 # 配置连接R2的端口E0/0/1为Access加入VLAN4 interface Ethernet0/0/1 port link-type access port default vlan 4 quit # 配置连接R3的端口E0/0/3为Access加入VLAN8 interface Ethernet0/0/3 port link-type access port default vlan 8 quit # 配置连接R1的端口E0/0/2为Trunk放行VLAN4和8 interface Ethernet0/0/2 port link-type trunk port trunk allow-pass vlan 4 8 quit2. 路由器R1配置单臂路由子接口system-view undo info-center enable sysname R1 # 进入物理接口确保接口开启 interface GigabitEthernet0/0/0 undo shutdown quit # 配置VLAN4的子接口G0/0/0.1 interface GigabitEthernet0/0/0.1 dot1q termination vid 4 # 封装VLAN4标签 ip address 10.0.4.254 24 # 作为VLAN4的网关 arp broadcast enable # 开启ARP广播关键否则无法通信 quit # 配置VLAN8的子接口G0/0/0.2 interface GigabitEthernet0/0/0.2 dot1q termination vid 8 # 封装VLAN8标签 ip address 10.0.8.254 24 # 作为VLAN8的网关 arp broadcast enable quit3. 终端设备R2/R3配置IP默认路由R2配置system-view undo info-center enable sysname R2 # 配置接口IP interface GigabitEthernet0/0/0 ip address 10.0.4.1 24 undo shutdown quit # 配置默认路由下一跳指向R1的VLAN4网关 ip route-static 0.0.0.0 0.0.0.0 10.0.4.254R3配置system-view undo info-center enable sysname R3 # 配置接口IP interface GigabitEthernet0/0/0 ip address 10.0.8.1 24 undo shutdown quit # 配置默认路由下一跳指向R1的VLAN8网关 ip route-static 0.0.0.0 0.0.0.0 10.0.8.254验证过程1. 检查交换机配置# 查看VLAN划分 [S1] display vlan # 输出应显示VLAN4包含E0/0/1UTVLAN8包含E0/0/3UTTrunk口E0/0/2放行VLAN4和8TG # 查看端口链路类型 [S1] display port vlan # 输出应显示E0/0/1为accessPVID4E0/0/3为accessPVID8E0/0/2为trunk允许VLAN1/4/82. 检查路由器子接口状态[R1] display ip interface brief # 输出应显示G0/0/0.1和G0/0/0.2的Status为UPProtocol为UP3. 连通性测试R2 ping R310.0.8.1[R2] ping 10.0.8.1 # 第一次可能丢包ARP学习后续应100%成功 # 示例输出 PING 10.0.8.1: 56 data bytes, press CTRL_C to break Reply from 10.0.8.1: bytes56 Sequence1 ttl254 time110 ms Reply from 10.0.8.1: bytes56 Sequence2 ttl254 time50 ms Reply from 10.0.8.1: bytes56 Sequence3 ttl254 time80 ms Reply from 10.0.8.1: bytes56 Sequence4 ttl254 time70 ms Reply from 10.0.8.1: bytes56 Sequence5 ttl254 time90 ms --- 10.0.8.1 ping statistics --- 5 packet(s) transmitted 5 packet(s) received 0.00% packet loss round-trip min/avg/max 50/80/110 ms实验总结通过这次实验我深刻理解了单臂路由的原理用802.1Q封装在单个物理接口上创建多个子接口每个子接口对应一个VLAN的网关通过路由器实现三层转发。它的优点是成本低只需一个路由器接口缺点是物理接口带宽瓶颈所有VLAN流量都走同一个接口适合小型网络场景。如果是大型企业还是建议用三层交换机的SVI接口实现VLAN间路由。这次实验也让我意识到细节决定成败一个小小的arp broadcast enable命令就能让整个配置失效排错时要一步步验证每一层的配置物理层→数据链路层→网络层才能快速定位问题。