How to persist the routing table? Or disable eth0 as the default gateway?


#1

I want a very simple task: to disable eth0 as the default gateway. (I have wlan0 configured for that purpose.) The command is trivial:

sudo route del default dev eth0

and it works, but some time later the routing table gets reverted to the previous state. This happens on reboot and sometimes also during snap install.

How do I make this routing table change persistent?
Or how do I permanently disable eth0 as the default gateway?

I tried adding the above command as a post-up hook in a file in /etc/network/interfaces.d/, but apparently this is ignored.

Thanks!