• wlan0 is configured to connect to an internet-connected router and gets an IP via DHCP
  • eth0 is set to a static IP (via /etc/dhcpcd.conf, different net than wlan0) and connected to a net with no router, gateway or DHCP server.


I want to talk to devices connected to eth0 while maintaining internet connectivity through wlan0.


As soon as a cable is connected, the internet connection goes away. The default route is always set to the non-existent gateway of eth0. Manually setting the default route to the gateway of wlan0 works, but I don't want to hardcode this, as wlan0 is connected to different networks with different IPs.

  • How have you "set to a static IP"?
    – Milliways
    Apr 9, 2019 at 1:13

3 Answers 3


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

interface eth0

Change the metric of the interfaces. In /etc/dhcpcd.conf the following setting works:

interface eth0
metric 300

interface wlan0
metric 200

Now the gateway assigned to wlan0 via DHCP will always be the default route (if present).


When I was trying the 2 posts out I added this:

interface eth0

This did not work for me then I tried the next solution:

interface eth0 metric 300

interface wlan0 metric 200

But left the nogateway entry inside the /etc/dhcpcd.conf file, which deactivated the WLAN Adapter when I rebooted. I don't know why, if you choose the metric solution, make sure you remove also the nogateway entry.

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.