[Raspberry PI] WAN on both wired and wireless

Hello!

I had a spare Raspberry PI 4B 4GB laying around so I decided to turn it into a travel router with OpenVpn.

To do that, I followed a Network Chuck tutorial which included these steps:

  1. Install OpenWRT.
  2. Purchase USB antenna and 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. SSHed in and changed IP address from the default one, adjusted wireless network on radio0, then disconnected the other computer from eth0 and connected through the wireless network on radio0.

The router now works fine as wireless travel router, using the default radio (radio0) of the RPI as WAN and the additional usb-to-wifi port (radio1) as LAN.

It appears, however, that setting eth1 as WAN is not allowing me to connect to a wired connection (ex. ethernet port in a hotel room or even a port on my switch at home that I know is serving up internet).

Whenever I attempt to connect to a wired connection by plugging a cable into eth1, I get an error message stating that it couldn't get an IP address and the connection shows as not connected to the internet. I have checked that these are working ports I am attempting to connect to.

I would like to be able to choose between having a wired or wireless connection (e.g. WAN on either eth1 or radio0), serving up that connection to radio1 (LAN), but I haven't figured out how to make that happen.

I should also note that I have the Travlemate package installed but disabled at the moment.

Here are my configuration details:

-Interfaces, WAN, LAN, Wireless, Wireless Network: https://imgur.com/a/YvH19Qg

-/etc/config/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 'fd5d:5814:ec0a::/48'                                                                                                                         
        option packet_steering '1'                                                                                                                                      
                                                                                                                                                                        
config device                                                                                                                                                           
        option name 'br-lan'                                                                                                                                            
        option type 'bridge'                                                                                                                                            
        list ports 'eth0'                                                                                                                                               
                                                                                                                                                                        
config interface 'lan'                                                                                                                                                  
        option device 'br-lan'                                                                                                                                          
        option proto 'static'                                                                                                                                           
        option ipaddr '10.71.71.1'                                                                                                                                      
        option netmask '255.255.255.0'                                                                                                                                  
        option ip6assign '60'                                                                                                                                           
        option force_link '1'                                                                                                                                           
                                                                                                                                                                        
config interface 'wwan'                                                                                                                                                 
        option proto 'dhcp'                                                                                                                                             
        option peerdns '0'                                                                                                                                              
        list dns '208.67.220.220'                                                                                                                                       
        list dns '1.1.1.1'                                                                                                                                              
                                                                                                                                                                        
config interface 'vpnclient'                                                                                                                                            
        option proto 'none'                                                                                                                                             
        option device 'tun0'                                                                                                                                            
                                                                                                                                                                        
config interface 'trm_wwan'                                                                                                                                             
        option proto 'dhcp'                                                                                                                                             
        option metric '100'                                                                                                                                             
                                                                                                                                                                        
config interface 'trm_wwan6'                                                                                                                                            
        option device '@trm_wwan'                                                                                                                                       
        option proto 'dhcpv6'                                                                                                                                           
                                                                                                                                                                        
config device                                                                                                                                                           
        option name 'eth0'                                                                                                                                              
                                                                                                                                                                        
config device                                                                                                                                                           
        option name 'wlan0'                                                                                                                                             
                                                                                                                                                                        
config device                                                                                                                                                           
        option name 'wlan0'                                                                                                                                             
                                                                                                                                                                        
config device                                                                                                                                                           
        option name 'tun0'                                                                                                                                              
                                                                                                                                                                        
config device                                                                                                                                                           
        option name 'wlan1'                                                                                                                                             
                                                                                                                                                                        
config device                                                                                                                                                           
        option name 'eth1'

-/etc/config/wireless

config wifi-device 'radio0'                                                                                                                                           
        option type 'mac80211'                                                                                                                                        
        option path 'platform/soc/fe300000.mmcnr/mmc_host/mmc1/mmc1:0001/mmc1:0001:1'                                                                                 
        option whmode '11g'                                                                                                                                           
        option htmode 'HT20'                                                                                                                                          
        option short_gi_40 '0'                                                                                                                                        
        option band '2g'                                                                                                                                              
        option cell_density '0'                                                                                                                                       
        option channel 'auto'                                                                                                                                         
                                                                                                                                                                      
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.1/1-1.1:1.0'                                                                 
        option channel '1'                                                                                                                                            
        option band '2g'                                                                                                                                              
        option htmode 'HT20'                                                                                                                                          
        option disabled '0'                                                                                                                                           
                                                                                                                                                                      
config wifi-iface 'default_radio1'                                                                                                                                    
        option device 'radio1'                                                                                                                                        
        option network 'lan'                                                                                                                                          
        option mode 'ap'                                                                                                                                              
        option ssid 'Birds_Travel'                                                                                                                                    
        option encryption 'psk2'                                                                                                                                      
        option key '**************'                                                                                                                                     
                                                                                                                                                                      
config wifi-device 'radio2'                                                                                                                                           
        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 htmode 'HT20'                                                                                                                                          
        option disabled '0'                                                                                                                                           
                                                                                                                                                                      
config wifi-iface 'default_radio2'                                                                                                                                    
        option device 'radio2'                                                                                                                                        
        option network 'lan'                                                                                                                                          
        option mode 'ap'                                                                                                                                              
        option ssid 'OpenWrt'                                                                                                                                         
        option encryption 'none'                                                                                                                                      
                                                                                                                                                                      
config wifi-iface 'wifinet2'                                                                                                                                          
        option device 'radio0'                                                                                                                                        
        option mode 'sta'                                                                                                                                             
        option network 'wwan'                                                                                                                                         
        option ssid 'NI_2.0'                                                                                                                                          
        option encryption 'psk2'                                                                                                                                      
        option key ‘**************’

FYI the Raspberry PI is currently connected to my home network wirelessly and serving up internet through radio1 just fine. The moment I plug in an eth cord into my usb-to-ethernet adapter it all goes sideways.

Any help you can provide in much appreciated! Thank you in advance :grinning:

You need to create an interface, e.g

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

Then attach that interface to the wan firewall zone.

2 Likes

Yes, and disable the wireless WAN STA when using a wired WAN.

Delete the extra radio. That results from plugging the USB wifi adapter into a different physical port, it will register as a new radio. Always plug the adapter into the same port.

1 Like

Ok, thanks! So deleting both these entries from /etc/config/wireless will accomplish that for me, correct?

config wifi-device 'radio2'                                                                                                                                           
        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 htmode 'HT20'                                                                                                                                          
        option disabled '0'                                                                                                                                           
                                                                                                                                                                      
config wifi-iface 'default_radio2'                                                                                                                                    
        option device 'radio2'                                                                                                                                        
        option network 'lan'                                                                                                                                          
        option mode 'ap'                                                                                                                                              
        option ssid 'OpenWrt'                                                                                                                                         
        option encryption 'none'

Sorry if that is a complete noob question, just want to be sure before I go poking around under the hood and royally screw something up.

This worked! Thanks for your help!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.