多VLAN网络中,实现各VLAN之间互访,除了利用三层交换方式来实现外,还可以通过路由器实现。
在每个路由器物理接口,分别连接到各VLAN上,然后分别配置接口的IP地址,让路由器各端口分别充当各VLAN的网关,这样就实现各VLAN之间的互访了,但是以上方式扩展性太差,一个VLAN对应一个物理接口,费用太昂贵,于是发明了子接口,于是单臂路由就出现了,单臂路由实现设备VLAN之间的访问。

使用华为ENSP配置实例拓扑图如下:

汇聚交换机SW1配置
system-view
[Huawei]undo info-center enable
[Huawei]sysname sw1
[sw1]vlan batch 10 20
[sw1]interface GigabitEthernet 0/0/1
[sw1-GigabitEthernet0/0/1]port link-type access
[sw1-GigabitEthernet0/0/1]port default vlan 10
[sw1-GigabitEthernet0/0/1]q
[sw1]interface GigabitEthernet 0/0/10
[sw1-GigabitEthernet0/0/10]port link-type access
[sw1-GigabitEthernet0/0/10]port default vlan 20
[sw1-GigabitEthernet0/0/10]q
[sw1]interface GigabitEthernet 0/0/24
[sw1-GigabitEthernet0/0/24]port link-type trunk ;配置TRUNK链路;
[sw1-GigabitEthernet0/0/24]port trunk allow-pass vlan 10 20;在链路上允许VLAN10 ,20通过
路由器AR1的配置
system-view
[Huawei]sysname R1
[R1]display interface brief
[R1]interface GigabitEthernet 0/0/0.1;配置子接口1
[R1-GigabitEthernet0/0/0.1]dot1q termination vid 10
[R1-GigabitEthernet0/0/0.1]ip address 192.168.10.254 255.255.255.0
[R1-GigabitEthernet0/0/0.1]arp broadcast enable
[R1-GigabitEthernet0/0/0.1]q
[R1]interface GigabitEthernet 0/0/0.2;配置子接口2;
[R1-GigabitEthernet0/0/0.2]dot1q termination vid 20
[R1-GigabitEthernet0/0/0.2]ip address 192.168.20.254 255.255.255.0
[R1-GigabitEthernet0/0/0.2]arp broadcast enable
[R1-GigabitEthernet0/0/0.2]q
[R1]
查看接口状态
display ip interface brief

查看路由器路由信息:
[R1]display ip routing-table

测试验证



喜欢的话,欢迎收藏,转发;
需要华为ENSP 拓扑图,关注我,私信我,我将发给你,交换机的详细配置。
关键词:使用路由器子接口完成VLAN间互相访问(通过子接口完成VLAN间的互访)