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 the Pi tries to ping from the address of the ethernet, although there is no ethernet cable attached and I want wifi to 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?
Edit: ifconfig
output
eth0 Link encap:Ethernet HWaddr b8:27:eb:df:e2:1a
inet addr:192.168.43.24 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::8ed2:5c2a:b54f:d28c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:420 errors:0 dropped:0 overruns:0 frame:0
TX packets:121 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:37528 (36.6 KiB) TX bytes:19320 (18.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:88 errors:0 dropped:0 overruns:0 frame:0
TX packets:88 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:7689 (7.5 KiB) TX bytes:7689 (7.5 KiB)
wlan0 Link encap:Ethernet HWaddr b8:27:eb:8a:b7:4f
inet addr:192.168.43.224 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::fc57:9494:65ae:1475/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2547 errors:0 dropped:946 overruns:0 frame:0
TX packets:146 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:316994 (309.5 KiB) TX bytes:17769 (17.3 KiB)
ifconfig
show?