Setting 150 VLAN in TSW202

Hello,

I’m thinking about select TSW202 as a PoE switch to power and connect tens of WiFi APs spread around a building.
TSW202 is very compact and wall mount on a DIN rail.

My WiFi system rely on Radius-assigned VLANs (when a WiFi user provides its login/password, the Radius system assign her/him a VLAN). I’ve got around 150 VLANs.

When trying to set 150 VLAN using GUI, I couldn’t enter a VLAN Id range instead of a simple VLAN Id as I would in some other devices.

Can I simply change /etc/config/network file with CLI to get what I’m after ? If positive, after changing /etc/config/network content, which CLI command shall I after to make sure changes are effective ?

Best regards

Hello,

Apologies for the delay. You’re correct that currently there’s no function in the WebUI to specify a VLAN range when creating VLANs, and they need to be added manually one by one.

That said, it is possible to configure them manually by editing the /etc/config/network file or by using UCI commands via CLI. For example, adding a VLAN manually to config would look like this:

config bridge-vlan 'vlan2'
    option device 'br0'
    option vlan '2'

Or using UCI commands:

uci set network.vlan2=bridge-vlan
uci set network.vlan2.device='br0'
uci set network.vlan2.vlan='2'

However, doing this manually for 150 VLANs would be highly time-consuming and not be the most optimal approach.

For a more practical and scalable solution, you could use a custom shell script that loops through your desired VLAN range and adds the configurations automatically.
For example, this simple script creates VLANs from 2 to 100 (adjust the range as needed):

#!/bin/ash
for i in $(seq 2 100); do
  uci set network.vlan$i="bridge-vlan"
  uci set network.vlan$i.device='br0'
  uci set network.vlan$i.vlan="$i"
done

uci commit network
/etc/init.d/network restart

Furthermore, here’s a fully working script that can be used for creating, editing, and deleting VLANs: vlan_v2.zip (1.9 KB)

After making your changes, whether through manual config edits, UCI commands, or running a script, run:

/etc/init.d/network restart

to save made changes.

I hope this helps, and let me know how it goes.

Best regards,

Thanks for replying.

Yes using a shell script seems the way to go.

Alternatively, since asking this question here, I discovered the existence of MVRP/GVRP. This protocol (MVRP is the successor of GVRP), if I understand it correctly, allow devices over a L2 network, to exchange VLAN membership data.

I’ve never used MVRP yet so I can’t confirm if it fits my use case.
I’ve been told Linux natively supports MVRP but I don’t know if OpenWRT also supports it.

I would be very curious to read here about MVRP in general or MVRP specifically on OpenWRT/RutOS.

Best regards

Hello,

All useful and detailed information on MRP can be found on the pages below:

Best regards,