I just did a fresh install of Ubuntu 16.04 (Xenial). I've configured /etc/network/interfaces to bring up the wlan interface automatically using DHCP:

auto lo
iface lo inet loopback

auto wlp2s0
iface wlp2s0 inet dhcp
  wpa-ssid SSID
  wpa-psk "password"

This sort of works: the IP is configured normally, but the default gateway is not set. After boot I always have to run route add default gw manually. Any idea of what can possibly be wrong? I could swear this setup used to work fine on older versions...

  • 1
    Are you sure that you're receiving default gateway configuration from your DHCP server? Could you please post the output of ifconfig -a and grep "option routers" /var/lib/NetworkManager/*? Thank you
    – t11z
    May 3, 2016 at 20:02
  • Why not add simply add "gateway" ?
    – Jos
    May 4, 2016 at 11:41

2 Answers 2


I'm experiencing the same issue on Ubuntu Server 16.04. After troubleshooting, my issue stems from my DHCP server also providing a Classless Static Route (DHCP option 121, rfc3442-classless-static-routes in ISC DHCP), from a Microsoft DHCP server (Windows Server 2008 R2).

Looking at /sbin/dhclient-script, if at least one classless static route is provided to the DHCP client, it disregards the router setting, hence no default route set.

# if we have $new_rfc3442_classless_static_routes then we have to
# ignore $new_routers entirely

My "fix" is to add another classless static route to the Windows DHCP server. So:

  • Destination:
  • Network Mask:
  • Router:

(once added, the Network Mask is automagically changed to

I do have short DHCP lease expiry (15 minutes) and have not had any complaints from other Linux or Windows users on the network since adding the new route, so I figure the change should not cause major issues.

As I'm too new to comment:

  • @t11z My lease file is /var/lib/dhcp/dhclient.ens32.leases, option routers is present and valid.
  • @Jos Although a workaround, your suggestion defeats the purpose of utilizing DHCP to provision network settings. If the default gateway IP address changes in the future, affected machines will need to be updated manually.
  • I had the same issue with specific static routes. I just commented out the if statement in the script that made it ignore the router setting, and now it's all working fine, both the router and the routes.
    – PLN
    Jul 6, 2018 at 0:20
  • I had the same problem, adding the "default" route via "" works. Does anyone know why this is neccecary?
    – konairius
    Dec 22, 2019 at 9:01

I am configuring a Raspberry Pi as a router and ran into the same problem. I fixed it by editing the file /etc/dhcpcd.conf.

Open the file and look for the line:

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes

I simply commented out "option classless_static_routes"

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
# option classless_static_routes

I am now getting an automatic default route set by the DHCP server.

A similar thing could be attempted with dhclient by editing the file /etc/dhcp/dhclient.conf and looking for this line:

request subnet-mask, broadcast-address, time-offset, routers,
        domain-name, domain-name-servers, domain-search, host-name,
        dhcp6.name-servers, dhcp6.domain-search,
        netbios-name-servers, netbios-scope, interface-mtu,
        rfc3442-classless-static-routes, ntp-servers;

and removing the request for rfc3442-classless-static-routes.

  • 1
    Unless of course, you need the classless-static-routes too...
    – ivanivan
    Jan 13, 2019 at 2:34
  • Fixed for me, here a Raspberry image too, but one that is used in several networks including some where I have no access to the DHCP settings. Too bad I can't have the classless static routes anymore, but that's less of a problem than losing all external access.
    – Luc VdV
    Jan 6, 2020 at 11:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .