Add vlan on GL-MT300N-V2

Hello!

How do I add a vlan to the switch of GL-MT300N-V2?
I tried with luci and by adding this line to /etc/config/network:

config switch_vlan
 	option device 'switch0'
 	option ports '0t 1t 6t'
 	option vlan '100'

both brick'ed the device on 22.03.3 and 22.03.4

let's see the complete network config file.
Also, what's the output from:

ubus call system board

ubus call system board:

	"kernel": "5.10.161",
	"hostname": "pool",
	"system": "MediaTek MT7628AN ver:1 eco:2",
	"model": "GL-MT300N-V2",
	"board_name": "glinet,gl-mt300n-v2",
	"rootfs_type": "squashfs",
	"release": {
		"distribution": "OpenWrt",
		"version": "22.03.3",
		"revision": "r20028-43d71ad93e",
		"target": "ramips/mt76x8",
		"description": "OpenWrt 22.03.3 r20028-43d71ad93e"
	}

it's the default config:

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 'fda4:23cc:cfbc::/48'

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

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'

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

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

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0 6t'

with vlan part from my posting:

config switch_vlan
	option device 'switch0'
	option ports '0t 1t 6t'
	option vlan '100'

Try this:

config switch_vlan
	option device 'switch0'
	option ports '0t 1t 6t'
	option vlan '3'
	option vid '100'

EDIT: You may need to add the vid to the other VLANs (1 and 2)

When I add these lines the router is also bricked.
But shouldn't luci add the right lines?

Sometimes it is required to have the vlan and VID different (vlan here being the index into the list of VIDs).

Try using a VLAN <=15.

I tried with:

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

but it did not help.

I guess it must be an hardware failure.

Thank you for your efforts!

What about if you just do this:

config switch_vlan
	option device 'switch0'
	option ports '0t 1t 6t'
	option vlan '3'

not working...

to be more precise:

Router is reachable at 2nd port:

config switch_vlan
	option device 'switch0'
	option vlan '3'
	option ports '0t 6t'

Router is reachable at 1st port:

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

Router is not reachable:

config switch_vlan
	option device 'switch0'
	option vlan '3'
	option ports '0t 1t 6t'

Is there any praticular reason why, use taged ports?

Evidently, to add VLAN. Untagged vlan is only one.

It is rather strange, have you added correct tabs and empty lines?

Im Well aware of that but i dont think that @rwalli understands how vlans work

He puts the ports in to a taged State, if he just wants to isolete the ports to a difrent lan he can just go with untaged

And we if he iven has setup for the vlan on the opewr interfaces tab

If in the router interfaces tab there is no settings for the vlan there is no way to acsess the router settings or anything outside that vlan :slight_smile:

If posible give more info about your setup :v:

Try also to add 'switch_port' section:

config switch_vlan
	option device 'switch0'
	option vlan '3'
	option ports '0t 1t 6t'

config switch_port
	option device 'eth0'
	option port '1'
	option pvid '1'

config switch_port
	option device 'eth0'
	option port '0'
	option pvid '2'
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 'fda4:23cc:cfbc::/48'

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

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'

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

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

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0 6t'

From what i see there is lack of configuration for that vlan
The switch has the vlan but the router dosent know what to do with it :confused:

It is default configuration, it works normally.

Yeah but he is trying to make vlan with id 100 and there is no config for what the router shoud do with that vlan

For example the wan port has:

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option device 'eth0.2'
	option proto 'dhcpv6'

With the switch having the fowoling config

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0 6t' 

In @rwalli he is creating a vlan on the switch but the router dosent have a config for it, dosent know what to do with the vlan :slight_smile:

It is not problem, router should create it at least, and operate, as switch.

1 Like

I know (it is not my first vlan configuration and its also not working if i add a interface for it) but its working on all my other routers and i guess it should not bricked if I add a line in the switch configuration with luci.
I've done this with approx 10 different routers with no problem.

I guess next step should be setting up a serial tty for debugging, but i think it's not worth if it's only me with this problem.

Thank you all for your help!