ER-X-SFP: VLANs not working properly with kernel 5.4

I finally found the time to sit down and get the router working. It's a freifunk router using multiple tagged vlans for meshing and at the same time also acting as just a switch for other vlans.

eth0

  • OLSR vlans for rooftop devices. 201 - 206
  • management vlan 5
  • client network vlan 10

eth1

  • OLSR vlan for streetlevel devices; 211
  • management vlan 5
  • client vlan 10

eth2

  • OLSR vlan for streetlevel devices; 211
  • management vlan 5
  • client vlan 10

The following vlans are passed unmanaged through the switch on eth1 and eth2.
11 12 300 400 500 501 1000

eth3 is untagged on vlan 5
eth4 and eth5 is untagged on vlan 10

I call the script /root/vlans.sh from rc.local. This woks at boot, but not if I run /etc/init.d/network restart. If anyone has a suggestion on how to make this survive a network restart, please let me know.

/root/vlans.sh

ip link set eth0 up
ip link set eth1 up
ip link set eth2 up
# not eth3 eth4 eth5
#ip link set eth3 up
#ip link set eth4 up
#ip link set eth5 up

# create the bridge
ip link add name vlans type bridge                
ip link set dev vlans type bridge vlan_filtering 1
ip link set dev eth0 master vlans
ip link set dev eth1 master vlans
ip link set dev eth2 master vlans
#ip link set dev eth3 master vlans
#ip link set dev eth4 master vlans
#ip link set dev eth5 master vlans

# clear out vlan 1
bridge v del dev eth0 vid 1
bridge v del dev eth1 vid 1
bridge v del dev eth2 vid 1
#bridge v del dev eth3 vid 1
#bridge v del dev eth4 vid 1
#bridge v del dev eth5 vid 1
bridge v del dev vlans self vid 1

# set vlans eth0
bridge v add dev eth0 vid 5
bridge v add dev eth0 vid 10
bridge v add dev eth0 vid 50
bridge v add dev eth0 vid 201                   
bridge v add dev eth0 vid 202                  
bridge v add dev eth0 vid 203                  
bridge v add dev eth0 vid 204                  
bridge v add dev eth0 vid 205                  
bridge v add dev eth0 vid 206                  

# set vlans eth1
bridge v add dev eth1 vid 5                                                  
bridge v add dev eth1 vid 10                                                   
bridge v add dev eth1 vid 11                                                   
bridge v add dev eth1 vid 12                                                   
bridge v add dev eth1 vid 211                                                   
bridge v add dev eth1 vid 300                                                   
bridge v add dev eth1 vid 400                                                   
bridge v add dev eth1 vid 500
bridge v add dev eth1 vid 501
bridge v add dev eth1 vid 1000                                                   

# set vlans eth2
bridge v add dev eth2 vid 5                                                   
bridge v add dev eth2 vid 10                                                   
bridge v add dev eth2 vid 11                                                   
bridge v add dev eth2 vid 12                                                   
bridge v add dev eth2 vid 50                                                   
bridge v add dev eth2 vid 211                            
bridge v add dev eth2 vid 300
bridge v add dev eth2 vid 400                                                   
bridge v add dev eth2 vid 500                                                   
bridge v add dev eth2 vid 501                                                   
bridge v add dev eth2 vid 1000                                                   

bridge v add dev vlans self vid 5                                             
bridge v add dev vlans self vid 10                                             
bridge v add dev vlans self vid 11                                             
bridge v add dev vlans self vid 12                                             
bridge v add dev vlans self vid 50                                             
bridge v add dev vlans self vid 201                                             
bridge v add dev vlans self vid 202                                             
bridge v add dev vlans self vid 203                                             
bridge v add dev vlans self vid 204                                             
bridge v add dev vlans self vid 205
bridge v add dev vlans self vid 206
bridge v add dev vlans self vid 211
bridge v add dev vlans self vid 300                                             
bridge v add dev vlans self vid 400                                             
bridge v add dev vlans self vid 500                                             
bridge v add dev vlans self vid 501                                             
bridge v add dev vlans self vid 1000                                             

/etc/config/network

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 'AA:BB:CC::/60'

config interface 'mgmt'
	option type 'bridge'
	option ifname 'vlan5 eth5 eth4'
	option proto 'static'
	option netmask '255.255.255.0'
	option delegate '0'
	option ipaddr '192.168.5.1'

config interface 'dhcp'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '64'
	option ip6hint 'f'
	option ipaddr '10.0.0.1'
	option ifname 'vlan10 eth3'
	option dns '46.182.19.48 80.67.169.40 194.150.168.168 2001:910:800::12'
	option type 'bridge'

config interface 'north'
	option proto 'static'
	option ifname 'vlan201'
	option ipaddr '10.0.1.2011'
	option netmask '255.255.255.252'
	option ip6assign '64'
	option ip6hint '1'

config interface 'nano_vlan_202'
	option proto 'static'
	option ifname 'vlan202'
	option ipaddr '10.0.1.202'
	option netmask '255.255.255.255'
	option ip6assign '64'
	option ip6hint '2'

config interface 'ost'
	option proto 'static'
	option ifname 'vlan203'
	option ipaddr '10.0.1.233'
	option netmask '255.255.255.252'
	option ip6assign '64'
	option ip6hint '3'

config interface 'beuth'
	option proto 'static'
	option ifname 'vlan204'
	option ipaddr '10.0.1.237'
	option netmask '255.255.255.252'
	option ip6assign '64'
	option ip6hint '4'

config interface 'nano_vlan_205'
	option proto 'static'
	option ifname 'vlan205'
	option ipaddr '10.0.1.205'
	option netmask '255.255.255.255'
	option ip6assign '64'
	option ip6hint '5'

config interface 'nano_vlan_206'
	option proto 'static'
	option ifname 'vlan206'
	option ipaddr '10.0.1.206'
	option netmask '255.255.255.255'
	option ip6assign '64'
	option ip6hint '6'

config interface 'meshlan'
	option proto 'static'
	option ifname 'vlan211'
	option ipaddr '10.0.1.211'
	option netmask '255.255.255.255'
	option ip6assign '64'
	option ip6hint 'b'

config interface 'tunl0'
	option ifname 'tunl0'
	option proto 'none'

config device             
       option type '8021q'      
       option ifname 'vlans' 
       option vid '1'          
       option name 'vlan1'            
                                        
config device                       
       option type '8021q'           
       option ifname 'vlans'  
       option vid '5'                                                       
       option name 'vlan5'
                            
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '10'                                                          
       option name 'vlan10'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '11'                                                          
       option name 'vlan11'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '12'                                                          
       option name 'vlan12'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '50'                                                          
       option name 'vlan50'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '201'                                                          
       option name 'vlan201'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '202'                                                          
       option name 'vlan202'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '203'                                                          
       option name 'vlan203'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '204'                                                          
       option name 'vlan204'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '205'                                                          
       option name 'vlan205'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '206'                                                          
       option name 'vlan206'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '211'                                                          
       option name 'vlan211'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '300'                                                          
       option name 'vlan300'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '400'                                                          
       option name 'vlan400'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '500'                                                          
       option name 'vlan500'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '501'                                                          
       option name 'vlan501'      
                             
config device                        
       option type '8021q'            
       option ifname 'vlans'  
       option vid '1000'                                                          
       option name 'vlan1000'

Update

There has been some developments and new my best working configuration is based off of https://github.com/openwrt/openwrt/pull/2942#issuecomment-629374851

Even though the setup above works, the example linked above accomplishes that same and look a lot cleaner.

2 Likes