Tagged VLANs on device with VLAN capable switch: Need help to get connection

According to https://openwrt.org/docs/guide-user/network/vlan/switch_configuration there are devices with and without a VLAN capable switch.
TP-Link WR902ac seems to have a vlan capable switch:

lrwxrwxrwx    1 root     root             0 Jan  6 00:49 br-lan -> ../../devices/virtual/net/br-lan
lrwxrwxrwx    1 root     root             0 Jan  6 00:49 eth0 -> ../../devices/platform/10100000.ethernet/net/eth0
lrwxrwxrwx    1 root     root             0 Jan  6 00:49 eth0.1 -> ../../devices/virtual/net/eth0.1
lrwxrwxrwx    1 root     root             0 Jan  6 00:49 lo -> ../../devices/virtual/net/lo
lrwxrwxrwx    1 root     root             0 Jan  6 00:49 wlan1 -> ../../devices/pci0000:00/0000:00:00.0/0000:01:00.0/net/wlan1

On a device without vlan capable swith and tagged VLANs following works perfect:

ip link add link eth0 name eth0.19 type vlan id 19
ifconfig eth0.19 172.16.1.9 netmask 255.255.255.0 up
ping 172.16.1.1
PING 172.16.1.1 (172.16.1.1): 56 data bytes
64 bytes from 172.16.1.1: seq=0 ttl=64 time=1.455 ms
64 bytes from 172.16.1.1: seq=1 ttl=64 time=0.868 ms
^C

However doing the same on WR902ac I don't get any ping replys, so VLAN19 is not working.
Default /etc/config/network is

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'XXXXXXX'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0.1'

config interface 'lan'
        option device 'br-lan'
        option proto 'dhcp'
        option delegate '0'

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

config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '4 6t'

What is missing here to get VLAN19 to work?
I've also read that https://openwrt.org/docs/guide-user/network/vlan/switch but it didn't help me for this problem.

Thanks for your help.

No, the WR902AC does not have a switch at all. It has a single ethernet port.

That said, the device does support VLANs. It would be in the format eth0 (for the untagged network) and eth0.x for tagged networks where x is the VLAN ID.

What you've shown below is not the default /etc/config/network file for the WR902AC. I know this because...

There is no switch in the device, the switch and VLAN configurations don't do anything. Although it is moot, the (invalid) switch configuration doesn't even specify VLAN 19 in the first place.

You need to have a network interface that is bound to VLAN 19 in order to get a ping reply. That interface would be on eth0.19 and would need to have either a DHCP or static IP protocol configured and appropriate address for that subnet.

Where is VLAN19 coming from (or going to) in your network? Can you provide a network diagram, please?

No, the WR902AC does not have a switch at all. It has a single ethernet port.

Thats true. I thought there is this switch, because it has 2,4 und 5 GHz Wifi and switching between the 3.

I'm confused that WR902AC has this eth0.1 port by default, whereas CPE210 and WR802n don't have it.

What you've shown below is not the default /etc/config/network file for the WR902AC. I know this because...

Thats the configuration I got after firstboot && reboot

You need to have a network interface that is bound to VLAN 19 in order to get a ping reply. That interface would be on eth0.19 and would need to have either a DHCP or static IP protocol configured and appropriate address for that subnet.

Where is VLAN19 coming from (or going to) in your network? Can you provide a network diagram, please?

I have this device. To make it shorter, if I pull cable from WR902ac and plug it into WR802n and doint the steps from above everything works as expected, getting reply from 172.16.1.1
So I think I can save the time drawing a network diagram.

Usually the radios are bridged (not hardware switched), therefore not requiring a hardware switch chip to be included in the device. This is why the wireless devices are not actually present in the /etc/config/network file.

Are you positive? What version of OpenWrt are you using and what version of the hardware? I have a version 1 device, which uses just eth0.

I have no idea what you are trying to communicate here. The example you showed above about how you got ping responses does not necessarily indicate that the VLAN configuration was working -- there are many reasons that this could happen if you have any other network interfaces configured on that system.

Please make a drawing... it will be so much more clear.

Trying a configuration from CPE210

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'XXXXXX'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'dhcp'
        option delegate '0'

locked me out / prevents network access. So I guess default configuration makes sense for this device.

Are you positive? What version of OpenWrt are you using and what version of the hardware? I have a version 1 device, which uses just eth0.

I'm using version 3, firmware is from https://openwrt.org/toh/tp-link/tl-wr902ac_v3 https://downloads.openwrt.org/releases/21.02.1/targets/ramips/mt76x8/openwrt-21.02.1-ramips-mt76x8-tplink_tl-wr902ac-v3-squashfs-tftp-recovery.bin

I have no idea what you are trying to communicate here. The example you showed above about how you got ping responses does not necessarily indicate that the VLAN configuration was working -- there are many reasons that this could happen if you have any other network interfaces configured on that system.

I'm using this VLAN configuration for almost 2 years now, so I'm sure that it is working and the right device is replying. That's what I wanted to say. I'm 100% sure that the VLAN configuration is working, but currently not with WR902ac.

It does appear that there is a switch in that version of the device, which did surprise me when I looked at the tech data, but I stand corrected.

With that in mind, I would expect that you would need to do something like this:

config switch_vlan
        option device 'switch0'
        option vlan '19'
        option ports '4t 6t'

and then create an interface like this

config interface 'lan'
        option device 'eth0.19'
        option proto 'dhcp'

(the proto could be dhcp or static, but must have an address)

Thanks for your help.
Device should stay in network without VLAN tag and a new interface should be created for vlan 19.
Thats the configuration for CPE210

grafik

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'XXXXX'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'eth0'

config interface 'lan'
        option device 'br-lan'
        option proto 'dhcp'
        option delegate '0'

config interface 'vlan19'
        option proto 'none'
        option device 'br-vlan19'
        option delegate '0'

config device
        option type 'bridge'
        option name 'br-vlan19'
        list ports 'eth0.19'
        option ipv6 '0'

How would I have to adopt this for WR902ac?

I gave an example of how I think it would be done here. If you want to bridge that network so you can connect it with an SSID, you'd probably do it slightly differently:

EDIT: to be clear, the switch config stanza I showed above would still be required.

Sorry my bad.

config switch_vlan
	option device 'switch0'
	option vlan '19'
	option ports '4t 6t'

works perfectly. I misunderstood that this should replace the existing config switch_vlan section.

root@OpenWrt:/etc/config# ip link add link eth0 name eth0.19 type vlan id 19
root@OpenWrt:/etc/config# ifconfig eth0.19 172.16.1.9 netmask 255.255.255.0 up
root@OpenWrt:/etc/config# ping 172.16.1.1
PING 172.16.1.1 (172.16.1.1): 56 data bytes
64 bytes from 172.16.1.1: seq=0 ttl=64 time=1.191 ms
64 bytes from 172.16.1.1: seq=1 ttl=64 time=0.749 ms

The rest I'll figure out tomorrow.

Thank you very much for your fast replys and helpful support.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.