I've got a Raspberry Pi connected to my home network router via Ethernet, it currently also accesses the internet through this. I would like the Pi to stay a member of my home network, to be able to SSH in etc., but use its own, separate internet connection via WiFi instead. I've never dealt with this level of networking on Linux - How would I approach this?


This is really about routing. You have two internet-attached networks. Both will configure a "default route" using DHCP to configure your raspberry pi. Since this is for home networking there shouldn't be any "static routes" on your network besides the default route.

So a really trivial way to do what you want is to re-configuring your ethernet networking so that it doesn't use DHCP. Instead you configure it with a static IP on your home network. This will mean it can directly talk to anything on your network but will not attempt to send anything to the internet through your home network.

There are different ways to configure networking on different versions of linux. I believe your raspberry pi (Raspberry PI OS or Raspbian) should use the same as Debian. See here: Network Configuration - Debian Wiki

According to the link above you will need to edit the file /etc/network/interfaces/. It currently should read something like:

auto eth0
iface eth0 inet dhcp

You should edit this for eth0 (your wired network interface) with a static IP. You first should pick a new IP. You can use the same IP as the raspberry PI already is on or your can pick a new one that is not used by anything else on your network.

Edit /etc/network/interfaces to say something like this (where the PI's new IP will be Make sure the first three numbers match the same as other machines on your network:

auto eth0
iface eth0 inet static

DO NOT specify a gateway ... mentioned in the link above. That's the thing we specifically want to avoid by manually configuring it.

After editing the easiest thing to do is to reboot the PI to get it to use the new configuration.

  • 1
    Excellent information, thank you! As I've found out, in current Raspbian versions the DHCP configuration can be found in /etc/dhcpcd.conf. I've set a static IP address without static routes for eth0 by adding interface eth0 static ip_address= – Stefan Dec 20 '20 at 17:33

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.