Loss of connection when changing VLAN ID

Hi, the following '/etc/config/network' is working the way I want my network to be configured.
If I change the VLAN ID to 100 then it's stop working.
What am I missing?

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

config globals 'globals'

config interface 'lan'
	option ifname 'eth0.1'
	option proto 'static'
	option ipaddr '172.19.200.254'
	option netmask '255.255.255.0'

config interface 'wan'
	option ifname 'eth1'
	option proto 'dhcp'

config interface 'wan6'
	option ifname 'eth1'
	option proto 'dhcpv6'

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

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

I only change those to options:

	option ifname 'eth0.100'
	option vlan '100'

Any help is appriciated.

$ ssh wndr3700v1wan "cat /etc/openwrt_version"
DISTRIB_ID='OpenWrt'
DISTRIB_RELEASE='18.06.1'
DISTRIB_REVISION='r7258-5eb055306f'
DISTRIB_TARGET='ar71xx/generic'
DISTRIB_ARCH='mips_24kc'
DISTRIB_DESCRIPTION='OpenWrt 18.06.1 r7258-5eb055306f'
DISTRIB_TAINTS=''

Please show the output of swconfig dev switch0 help

Please find below the requested output.

$ ssh wndr3700v1wan "swconfig dev switch0 help"
switch0: rtl8366s(RTL8366S), ports: 6 (cpu @ 5), vlans: 4096
      --switch
	Attribute 1 (int): enable_learning (Enable learning, enable aging)
	Attribute 2 (int): enable_vlan (Enable VLAN mode)
	Attribute 3 (int): enable_vlan4k (Enable VLAN 4K mode)
	Attribute 4 (none): reset_mibs (Reset all MIB counters)
	Attribute 5 (int): blinkrate (Get/Set LED blinking rate (0 = 43ms, 1 = 
84ms, 2 = 120ms, 3 = 170ms, 4 = 340ms, 5 = 670ms))
	Attribute 6 (int): max_length (Get/Set the maximum length of valid 
packets (0 = 1522, 1 = 1536, 2 = 1552, 3 = 16000 (9216?)))
	Attribute 7 (int): green_mode (Get/Set the router green feature)
	Attribute 8 (none): apply (Activate changes in the hardware)
	Attribute 9 (none): reset (Reset the switch)
      --vlan
	Attribute 1 (string): info (Get vlan information)
	Attribute 2 (int): fid (Get/Set vlan FID)
	Attribute 3 (ports): ports (VLAN port mapping)
      --port
	Attribute 1 (none): reset_mib (Reset single port MIB counters)
	Attribute 2 (string): mib (Get MIB counters for port)
	Attribute 3 (int): led (Get/Set port group (0 - 3) led mode (0 - 15))
	Attribute 4 (int): green_port (Get/Set port green feature (0 - 1))
	Attribute 5 (int): pvid (Primary VLAN ID)
	Attribute 6 (unknown): link (Get port link information)

Thanks.

The VLAN implementation in OpenWrt can be a little puzzling at times. While the switch hardware can often support 4096 VLANs, the driver may be limited to a smaller number and uses a "lookup table" to get the parameters for a specific VLAN.

option vlan, the way I think of it, is an index for a table lookup, which happens to default the option vid to the same number. I personally make it a habit to specify vlan and vid both, as well as pvid on the ports. pvid, at least for my switch and its driver, corresponds to the vlan index, not the VLAN tag.

Edit: Hmmm, interesting -- While my switch shows a limited number of VLANs from the driver, I don't see a similar limit on yours.

switch0: ag71xx-mdio.0(Atheros AR8327), ports: 7 (cpu @ 0), vlans: 128

Hence my question for the help output. It does not indicate the existence of a vid option therefor we can assume a 1:1 mapping of VIDs to vlan table indizes.

@jd65534 - you might want to try setting option enable_vlan4k 1 in the global switch section, otherwise IDs are capped to 16 iirc.

Thank you, adding 'option enable_vlan4k' in the section 'config switch'
seems to do the trick.:

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

I'm wondering, given my hardware, should I stick with 'enable_vlan4k' or
should I specify 'vid/pvid'?
If the latter, I would appriciate a working example. :slight_smile:

If you can specify "just" the VLAN ID in one place, that seems a lot easier to maintain!

1 Like

It is indeed. :-p

Thanks again for all the help.

1 Like