So, here’s how it goes. I have an old Linksys router which I have my raspberry pi connected to via Ethernet. I SSH to it via my laptop or phone by connecting to my router via WiFi. I want to be able to use the WiFi chip on the Pi to connect to a nearby router which is connected to the internet so that I can download packages or whatever I may need on the pi while at the same time using the Ethernet connection to my offline router so I can SSH to it.

Here is the output of ifconfig

    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet  netmask  broadcast
    inet6 fe80::c2:b104:6cc3:b0fe  prefixlen 64  scopeid 0x20<link>
    ether b8:27:eb:99:7f:6e  txqueuelen 1000  (Ethernet)
    RX packets 110  bytes 10715 (10.4 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 865  bytes 74304 (72.5 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet  netmask
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

    wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet  netmask  broadcast
    inet6 fe80::9076:675d:2f7:651a  prefixlen 64  scopeid 0x20<link>
    ether b8:27:eb:cc:2a:3b  txqueuelen 1000  (Ethernet)
    RX packets 5795  bytes 1276439 (1.2 MiB)
    RX errors 0  dropped 75  overruns 0  frame 0
    TX packets 33  bytes 5412 (5.2 KiB)
    TX errors 0  dropped 0 overruns 0          carrier 0  collisions 0

When I run

    iw wlan0 link

I get this

    Connected to 50:60:28:40:c9:b1 (on           wlan0)
    SSID: whcc
    freq: 5745
    RX: 2041558 bytes (7502 packets)
    TX: 4884 bytes (33 packets)
    signal: -52 dBm
    tx bitrate: 162.0 MBit/s

    bss flags:
    dtim period:    1
    beacon int:     100

So to me it looks like I should be connected to the internet, so I test that with a ping

    ping -c 5 www.google.com

And I get

    ping: www.google.com: Temporary failure in name resolution

Here’s the output of

    ip route

default via dev eth0 src metric 202 
default via 192.168.0kernel.1 dev wlan0 src metric 303 dev wlan0 proto  scope link src metric 303 dev eth0 proto kernel scope link src metric 202 

So I’m not sure what the next step is, because the internet isn’t working even though it says it’s connected to the WiFi. If you need more info let me know!

  • Who knows? What did you do to set it up? Post the output of ip route
    – Milliways
    Feb 26, 2019 at 22:56
  • @Milliways posted at end, thanks Feb 26, 2019 at 23:07
  • Try posting the output without line folding. It appears you have 2 default routes - we still don't know what you did (or why you don't just use the 1 router).
    – Milliways
    Feb 26, 2019 at 23:11
  • @Milliways I don’t use just the one because I keep it all in one backpack and have a sort of mobile local network Feb 26, 2019 at 23:19
  • @Milliways is that what you meant by without line folding? I copy pasted the output and didn’t format Feb 26, 2019 at 23:20

2 Answers 2


You still haven't explained how you set up networking, but you have 2 default routes, and the Ethernet has higher priority.

As Ethernet isn't connected to internet you can disable this by adding the following at the bottom of :- /etc/dhcpcd.conf

interface eth0

Ideally you should properly configure the router to not advertise.

  • I have not set up any networking yet, it’s all through the router that it is plugged into by the Ethernet. Everything else is a fresh image of raspbian-lite, apart from the added lines to dhcpcd.conf that you told me about. Feb 26, 2019 at 23:59
  • @LoganKuykendall networking setup is not just on the Pi, it includes the devices to which it is connected. You presumably have left the routers at their default configuration, and have 2 DHCP servers (which is almost always a bad idea). I use 2 routers in my home network, but the secondary router has DPCP disabled, and uses the DHCP server in the primary router. Configuring routers is not really on-topic for this site.
    – Milliways
    Feb 27, 2019 at 0:18
  • As far as I can tell this isn’t a router problem. My Pi isn’t connecting to the internet using the WiFi chip built in. For example: Router A is my mobile router without an internet connection, it connects just fine to that via Ethernet and I can SSH into it from other devices connected to Router A, Router B is any router I have SSID and PSK to on my Pi. I want to connect to Router A via Ethernet while being connected to Router B via WiFi and have internet, but my Pi isn’t accessing the internet, so it must be a Pi problem Feb 27, 2019 at 0:45
  • @LoganKuykendall No - the problem is you have 2 default routes (because both routers tell the Pi to use them as default) and it picks the one with the lowest metric. You can fix this by configuring the router OR by telling the Pi to ignore the gateway on Ethernet (as suggested in the answer).
    – Milliways
    Feb 27, 2019 at 0:54
  • @LoganKuykendall A better solution would be to connect Router A to Router B and use the DHCP server in Router B.
    – Milliways
    Feb 27, 2019 at 0:57

I'm noticing your WiFi has a /23 netmask but your wired network uses /24.

Is there a compelling reason why you used a /23 netmask on one of the networks. They should probably both agree (and probably should be /24).

The reason for this is that the network stack uses the netmask to determine if a remote host is on the same subnet vs. a different subnet (in which case it will need to send packets to a router to forward to the remote host). But with your particular network numbers and masks, it will end up getting confused into thinking they are not he same subnet ... when in reality they are not.

Your network configuration is unclear (and possibly unnecessarily complicated). I suspect you may be able to simplify he setup. WiFi and wired clients can be mixed on the same subnet ... and I'm wondering if you thought they needed to be separated.

Basically one of your computers thinks both machines are on the same subnet. The other machine thinks they are both on different subnets.

  • 1
    There is no problem with the netmask. They clean define two subnets: with interface eth0 and with interface wlan0. You must only have attention about the address ranges.
    – Ingo
    Feb 27, 2019 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.