I have an issue with network configuration in ubuntu server 18.04. My host does not apply default gateway route from dhcp server.

My netplan config is:

network:
version: 2
ethernets:
    enp0s8:
       addresses: []
       dhcp4: true
       optional: true

ip route:

172.16.0.0/22 via 192.168.26.1 dev enp0s8 proto dhcp metric 100 
172.20.0.0/24 via 192.168.26.1 dev enp0s8 proto dhcp metric 100 
192.168.0.0/16 via 192.168.26.1 dev enp0s8 proto dhcp metric 100 
192.168.26.0/24 dev enp0s8 proto kernel scope link src 192.168.26.227

netplan ip leases enp0s8:

ADDRESS=192.168.26.227
NETMASK=255.255.255.0
ROUTER=192.168.26.1
SERVER_ADDRESS=172.16.0.100
NEXT_SERVER=172.16.0.100
T1=1000000
T2=1750000
LIFETIME=2000000
DNS=172.16.0.250 172.16.0.100
NTP=172.16.0.1
DOMAINNAME=domain.name
ROUTES=172.20.0.0/24,192.168.26.1 172.16.0.0/22,192.168.26.1 192.168.0.0/16,192.168.26.1
CLIENTID=ffaf818f7d00020000ab11546f22c88c98f9a0

I also tried to add gateway4 option into netplan config - it has no effect.

But if I manually add route to default gw - everything starts to work fine.

  • Could you please provide the result of command sudo dhclient <INT> -v (manually search for a DHCP IP/GW). – Eraseth Nov 20 at 14:05
  • Maybe you need to specify the "renderer". Currently, netplan support NetworkManager or Systemd-networkd. – Eraseth Nov 20 at 14:23
  • I have the same problem as you it seems – Christopher Perrin Nov 23 at 8:57
  • Why are you specifying 'addresses: []' which should be the default? Does removing this line change the behavior? – slangasek Dec 5 at 9:35

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.