I have a fresh install of ubuntu server 17.10, however the problem may affect previous versions, but this is the first time I have encountered this situation.

The server is running 2 separate network cards, one for internal local network communications (trusted), the other is a public (untrusted) connection to the internet with the ISP.

In the past, I have always configured the internal connection as static, and without a default gateway, as the external card would be provided via DHCP from my ISP (static lease).


  version: 2
  renderer: networkd
      dhcp4: no
      dhcp6: no
      addresses: [192.168.1.xx/24]
        addresses: [,]
      dhcp4: yes
      dhcp6: no

Now this worked fine as I did not provide a gateway4 line in the eth0 configuration so it bound the default gateway from the ISP and worked fine.

I have since decided I wanted to use static leases for the server(s) in my homelab, and have configured as such on the internal router. But when I set up the netplan config as dhcp for both devices, it adds the default gateway for both interfaces (which makes sense because both DHCP servers are providing a gateway).

> route -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    100    0        0 eth0         173.xxx.xxx.1         UG    100    0        0 eth1
173.xxx.xxx.0   U     0      0        0 eth1
173.xxx.xxx.1 UH    100    0        0 eth1   U     0      0        0 eth0 UH    100    0        0 eth0

How can I setup netplan so the eth0 adapter (internal) to disregard the default gateway provided by the DHCP server (without removing the gateway on the DHCP server itself as other machines still need a default gateway).

  • Great question! This is a shortcoming in netplan, it's indeed missing a way to skip setting a default gateway for DHCP. Please file a bug here: bugs.launchpad.net/netplan/+filebug – Mathieu Trudel-Lapierre Mar 14 '18 at 3:01
  • I went to file a bug today, but I found Bug #1724666 that is very similar at its core, so I filed affects-me-too and added a comment. :) – Don Faulkner Mar 21 '18 at 17:15
  • Thank you both for your suggestions and actions with this. I had reverted to changing my infrastructure to use only one dhcp (static lease) which is required by my current ISP, along with static IP addresses that I can control internally without default gateways (as described above). While it is not the optimum (preferred) method, it works for now. The downside is when addresses change on the internal network (which happens rarely), they are not centrally managed. Very disappointed with Ubuntu's decision to change to netplan with this very basic problem (among other reasons). – Aaron Murray Mar 24 '18 at 18:40
  • That bug says it's fixed, so is there an answer now? – detly Jun 10 '18 at 9:59
  • Meant to ping @DonFaulkner in that last comment. – detly Jun 10 '18 at 11:10

Netplan v0.90 introduces a new set of options: dhcp4-overrides (pull request).

So, if your version of the netplan.io package is new enough (see available versions here), you can use this:

      dhcp4: yes
        use-routes: false

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.