VLAN Tagging for GL-B1300 - /etc/config/network configuration not propagated to internal switch

Hi all,
I (new to openwrt, but a network professional) tried to use a GL-B1300 for home networking. I wanted to span more than one network internal (e.g. dmz, interal,...) and wanted to use a trunk (on port 3) up to my switch and split the networks there. After long tries I found out that neither editing /etc/config/network nor luci worked.
My network file (port 3 of a GL-B1300 is the one on the opposite side of the power supply):

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

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

config switch_vlan
        option device 'switch0'
        option vid '3'
        option vlan '200'
        option vid '200'
        option ports '0t 3t'
        list comment 'vlan 200: DMZ'

config interface 'dmz'
        option ifname 'eth0.200'
        option proto 'static'
        option ipaddr '10.0.3.1'
        option netmask '255.255.255.0'

If you do a service network restart: no effect.

If you do the configuration by swconfig everything works as desired:

swconfig dev switch0 vlan 3 set vid 200
swconfig dev switch0 vlan 3 set ports '0t 3t'
swconfig dev switch0 vlan 4 set vid 500
swconfig dev switch0 vlan 4 set ports '0t 3t'
swconfig dev switch0 set apply

After the configuration this is the result of a swconfig dev switch0 show:

VLAN 1:
        vid: 1
        ports: 0 4
VLAN 2:
        vid: 2
        ports: 0t 5
VLAN 3:
        vid: 200
        ports: 0t 3t
VLAN 4:
        vid: 500
        ports: 0t 3t

I placed the commands in a shell-script (setVLANs.sh)
The problem is, if you do a 'service network restart' afterwards (I suppose that is what luci does, when you hit 'apply') the VLAN configuration is lost.

From now on I do a service network restart && ./setVLANs.sh and I have the VLANs on my switch working over the trunk port.

Is this a bug or a feature or am I doing something fundamentally wrong?

Regards Alex

You have duplicate vids and an out of range vlan here. I believe that will cause this config to fail

7

Thank you for your suggestions. I tried now the following:

  1. Changed /etc/config/networks to:

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd56:caee:726d::/48'

config interface 'lan'
	option type 'bridge'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '10.0.2.1'
	option ifname 'eth0'

config interface 'wan'
	option ifname 'eth1'
	option proto 'static'
	option ipaddr '10.0.1.19'
	option netmask '255.255.255.0'
	option gateway '10.0.1.1'
	option dns '10.0.1.1'

config interface 'wan6'
	option ifname 'eth1'
	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 vid '1'
	option ports '0 4'

config switch_vlan
	option device 'switch0'
	option vid '3'
	option vlan '200'
	option ports '0t 3t'
	list comment 'vlan 200: DMZ'

config interface 'dmz'
	option ifname 'eth0.200'
	option proto 'static'
	option ipaddr '10.0.3.1'
	option netmask '255.255.255.0'

config interface 'dmz6'
	option ifname 'eth0.200'
	option proto 'dhcpv6'

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

config interface 'intern'
	option ifname 'eth0.500'
	option proto 'static'
	option ipaddr '10.0.4.1'
	option netmask '255.255.255.0'

  1. run service network restart --> no change
  2. run swconfig swconfig dev switch0 load network (thats what is run by /lib/network/switch.sh)--> no change

swconfig dev switch0 show
gives

VLAN 1:
        vid: 1
        ports: 0 4
VLAN 2:
        vid: 2
        ports: 0t 5

Is it a bug?

Regards Alex

OK solved - to stupid.

Mixed vid and vlan..

Correct conf:

config switch_vlan
	option device 'switch0'
	option vid '200'
	option vlan '3'
	option ports '0t 3t'
	list comment 'vlan 200: DMZ'

grrr.

Thanks for the help

Alex

1 Like

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