0

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.

1 Answer 1

2

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 192.0.2.0, that your router is 192.0.2.1, and you want 192.0.2.42 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
  address 192.0.2.42
  netmask 255.255.255.0

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 192.0.2.0/24 dev wlan0
  up ip route add 192.0.2.1/32 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 and acknowledge you have read our privacy policy.

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