即:使用路由器(物理接口或子接口)实现VLAN间通信
弊端:使用物理接口,每个VLAN对应一个物理接口,成本大,链路多,只能做双臂路由
使用子接口:实现单臂路由,有多少个vlan就可以创建多少个子接口,单接口最多4096个子接口
子接口:只占一个物理接口(但可能导致单点故障)
[Huawei]vlan batch 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]port link-type access
[Huawei-Ethernet0/0/1]port default vlan 10
[Huawei-Ethernet0/0/1]int e0/0/3
[Huawei-Ethernet0/0/3]p l a
[Huawei-Ethernet0/0/3]p d v 20
[Huawei-Ethernet0/0/3]int e0/0/2
[Huawei-Ethernet0/0/2]p l t
[Huawei-Ethernet0/0/2]p t a v 10 20
//正常情况下配置在不同vlan且隔离了无法实现互通需要走三层
<Huawei>sy
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]int e0/0/1.10
[Huawei-Ethernet0/0/1.10]dot1q termination vid 10
[Huawei-Ethernet0/0/1.10]ip address 192.168.0.254 24
[Huawei-Ethernet0/0/1.10]arp broadcast enable
[Huawei-Ethernet0/0/1.10]int e0/0/1.20
[Huawei-Ethernet0/0/1.20]dot1q termination vid 20
[Huawei-Ethernet0/0/1.20]ip address 192.168.1.254 24
[Huawei-Ethernet0/0/1.20]arp broadcast enable
//开启ARP广播若收到数据为ARP地址可以进行响应
将R1替换为三层交换机,如图:
<Huawei>sy
[Huawei]un in en
[Huawei]vlan batch 10 20
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v 10 20
//quit返回
[Huawei]int vlanif 10
[Huawei-Vlanif10]ip add 192.168.0.254 24
[Huawei-Vlanif10]int vlanif 20
[Huawei-Vlanif20]ip add 192.168.1.254 24
ping+tracert:
因篇幅问题不能全部显示,请点此查看更多更全内容