RT-AC86U 没有 robocfg 命令,网上找不到成功配置 VLAN 的例子。几番摸索,发现可以用 vlanctl 或 vconfig 来实现,本篇介绍 vconfig 的用法(传送门:vlanctl 篇)。
示例 1
vconfig set_name_type DEV_PLUS_VID_NO_PAD
vconfig add eth0 85
ifconfig eth0.85 up
我们逐条分解:
vconfig set_name_type DEV_PLUS_VID_NO_PAD
设置创建虚拟接口的命名规则为 设备名 + VLAN ID。
vconfig add eth0 85
为 eth0 添加虚拟接口,并绑定到 VLAN 85。根据前一条命令设置的命名规则,这个虚拟接口被命名为 eth0.85 。
ifconfig eth0.85 up
启用这个虚拟接口。
示例 2
示例 1 中我们为 eth0 (WAN) 创建了 VLAN 85 的虚拟接口,接下来我们为 br0 (LAN Bridge) 同样创建 VLAN 85 的虚拟接口,并把他们桥接起来。这样 WAN 和 LAN 的 VLAN 85 就联通了。
vconfig set_name_type DEV_PLUS_VID_NO_PAD
vconfig add eth0 85
ifconfig eth0.85 up
vconfig add br0 85
ifconfig br0.85 up
brctl addbr vlan85
brctl addif vlan85 eth0.85
brctl addif vlan85 br0.85