Vlan tagging in B1300 in WAN port

Hi! I just bought a gl b1300 router. I’m using stock openwrt.

My home internet configuration requires vlan tagging on the wan port in order to be able to connect to my isp. However, there is no vlan option for the wan port, only for the two lan ports (and cpu).

Why is this happening, and is there a way to do achieve what I want? I’m quite preocupied as I bought the router thinking everything would work out and now I’m not able to get vlans in that port :frowning:.

I have no problem in doing this in the command line, if this is just a problem with the web interface.

Thanks!

Add a new VLAN, with the ID required by your ISP, tagged on CPU and WAN, off on LAN. Modify your current VLAN 1, tagged on CPU, untagged on LAN, and off in WAN.

Move your LAN network config from eth0 to eth0.1, configure the WAN network on eth0.x (x is the VLAN required by your ISP). Apply and reboot.

but I have no way of taging on WAN. check the image in my post. that is exactly my question, why there is no option to tag on WAN

Some routers don't allow to include wan port into switch, so you can't do it.

what do you mean by don't allow? does the router have two switches? one for the 2 lan ports that are managed, and another switch with the wan port that is unmanaged? This doesn't make much sense to me. could it be a driver issue?

E.g. see https://openwrt.org/toh/mikrotik/rb951ui :
Built in ethernet switch

In /etc/config/network, add these lines to enable the built-in ethernet switch between ports 2..5.

config switch 'eth1'
option enable '1'

Example VLAN configuration for switch ports

In /etc/config/network, add these lines to enable the switch, and create 2 vlan interfaces (eth1.11 and eth1.12). The first for ports 5 and 4, and the later for ports 3 and 2. Port 1 on the router is eth0.

config switch 'eth1'
option enable '1'
option enable_vlan '1'
config switch_vlan
option device 'eth1'
option vlan '11'
option vid '11'
option ports '0t 1 2'
config switch_vlan
option device 'eth1'
option vlan '12'
option vid '12'
option ports '0t 3 4'

See also: https://openwrt.org/docs/guide-user/network/vlan/switch_configuration

sorry, can you explain in a bit more detail? this is my first time using openwrt. I have no issue in doing the configuration in /etc/config/network instead of luci.

So is it possible to enable vlan tagging in the wan port or not?

this is the relevant part of my config:

config interface 'lan'
	option type 'bridge'
	option ifname 'eth0'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option ifname 'eth1'
	option proto 'dhcp'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '3 4 0'

you are sugesting in using devide 'eth 1' in 'config switch_vlan' instead of 'switch0'?

If I knew, I would give answer.

Please, give output of:

ls -l /sys/class/net
swconfig list

Thanks, I understand that you are helping me and truly apreciate it. I was just confused.

root@OpenWrt:~# ls -l /sys/class/net
lrwxrwxrwx    1 root     root             0 May 16 18:36 br-lan -> ../../devices/virtual/net/br-lan
lrwxrwxrwx    1 root     root             0 Jan  1  1970 eth0 -> ../../devices/platform/soc/c080000.edma/net/eth0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 eth1 -> ../../devices/platform/soc/c080000.edma/net/eth1
lrwxrwxrwx    1 root     root             0 Jan  1  1970 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx    1 root     root             0 May 16 18:36 wlan0 -> ../../devices/platform/soc/a000000.wifi/net/wlan0
lrwxrwxrwx    1 root     root             0 May 16 18:36 wlan1 -> ../../devices/platform/soc/a800000.wifi/net/wlan1
root@OpenWrt:~# swconfig list
Found: switch0 - 90000.mdio

I think, wan port is separate port in this case (eth1). For another router wan port is member of switch (eth0.2), it is in default configuration. And CPU port has number 6. In your case CPU port has number 0. So I think, it is impossible to configure tagged wan. You can configure one 'lan' port as wan, and 'wan' port as additional interface, and bridge it to another. I am not sure, whether last is possible.

OpenWRT-image of firmware doesn't contain /etc/config/network file, it is generated on first startup, so it is not trivial to check, whether some model supports it...

That is disapointing :frowning: . I find it strange that people would sell routers like this... I'll probably employ your solution then. Thank you for your help :smile:

BTW I was really interesting to configure it with the same purpose, and trying Mikrotik found out, that only 4 'lan' ports could be configured with tags. Have you got another router, where wan port is configured as member of switch?

Have you tried adding the required vlan tag to the ifname for the wan? So option ifname 'eth1.xxx'

3 Likes

unfortunately no, this is the only router I have available that supports openwrt. in the future, when buying routers I'll make sure to check for this, as I just got from a router with 3 ports to one with only 2...

no, how should I add this?

config interface 'wan'
	option ifname 'eth1.xxx'
	option proto 'dhcp'

with xxx my vlan id?

do I need to add something too:

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan 'xxx'
	option ports '3 4 0'

like option ports '3 4 0 5t' ?

Yes.

And leave the switch section alone.

it does change in luci to eth1.xxx, but it doesn't seem to work, unfortunately

You haven't put 'xxx' literally have you? You have used the required vlan id for your ISP?

yes, I did put the number of the vlan id, not the xxx

Is everything else set up as required by your ISP? Restarted the interface?