I was attempting to follow this answer, and configured my dhcpcd file for a static Ethernet IP address, which works, and I can connect to it over SSH - but I would like to simultaneously have the wifi connected via DHCP to a network, and the internet go over the wifi (no, I am not trying to do any fancy internet sharing over Ethernet, just plain SSH/VNC)

Is there anything I need to do in particular or pay attention to in order to make this configuration work? my wifi ended up dying once I changed the dhcpcd file (i.e. unable to lookup any server)

I also looked at this answer but I couldn't figure out a way to get it to work with the metric, I suspect it's because I am editing the interfaces file after making changes in the dhcpcd file, but I don't see a way around that.


The first article you are referencing is full of errors. I just corrected some of them.

Set up your Ethernet static IP address in /etc/network/interfaces, but do not give it a default route. Let's assume that your home network is, that your router is, and you want for your Ethernet interface and you want a DHCP-assigned address for the Wireless interface.

Now, for the complication: if you have both interfaces on the same network, by default they could both be used to connect to local machines. This is not what you want, though. You want local traffic to go over Ethernet, and traffic to the rest of the Internet to go over WiFi.

In your /etc/network/interfaces, configure eth0 to have a local static address, but note how you are not giving it a default gateway.

iface eth0 inet static

Then you want wlan0 to be configured by DHCP, but not to be used for local traffic:

iface wlan0 inet dhcp
  up ip route delete dev wlan0
  up ip route add dev wlan0

The first "ip route..." line is necessary to tell the system never to route traffic to local machines over the wireless interface. However, you still need to be able to access the router, which is where the second "ip route..." line comes in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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