I've read dozens of tutorials and documents on how to configure my Raspberry Pi 3 network properly, but I can't get it to work the way I want. I imagine that the question below is a bit redundant but I couldn't find a suitable solution for my case (or I couldn't totally understand the solutions I did find).

I have the following setup:

Internet <--> Router | <--(WiFi)--> RPi3   (occasionally)
                     | <--(WiFi)--> Laptop (occasionally)
RPi3 <--(wired)--> Laptop (always)

I want to be able to always connect to my RPi3 through the wired connection just because I will be moving both of them to places where the router is not accessible. Besides, I've let the router/DHCP server to automatically provide an IP for my wlan interface and, because there's several joining and leaving the WiFi network I don't always get the same IP. So, in order to check the assigned IP for my RPi every time, I connect to it through the wired interface.

However, I need that whenever the RPi3 is connected to the WiFi network, this becomes the default network (to access the outside world).

That being said, the last important characteristic is that I have my laptop's Ethernet interface set up with static IP I need that for other, unrelated, reasons. In order to connect to the RPi3, I decided to also set up a static IP for its eth0 interface within the same subnet than my laptop:

Now, what happens is that when the Ethernet connection is available between my RPi and laptop, my RPi is unable to reach the outside world. In particular, it is unable to resolve DNS queries.

This is my /etc/dhcpcd.conf setup, whereas /etc/network/interfaces is left unchanged:

interface eth0
static ip_address=
static routers=
static domain_name_servers=
  • Router IP:
  • Laptop eth0 IP: (static, note different subnet)
  • RPi wlan0 IP: 192.168.0.*** (assigned by the router's DHCP server)
  • RPi eth0 IP: (static)

Using Wireshark I could see that ARP requests from the RPi3 (asking who has are sent to my laptop, which I believe is not correct. Is there a way to solve my network issue just by modifying dhcpcd.conf or I need to define some sort of "bridge" between the two subnets?

Edit: More details:

$ ip -4 addr show dev wlan0 | grep inet
inet brd scope global wlan0

$ ip -4 addr show dev eth0 | grep inet
inet brd scope global eth0

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    202    0        0 eth0         UG    303    0        0 wlan0   U     303    0        0 wlan0 UH    202    0        0 eth0   U     202    0        0 eth0
  • 2
    I think you mean RPi eth0 IP (static) for your last bullet ? Try removing the routers and domain_name_servers entries from your eth0 interface - then it should only be able to access other machines on the 192.168.1.x subnet and when the WiFi is connected it will route everything else... Sep 28, 2016 at 10:58
  • This has nothing to do with Raspberry Pi. If you want networking to work just leave it alone. If you want to change the way IP routing works get appointed to the appropriate industry forum.
    – Milliways
    Sep 28, 2016 at 11:13

1 Answer 1


As suggested by @KennetRunner, the solution was simply to remove the routers and domain_name_servers lines from dhcpcd.conf.

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.