3

Total NOOB to Linux and Pi and have spent the entire day and now well into the night trying to fix a vexxing issue and hope to get some help with this.

The Pi is to be used inside a LAN that does not have internet access. I want to connect to the LAN via ethernet. The router uses Mac addressing to provide the Pi with a static IP (192.168.1.159)

The Pi is also needing to connect using WiFi dongle to a mobile hotspot. This should give the Pi the ability to connect both to the LAN and to the net.

So what I have found so far is that I can see the local network just fine, but if I want to access the internet via hotspot (or other wireless network) I must first remove the ethernet cable. This won't work as the purpose of the Pi is to take some files sent to it over the LAN and then move them onto a server outside the local network (expecting it to happen over the wifi).

I have read and tried dozens of the configurations posted here and elsewhere without success and am just lost at this point. Hopefully after taking a look somebody can help me.

from /etc/network/interfaces:

source-directory /etc/network/interfaces.d
auto lo

iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

from /etc/wpa_supplicant/wpa_supplicant.conf :

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="SSID"
    key_mgmt=WPA-PSK
    psk="PASSWORD"
}

please let me know what other info you might need. Been trying to get this going for way too long and finding Linux obtuse and frustrating.

edr
  • 31
  • 2

1 Answers1

1

The most likely problem is that your Ethernet DHCP server announces that it is a gateway while it is not. Your hotspot does the same but it actually is a gateway so your RPi can use either of them and in your case it chooses the unwanted one. You can see which route is default at the moment by running ip route. You can useip route command to alter the route table as well but that will not be permanent.

You could try ifmetric package to set the preferred route. Another way would be to disable the Ethernet DHCP server announcing that it is a gateway. And lastly, you could just use a static IP on RPi Ethernet without specifying a gateway, to prevent the DHCP request from occurring.

Mohammad Ali
  • 2,383
  • 1
  • 11
  • 18
kuzavas
  • 111
  • 1