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
ifconfig vlan85 up
與 vlanctl 不同,使用 vconfig 創建虛擬接口后,原接口功能不受影響,所以不需要對 Native LAN 做額外處理。
示例 3
vconfig 雖然比 vlanctl 簡單,但沒法像 vlanctl 一樣對所有帶 tag 的幀透傳(僅排除 Native VLAN)。不過一般我們需要配置的 VLAN 最多也就 2、3 個,重復一下代碼就好了。
# 注:這只是 vconfig 的用法示例,不是完整的 IPTV 配置腳本
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
ifconfig vlan85 up
vconfig add eth0 51
ifconfig eth0.51 up
vconfig add br0 51
ifconfig br0.51 up
brctl addbr vlan51
brctl addif vlan51 eth0.51
brctl addif vlan51 br0.51
ifconfig vlan51 up
完整的 IPTV 配置腳本參見:上海電信 TL-EP110 + RT-AC86U 實現觀看 4K IPTV 無卡頓 (2019-10) 。
作者:u128393
首發:https://www.cnblogs.com/u128393/p/11629971.html