[Raspberry PI] LAN on both wired and wireless

Hello!

I have a spare Raspberry PI 4B 4GB that I would like to use as a router to test OpenVpn and Wireguard.

To do that, I followed these steps:

  1. Installed OpenWRT.

  2. Purchased an USB antenna and a USB to Ethernet adapter and then downloaded their relative packages - both devices have been correctly identified (as radio1 and eth1, namely).

  3. Connected another computer to the Ethernet port of the RPI (eth0).

  4. Accessed the GUI and created a new wireless network on radio1, then plugged off the other computer from eth0 and connected it through the newly created wireless network on radio1.

  5. Configured eth0 as WAN.

  6. Configured eth1 as LAN.

The router now works perfectly as wired router, using the default ethernet port (eth0) of the RPI as WAN and the additional usb-to-ethernet port (eth1) as LAN. I'm also pretty impressed by the speed - it's well above 250mbps in download.

It appears, however, that setting eth1 as LAN is preventing the wireless network radio1 from working correctly. Whenever I attempt to connect with a wireless device, I am returned an error message stating that they couldn't get an IP address. I would like to have both a wired and wireless connection (e.g. LAN on both eth1 and radio 1), but I haven't figured out how to do that :frowning:

Here are my configuration details:

If this is of any importance, the Raspberry PI is currently behind my main router.

Thank you in advance <3

Setting the wifi network to wan, as in the last picture, is incorrect.

Apologies for that - that was just a last minute attempt I had made to troubleshoot the issue.

Setting it to LAN doesn't change anything, sadly :frowning:

What's s the usb wifi device you're using, anyway?

It's this one: https://amazon.co.uk/gp/product/B01LYUWQZQ/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

It uses the RT5370 chipset and I am sure it works because it actually worked before I moved the LAN to eth1.

Post your /etc/config/network file.

Hello and thanks - here are both the network and wireless files.

[Network]

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 'fd9c:22c2:9d09::/48'                                                                                                                                                                                              
                                                                                                                                                                                                                                             
config interface 'lan'                                                                                                                                                                                                                        
        option proto 'static'                                                                                                                                                                                                                
        option ipaddr '192.168.1.1'                                                                                                                                                                                                          
        option netmask '255.255.255.0'                                                                                                                                                                                                        
        option ip6assign '60'                                                                                                                                                                                                                
        option device 'eth1'                                                                                                                                                                                                                  
        option type 'bridge'                                                                                                                                                                                                                  
                                                                                                                                                                                                                                             
config device                                                                                                                                                                                                                                
        option name 'eth0'                                                                                                                                                                                                                    
                                                                                                                                                                                                                                             
config interface 'wan'                                                                                                                                                                                                                        
        option proto 'dhcp'                                                                                                                                                                                                                  
        option device 'eth0'                                                                                                                                                                                                                  
        option type 'bridge'

[Wireless]

config wifi-device 'radio0'                                                                                                                                                                                                                  
        option type 'mac80211'                                                                                                                                                                                                                
        option path 'platform/soc/fe300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'                                                                                                                                                        
        option channel '36'                                                                                                                                                                                                                  
        option band '5g'                                                                                                                                                                                                                      
        option htmode 'VHT80'                                                                                                                                                                                                                
        option cell_density '0'                                                                                                                                                                                                              
                                                                                                                                                                                                                                             
config wifi-device 'radio1'                                                                                                                                                                                                                  
        option type 'mac80211'                                                                                                                                                                                                                
        option path 'scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0'                                                                                                                                        
        option channel '1'                                                                                                                                                                                                                    
        option band '2g'                                                                                                                                                                                                                      
        option cell_density '0'                                                                                                                                                                                                              
                                                                                                                                                                                                                                             
config wifi-iface 'wifinet0'                                                                                                                                                                                                                  
        option device 'radio1'                                                                                                                                                                                                                
        option mode 'ap'                                                                                                                                                                                                                      
        option ssid 'Pierozzo'                                                                                                                                                                                                                
        option encryption 'psk2'                                                                                                                                                                                                              
        option key 'redacted xd'                                                                                                                                                                                                                
        option network 'lan'

What is the version of OpenWrt? You use the old syntax. Try the following configuration for the lan interface and remove option type 'bridge' from the wan section.

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

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'

If it still doesn't work after restarting the network service, post the output of brctl show

2 Likes

It worked!!! Thank you very much for your help - I really appreciate it <3

1 Like