|
本帖最后由 大猫 于 2017-1-7 13:15 编辑
下载宝默认的参数:
LAN为vlan1 port:0 1 2 3
WAN为vlan2 port: 4
cpu port:6(这个不确定,网上查的)
padavan默认的跟vlan有关的配置:
CONFIG_RA_HW_NAT_LAN_VLANID=1
CONFIG_RA_HW_NAT_WAN_VLANID=2
CONFIG_RAETH_ESW_PORT_WAN=4
CONFIG_RAETH_ESW_PORT_LAN1=3
CONFIG_RAETH_ESW_PORT_LAN2=2
CONFIG_RAETH_ESW_PORT_LAN3=1
CONFIG_RAETH_ESW_PORT_LAN4=0
CONFIG_VLAN_8021Q=y
CONFIG_VLAN_8021Q_DOUBLE_TAG=y
[XZB /home/root]# nvram show|grep vlan
vlan_vid_iptv=
vlan_tag_lan1=0
vlan_tag_lan2=0
vlan_tag_lan3=0
vlan_tag_lan4=0
vlan_filter=0
vlan_pri_lan1=0
vlan_pri_lan2=0
vlan_pri_lan3=0
vlan_pri_lan4=0
vlan_vid_cpu=
vlan_vid_lan1=
vlan_vid_lan2=
vlan_vid_lan3=
vlan_vid_lan4=
vlan_pri_iptv=0
vlan_pri_cpu=0
- Only Trunk port (w/o untagging) can use more one VLANs.
- Now, you can assign VLANs via rtl8367 utility (or mtk_esw for MT7620/MT7621-based devices).
- rtl8367 64 [MASK] [DATA]
- Create VLAN entry
- where is MASK:
- ((untag & 0xFF) << 16) | (member & 0xFF)
- #define SWAPI_PORTMASK_LAN1 (1<<0)
- #define SWAPI_PORTMASK_LAN2 (1<<1)
- #define SWAPI_PORTMASK_LAN3 (1<<2)
- #define SWAPI_PORTMASK_LAN4 (1<<3)
- #define SWAPI_PORTMASK_WAN (1<<4)
- #define SWAPI_PORTMASK_CPU_LAN (1<<5)
- #define SWAPI_PORTMASK_CPU_WAN (1<<6)
- #define SWAPI_PORTMASK_INIC (1<<7)
- where is DATA:
- ((fid & 0x0FFF) << 16) | (vid & 0x0FFF)
- Example: set ports WAN and LAN4 as member with VID 20:
- rtl8367 64 0x00000018 0x00140014
复制代码 另外:老毛子andy大神给的例子最后的 0x00000018 0x00140014 是怎么计算的呢?
下载宝关于交换VLAN的命令:switch
switch vlan dump <max_vid> - dump switch vlan table, up to specified vlan id
switch tag on [port] - egress tag on port 0~6
switch tag off [port] - egress untag on port 0~6
switch tag swap [port] - egress swap cvid<->stag on port 0~6
switch tag stack [port] - egress stack stag on port 0~6
switch pvid [port] [pvid] - set pvid on port 0~6
switch vlan set [vid] [portmap] <stag> <eg_con> <eg_tag> - set vlan id and associated member
[RT-N56U_B1 /home/root]# switch vlan dump
vid portmap eg-tag eg-con stag ivl fid
1 1111--1 uuuu--u 0 0 1 -
2 ----11- ----uu- 0 0 1 -
|
|