Unfortunately the solution provided to a similar question does not seem to apply here; it explains how to override the settings for DHCP. I have 2 static interfaces.

The system was working as expected with a single interface, but in order to access a second network, I added a second interface (it's a VM, and yes, there are reasons why I can't handle the traffic on the current interface).

I shut the VM down to add the new interface, and when it started up, the OS recognized the interface and decided that, since it did not have any configuration information, it would run DHCP - it did, it got an address and (another) default gateway. I updated the config /etc/netplan/01-netcfg-yaml and ran a netplan update. Networkd said the config was "not for us".

So I tried adding the config directly in /etc/systemd/network/11-ens192.network After both a restart of the network and a reboot of the system, despite using the manually assigned IP address, the default route previously supplied va DHCP re-appears.

I've searched every file in the /etc directory and find no mention of the router address - but it keeps reappearing after reboot.

 find /etc -type f -exec grep -H {} \;

I can delete the route from the command line - but it still comes back after a reboot!

How do I get rid of this?

  • I am not sure it helps. Usually I don't configure network parameters via files in Ubuntu, which is not true for other distributions (RedHat/CentOS). When you configure network via GUI, you can find a checkbox Use this connection only for resources on its network. When you check it, route will not be created for this network/adapter. I guess, there must be an option to configure that via netplan files. – nobody Sep 18 '19 at 17:34

Although I had configured a static address which was being applied to the interface, the system was still running DHCP (see /var/lib/NetworkManager/dhclient*) and populating the default route (as well as the DNS servers).

I fixed the problem by removing the interface and all associated config then adding the interface but connected to a vlan with no dhcp rebuilding it (ticking all the relevant checkboxes in nmtui). I now only have one gateway - but there are still issues with the second interface.

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.