Hi guys,
I'm considering getting a archer c7 router and I need to tag the wan port 1000 for my internet. Is this complicated to do? Plenty of guides available for flashing but VLAN is quite confusing to me.
https://openwrt.org/docs/guide-user/base-system/basic-networking
You'll need to use the vid
option to set the VLAN explicitly. Perhaps the pvid
as well. The vlan
option selects a "table row", then defaults the VLAN ID and PVID to the same number.
As an example:
config switch_vlan
option device 'switch0'
option vlan '3'
option vid '1000'
option ports '6t 1t 2 3 4 5'
config switch_port
option device 'switch0'
option port '4'
option pvid '3'
option enable_eee '1'
I have friend in AU who also needs to tag 1000 VLN on the WAN on a C7v2, but the response from Jeff is a bit confusing.
In the switch-vlan, I agree, setting the vid to 1000 is the key, but I'm confused about the ports tagging. On a C7, the default wan config tags port 6 to port 1 (with no tag), but Jeff's config shows all ports (including those used for LAN, 2, 3, 4, 5) and with port 1 tagged (which is what would cause the outgoing packets to be tagged with the value in vid).
Why are the lan ports included? That does not seem right.
And not sure how the switch port example is supposed to relate to setting a VLAN on WN, as it references a LAN port. I agree it's an example of using the switch to tag packets (in this case with vid 3 on port 4). But confusing to people looking at setting WAN VLANs.
Could someone please post a full working config for a standard router config doing VLAN tagging on the WAN. a full example might be instructive.
As I recall, the switch driver for the Archer C7v2 has a limit of 128 VLANs in its table. For higher-numbered VLANs you’ll need to explicitly specify vid
in the switch config and possibly pvid
on the port. Details on the wiki.
I’ll dig up my old C7v2 config this afternoon.
config switch_vlan
option device 'switch0'
option vlan '3'
option vid '1000'
option ports '6t 1t 2 3 4 5'
In this use, tagged on the CPU and the trunk, untagged on the "LAN" ports. vlan '3'
is a "table row" in the VLAN table. The vid
seems to default to value of vlan
. https://openwrt.org/docs/guide-user/base-system/basic-networking#switch_configuration
So we worked it out, and here are the commands required to set it and get it going:
In the C7v2 we will add tagging to the port 1 (1t 6t) so its traffic is tagged. We set the pvid with the switch statement, and ensure the ifname for the wan is set to the eth0.vid#
uci set network.@switch_vlan[1].ports='1t 6t'
uci set network.@switch_vlan[1].vid='1000'
uci set network.wan.ifname='eth0.1000'
uci commit
/etc/init.d/network restart
That's it.