and in the /etc/init.d/network i added the bellow snippet is this right to do?
EXTRA_COMMANDS="setmyvlan delmyvlan"
EXTRA_HELP=<<EOF
SET a vlan with configs from the config file network
DEL a vlan with configs from the config file network
EOF
CONFIGURATION=network
setmyvlan(){
config_load "${CONFIGURATION}"
local device
local vlanid
local pvid
local untagged
config_get device myvlan device
config_get vlanid myvlan vlanid
config_get pvid myvlan pvid
config_get untagged myvlan untagged
echo "adding a vlan to the device:$device with an ID: $vlanid"
bridge vlan add dev $device vid $vlanid
bridge vlan
}
You don't need to edit /etc/init.d/network or script anything to add a vlan. It's enough to edit /etc/config/network, then run /etc/init.d/network reload. The section you added does not look correct though. Was it generated by a LLM? The equilvalent of the command bridge vlan add dev eth0 vid 10 would be
config device
option type '8021q'
option ifname 'eth0'
option vid '10'
option name 'eth0.10'
config interface
option device 'eth0.10'
option proto 'none'
Almost certainly this is entirely wrong -- in fact, I don't think anything in your post would work as expected.
Bridge VLANs are required for DSA. They can be used in certain circumstances on non-DSA devices, but typically it is better to use swconfig syntax (on swconfig devices) or dotted notation on devices with individually routed ports.
The example provided below is not actually the equivalent for a bridge VLAN as it uses dotted notation. The 802.1q stanza is not necessary and the interface may or may not be correct, depending on the hardware in use. Usually the interface will have a name, even when it is unmanaged.
The best way to move forward in this situation is to see the default config from the device:
Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have: