Unable to setup VLAN config on new router

My config is fairly standard with a WAN and LAN setup plus an additional connection to a separate router that gets me to another private network.

On my original Openwrt device which used version 18.something I was able to get it working by creating a VLAN assigned to an interface which connected to the private router and some other VLAN config as I show below.

I have been unable to replicate the config successfully on my new device which is running 24.10.3

I’ve tried various options but nothing seems to work.

I know the terminology and setup between the old and new versions has changed quite a bit so I thought a good starting point was to copy selected parts of /etc/config/network here with the idea that what I’m missing may become apparent. I hope this is ok.

Firstly the relevant (I hope) excerpts from the old working config using Openwrt release 18:

config device

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

config interface 'lan'

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

config device

option name 'eth0.2'
    option macaddr '94:a6:7e:xx:yy:zz'

config interface 'wan'

option device 'eth0.2'
    option proto 'dhcp'
    option hostname '\*'

config switch

option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan

option device 'switch0'
    option vlan '1'
    option ports '0 2 3 6t'

config switch_vlan

option device 'switch0'
    option vlan '2'
    option ports '4 6t'

config switch_vlan

option device 'switch0'
    option ports '1 6t'
    option vlan '10'
    option description 'private'

config interface 'private'

option device 'eth0.10'
    option proto 'dhcp'
    option defaultroute '0'
    option hostname '\*'

config device

option name 'eth0.10'
    option type '8021q'
    option ifname 'eth0'
    option vid '10'

config route

option interface 'private'
    option target 'a.b.c.0/24'
    option netmask '255.255.255.0'
    option gateway 'a.b.c.d'

In the VLANs setting in LuCi it shows “CPU (eth0) as tagged for VLANs 1,2 and 10. The private network router is connected to LAN 3 and has VLANs 1 and 2 ‘off’ while VLAN 10 is ‘untag’. LAN 1 and LAN 2 are ‘untag’ for VLAN 1, VLAN 2 and 10 are ‘off’


On the new Openwrt router running 24.10.3 the relevant extract from /etc/config/network is here:

config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'lan4'
list ports 'sfp2'

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 device
option name 'br-wan'
option type 'bridge'
list ports 'eth1'
list ports 'wan'

config device
option name 'eth1'
option macaddr '46:17:ec:aa:bb:cc'

config device
option name 'wan'
option macaddr '46:17:ec:xx:yy:zz'

config interface 'wan'
option device 'br-wan'
option proto 'dhcp'
option hostname '*'

config device
option type '8021q'
option ifname 'br-lan'
option vid '10'
option name 'br-lan.10'

config interface 'private'
option proto 'dhcp'
option device 'br-lan.10'
option hostname '*'

config route
option interface 'private'
option target 'a.b.c.0/24'
option gateway 'a.b.c.d'

config bridge-vlan
option device 'br-lan'
option vlan '1'
list ports 'lan1'

config bridge-vlan
option device 'br-lan'
option vlan '10'
list ports 'lan4'

This config does not work. When I configure what I think is correct and apply it the validation of Openwrt fails and performs rollback ( I don’t understand this mechanism).

My sought config is a WAN link to my ISP, one ethernet connected to a Cisco router that gets me to the private network I refer here, and the remaining ports are ethernets for the LAN (in practice one of these connects to an unmanaged L2 switch for extra devices).

I would appreciate some pointers on where I am going wrong.

Many thanks.

LA.

You don't need VLANs here (unless you want to attach the secondary interface to a wireless network).

Remove all this.

Then remove lan4 from the br-lan bridge and use it as a device for the private interface.

config interface 'private'
	    option proto 'dhcp'
	    option device 'lan4'
        ...

Hi Pavel.

Thank you so much for the quick reply, and my apologies for not responding sooner.

I did as you suggested and after a bit more investigation I have the config working as desired. My main stumbling block was after configuring lan4 as a routing interface (I thought they were just dumb switch ports and needed a VLAN built on top so layer 3 could be used) whenever I brought it up I got that private connection added as the default route. This overruled the ISP’s DHCP provided routing which was never going to work. I tried manually adding the ISP config as a route but clearly unsatisfactory as I’ve no control over what network config they might have from time to time. Then discovered that there is a ‘set default route’ option for the lan 4 interface. I thought that meant use the default route for this network, not as it seems use AS the default route. Once deselected I then got the routing I needed and the system works.

So the simple config now (with unrelated parts removed) is thus:

config device
option name 'br-lan'
option type 'bridge'
list ports 'lan1'
list ports 'lan2'
list ports 'lan3'
list ports 'sfp2'

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 device
option name 'br-wan'
option type 'bridge'
list ports 'eth1'
list ports 'wan'

config device
option name 'eth1'
option macaddr 'removed'

config device
option name 'wan'
option macaddr 'removed'

config interface 'wan'
option device 'br-wan'
option proto 'dhcp'
option hostname '*'

config interface 'private'
option proto 'dhcp'
option device 'lan4'
option hostname '*'
option metric '0'
option defaultroute '0'

config device
option name 'lan4'
option ipv6 '0'

config route
option interface 'private'
option target 'a.b.c.0/24'
option gateway 'a.b.c.d'

Many thanks again. I really appreciated the help and guidance.

LA.