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,