Default Routes

Hi,

Not a 100% noob here, but still learning my way around how network settings are controlled in linux generally. I mostly use CentOS/Fedoras but I absolutely love DietPi for Raspberries :slight_smile:

Here’s the behaviour I observe:

When I configure my Ethernet NIC to a static address via the dietpi menu a default route is added sending IP traffic out of that gateway and device, even though the WiFi adapter is enabled and connected. Because I’m wanting to use the WiFi adapter for internet access and then the Ethernet NIC to access the Pi locally from a laptop or whatever, I need the default route to be via the WiFi. No problem, I can just SSH to the Pi, delete the default route that’s there and add the one via the WiFi adapter, however, of course, this is not persistent.

My work around is to disable the Ethernet NIC via the dietpi menu, but then re-enable is in /etc/network/interfaces.

My question is, what is changing the routing table in DietPi? What can I do to change this and make it persistent? Also, googling I see that in Debian, “/etc/network/interfaces” seems to be legacy and /etc/dhcpcd.conf is sued instead, however I don’t have that on my dietpi so I assume this is not the case for dietpi, is that correct? I installed dhcpcd with apt-get but maybe I should remove it?

I think I just need pointing in the right direction in terms of where to read, happy to read and learn myself, but having difficulty figuring out how the routes are being changed.

Thanks in advance!

Ben

default NIC is always eth0 in dp because it’s the fastest link. when you set it up, it makes default route, and when you set up nic2 / wlan it routes through the existing default route dp configured on eth 0 . I think this is opaque and illogical operation for a system that mainly is used by home lab / sbc users, or server users, all of which have multiple NICs in use simultaneously.

Only solution I have found so far is to ignore DP for network config entirely and make your own default routes in debian.

For example:
https://www.cyberciti.biz/faq/howto-debian-ubutnu-set-default-gateway-ipaddress/