Skip to main content
1 of 3
milez
  • 115
  • 2
  • 8

Raspberry Pi uses wrong network interface

I am trying to make my Pi accessible via SSH regardless of which wireless network it is connected to. For this end I have setup a static IP address to the wlan0 interface. Problem is that I cannot SSH to the Pi, ping it from other devices or ping anything in the network from the Pi. However, I can browse internet and ping addresses such as www.stackexchange.com from the Pi.

The problem goes away if I shutdown the eth0 interface with sudo ifconfig eth0 down. Then everything works perfectly. However, eth0 is back and running after a reboot. How can I direct all traffic to prefer the wlan0 interface instead of (not connected) ethernet?

I have the model 3b and am running Raspbian Jessie. My network/interfaces file

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

At the end of my dhcpcd.conf I have

interface wlan0
static ip_address=192.168.0.240/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1

and 192.168.0.240 is the address I try to ping/connect to.

When I ping other devices from the Pi while eth0 is active, I can see it tries to ping from the address of the ethernet, although the cable is not plugged and wifi should be used. This is how I figured to disable it and it seems to be the cause of the problem. Moreover, upon booting I get the message.

Waiting for network for 110 additional seconds

In a nutshell: Pi seems to use wrong network interface, how to fix?

milez
  • 115
  • 2
  • 8