Being stupid, or Ubiquiti Nanostation VLAN SWCONFIG broken?

So, on a Ubiqity Nanostation M2 XW, I am still fighting the switch, and I dug a bit deeper. It seems I am unable to set any port to be part of two VLANS with one tagged and one untagged
I am trying this with both V21 as V19, seems to behave the same.

When I set port 1 & 5 (which are the two actual ports on the device) to be tagged for VLAN 180, they become tagged in VLAN 1 too.

And when I set them as untagged for VLAN 1, they dissapear from VLAN 180 completely

And then back to setting it tagged in VLAN 180, it again becomes tagged in VLAN 1 too, etc etc.

While tracing this problem, I descended from LUCI via /etc/config/network to direct use of swconfig, and the problem seems to be best shown by the following:

Am I doing something wrong? Is this a bug?
Or also usable to me, does anyone know how to put this switch into a working non-managed switch (I would be OK with doing all the VLAN in the CPU, just like on the XM variant of Ubiqity devices)

root@OpenWrt:/etc/config# swconfig dev switch0 show | tail
        link: port:5 link:up speed:100baseT full-duplex auto
VLAN 1:
        vid: 1
        ports: 0t
VLAN 2:
        vid: 2
        ports: 0t
VLAN 3:
        vid: 180
        ports: 0t 1t 5t
root@OpenWrt:/etc/config# swconfig dev switch0 vlan 1 set ports '0t 1 5'
root@OpenWrt:/etc/config# swconfig dev switch0 set apply
root@OpenWrt:/etc/config# swconfig dev switch0 show | tail
        link: port:5 link:up speed:100baseT full-duplex auto
VLAN 1:
        vid: 1
        ports: 0t 1 5
VLAN 2:
        vid: 2
        ports: 0t
VLAN 3:
        vid: 180
        ports: 0t
root@OpenWrt:/etc/config# swconfig dev switch0 vlan 3 set ports '0t 1t 5t'
root@OpenWrt:/etc/config# swconfig dev switch0 set apply
root@OpenWrt:/etc/config# swconfig dev switch0 show | tail
        link: port:5 link:up speed:100baseT full-duplex auto
VLAN 1:
        vid: 1
        ports: 0t 1t 5t
VLAN 2:
        vid: 2
        ports: 0t
VLAN 3:
        vid: 180
        ports: 0t 1t 5t
root@OpenWrt:/etc/config# swconfig dev switch0 vlan 1 set ports '0t 1 5'
root@OpenWrt:/etc/config# swconfig dev switch0 set apply
root@OpenWrt:/etc/config# swconfig dev switch0 show | tail
        link: port:5 link:up speed:100baseT full-duplex auto
VLAN 1:
        vid: 1
        ports: 0t 1 5
VLAN 2:
        vid: 2
        ports: 0t
VLAN 3:
        vid: 180
        ports: 0t
root@OpenWrt:/etc/config#

A non managed switch doesn’t have vlans. It runs all or noting on all ports.

Not all swconfig supported switches (or their corresponding swconfig drivers) support tagged + untagged operation on a port.

Is swconfig on this device offering a pvid option? Can you post the complete output of swconfig dev switch0 help ?

1 Like

@flygarn12 Since both ports are going to be trunk ports, having all or nothing is just fine. The core router will tag the VLAN. This switch can pass everything regardless of tags (or not), and the CPU can pick out the correct tag for the correct SSID. The switch does not need to do anything.

Just in fact, as the previous XM version of the NanoStation M2 did, which was switchless.

@jow: This one seems to do support mixed tagging. Or at least, native OpenWRT has the typical OpenWRT setup where CPU is set tagged to VLAN1 (LAN) and VLAN2 (WAN) and then untagged to the actual WAN and LAN ports

It does seem to use PVID, but I am not sure I understand why that is important.
This is the full output of a native (factory reset) OpenWRT switch config:

root@OpenWrt:~# swconfig dev switch0 show
Global attributes:
        enable_vlan: 1
        ar8xxx_mib_poll_interval: 0
        ar8xxx_mib_type: 0
        enable_mirror_rx: 0
        enable_mirror_tx: 0
        mirror_monitor_port: 0
        mirror_source_port: 0
        arl_table: address resolution table
Port 1: MAC c4:71:54:09:e7:6d

Port 0:
        mib: ???
        pvid: 0
        link: port:0 link:up speed:100baseT full-duplex
Port 1:
        mib: ???
        pvid: 2
        link: port:1 link:up speed:100baseT full-duplex auto
Port 2:
        mib: ???
        pvid: 0
        link: port:2 link:down
Port 3:
        mib: ???
        pvid: 0
        link: port:3 link:down
Port 4:
        mib: ???
        pvid: 0
        link: port:4 link:down
Port 5:
        mib: ???
        pvid: 1
        link: port:5 link:down
VLAN 1:
        vid: 1
        ports: 0t 5
VLAN 2:
        vid: 2
        ports: 0t 1
root@OpenWrt:~# swconfig dev switch0 help
switch0: mdio.0(Atheros AR8236), ports: 6 (cpu @ 0), vlans: 16
     --switch
        Attribute 1 (int): enable_vlan (Enable VLAN mode)
        Attribute 2 (none): reset_mibs (Reset all MIB counters)
        Attribute 3 (int): ar8xxx_mib_poll_interval (MIB polling interval in msecs (0 to disable))
        Attribute 4 (int): ar8xxx_mib_type (MIB type (0=basic 1=extended))
        Attribute 5 (int): enable_mirror_rx (Enable mirroring of RX packets)
        Attribute 6 (int): enable_mirror_tx (Enable mirroring of TX packets)
        Attribute 7 (int): mirror_monitor_port (Mirror monitor port)
        Attribute 8 (int): mirror_source_port (Mirror source port)
        Attribute 9 (string): arl_table (Get ARL table)
        Attribute 10 (none): flush_arl_table (Flush ARL table)
        Attribute 11 (none): apply (Activate changes in the hardware)
        Attribute 12 (none): reset (Reset the switch)
     --vlan
        Attribute 1 (int): vid (VLAN ID (0-4094))
        Attribute 2 (ports): ports (VLAN port mapping)
     --port
        Attribute 1 (none): reset_mib (Reset single port MIB counters)
        Attribute 2 (string): mib (Get port's MIB counters)
        Attribute 3 (none): flush_arl_table (Flush port's ARL table entries)
        Attribute 4 (int): pvid (Primary VLAN ID)
        Attribute 5 (unknown): link (Get port link information)
root@OpenWrt:~#

The pvid things was brainfart, I wanted to suggest to simply tag the ports everyewhere and then set pvid to 1 on the ports you want to be untagged, but would solve only RX, not TX.

That is not possible. You have to define each VLAN in the switch for that tag to be able to pass through. In other words any packets entering the switch with an unknown tag will be dropped.

That is only if you have VLAN turned on. If you turn it off, it passes everything based on MAC address only. It becomes a dumb switch

I'm not sure of that. It may become a switch of untagged packets and drop tagged packets, as some standalone unmanaged switches do.

Hmm, I am not sure if there are some unmanaged switches that do so, nor if this switch would do so (I will let you know later)

But in my experience, all cheap unmanaged switches I tried/have, including several smart switches with VLAN turned off (Netgear GS108Ev2), pass both tagged and untagged indiscriminately.

1 Like

Ok, so it works.

That is: SWCONFIG still does not work, still unsure if it is a bug or a limitation of the switch (that you cannot have a VLAN tagged on some, and untagged on other ports)

@mk24 : But completely disabling the XW switch, making it a dumb switch, will pass through all traffic, tagged and untagged, allowing the CPU to deal with it, just like the older XM variant did.

Some hints for others (and myself in the future)

  • You must have option enable_vlan '0' in /etc/network, merely leaving it out will not disable it.
  • You must then make the normal br-lan over eth0 and not eth0.2
  • You also cannot have wan anymore (like anyone uses that on a dedicated WiFi AP)

What I did extra is, I completely removed the switch section from the /etc/network, and instead added some hardcoded swconfig statements to /etc/rc.local. This has several advantages:

  • The config then becomes fully identical to a XM config, so I can mix and copy backup files
  • Luci does not show the switch anymore reducing the chance of accidentally changing it
  • If you do a /etc/init.d/network restart, it will not touch the switch anymore, and the connectivity survives the restart

The /etc/rc.local:

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

# Remove VLAN ability from internal switch, all VLAN control from CPU
# Note this also means you should replace eth0.1 to eth0 in br-lan definition
# Not sure why I still need to set the vlans, when I disable it immediately 
#    afterward, but it seems needed
sleep 4
swconfig dev switch0 vlan 1 set ports '0t 5'
swconfig dev switch0 vlan 2 set ports '0t 1'
swconfig dev switch0 set enable_vlan 0
swconfig dev switch0 set apply

exit 0
2 Likes

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