VLAN (tagged, untagged) configuration on OpenWrt and BPI-R3

Hello,

It’s me again !

I have a problem configuring VLANs. I would like to have a default (untagged) vlan on the LAN ports and multiple tagged VLANs on those same ports. The goal is to be able to change the VLAN of the equipment either by configuring the network card or by a managed switch connected to one of these LAN ports.

Here is my setup:

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 'fd21:20a3:0d40::/48'

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

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

config device
        option name 'br-wan'
        option type 'bridge'
        list ports 'eth1'
        list ports 'wan'

config device
        option name 'eth1'
        option macaddr '96:38:90:xx:xx:xx'

config device
        option name 'wan'
        option macaddr '96:38:90:xx:xx:xx'

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

config interface 'wan6'
        option device 'br-wan'
        option proto 'dhcpv6'
        option auto '0'
        option reqaddress 'try'
        option reqprefix 'auto'

config device
        option name 'wlan0'

config interface 'dmz'
        option proto 'static'
        option ipaddr '192.168.101.254'
        option netmask '255.255.255.0'
        option device 'br-lan.101'

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

Once the configuration of the network card is done (VLAN ID), I no longer have a network (even in static address).

I followed the wiki tutorials ([OpenWrt Wiki] VLAN) and some posts but it doesn’t work whatever the method used… I specify that I am on a BPI-R3 board with the latest snapshot version of OpenWrt.

Thank you in advance for your help :slight_smile:

As we are using DSA to configure the switch chip, please see https://openwrt.org/docs/guide-user/network/dsa/converting-to-dsa

It’s good, it’s working properly. In fact, I had two problems. One of them was the wrong configuration (I mixed the two methods), the second one was that I had restricted the DHCP to listen on the lan interface… So all my tests were wrong.

Now, I have the default vlan with an untagged card and as soon as I tag my card, the tagged vlan pass correctly.

I also removed the wlan interfaces as explained in the wiki.

Thanks for the link which got me thinking. I had done anything…

Here is my working configuration (the BaseT wan port is used as an additional LAN interface in my case):

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 packet_steering '1'
        option ula_prefix 'fd21:20a3:0d40::/48'

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

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

config device
        option name 'eth1'
        option macaddr '96:38:90:xx:xx:xx'

config device
        option name 'wan'
        option macaddr '96:38:90:xx:xx:xx'

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

config interface 'wan6'
        option proto 'dhcpv6'
        option auto '0'
        option reqaddress 'try'
        option reqprefix 'auto'
        option device 'eth1'

config device
        option name 'wlan0'

config bridge-vlan
        option device 'br-lan'
        option vlan '2'
        list ports 'lan1:u*'
        list ports 'lan2:u*'
        list ports 'lan3:u*'
        list ports 'lan4:u*'
        list ports 'sfp2:u*'
        list ports 'wan:u*'

config bridge-vlan
        option device 'br-lan'
        option vlan '3'
        list ports 'lan1:t'
        list ports 'lan2:t'
        list ports 'lan3:t'
        list ports 'lan4:t'
        list ports 'sfp2:t'
        list ports 'wan:t'

config bridge-vlan
        option device 'br-lan'
        option vlan '4'
        list ports 'lan1:t'
        list ports 'lan2:t'
        list ports 'lan3:t'
        list ports 'lan4:t'
        list ports 'sfp2:t'
        list ports 'wan:t'

config bridge-vlan
        option device 'br-lan'
        option vlan '5'
        list ports 'lan1:t'
        list ports 'lan2:t'
        list ports 'lan3:t'
        list ports 'lan4:t'
        list ports 'sfp2:t'
        list ports 'wan:t'

config interface 'dmz'
        option proto 'static'
        option device 'br-lan.5'
        option ipaddr '192.168.2.254'
        option netmask '255.255.255.0'
1 Like

I wonder about interface naming…have you changed it?

You have lan1-lan4/wan and sfp2.

My dts (where afair daniel inherited from) have lan0-lan3/wan for rj45 ports and lan4 for second sfp. First sfp is eth1 (seems like same as yours) because there is no naming possible in mainline linux without patch.

Edit: seems default openwrt naming. But this differs to other mtk router boards like bpi-r2/r64 (and rockchip r2pro).

https://github.com/openwrt/openwrt/blob/master/target/linux/mediatek/dts/mt7986a-bananapi-bpi-r3.dts#L187

@dangowrt how is your upstreaming plan for r3 dts? Should i upstream (afaik mmc and trng is still missing)