there are so many tutorials out there explaining how to setup dhcpd server, in relation to providing ntp suggestions to dhcp clients, that I had always thought that ntp configuration was carried out automatically. Recently I started seeing clock drifts in my local network, so I assume this was a wrong assumption. So I set out to see how can one minimize the ntp client configuration, provided one has carried out the effort to set up ntp-server suggestions through dhcpd.

I have not been able to find much apart from this Ubuntu specific help tutorial https://help.ubuntu.com/community/UbuntuTime . Even here (see paragraph under "Troubleshooting -> Which configuration file is it using?") the information is scarce but it says that if an /etc/ntp.conf.dhcp file is found it will be used instead. First of all the actual location that the writer meant here is /var/lib/ntp/ntp.conf.dhcp as observed in /etc/init.d/ntp , but regardless of that the presence of this file does not guarantee that the ntp will request servers from dhclient. As a result, I have to explicitly add the server clause in ntp.conf.dhcp for my local ntp server. But in that case, why do I even setup ntp settings on the dhcpd server?

This seems to go against intuition, ie setup ntp settings once (ie on the server) and let dhcpd server delegate the information to the clients. How can I minimize (if not avoid altogether), client configuration for the ntp. Alternatively, how can I get ntp information through dhclient.

Is there a cli solution that fits all linux distros?

I assume every client should have the executables of ntpd, but I do not know how to proceed from there.

Thank you

EDIT: ubuntu client verbose output when running manually dhclient:

sudo dhclient -1 -d -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0
Internet Systems Consortium DHCP Client 4.2.4
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/20:cf:30:0e:6c:12
Sending on   LPF/eth0/20:cf:30:0e:6c:12
Sending on   Socket/fallback
DHCPREQUEST of on eth0 to port 67 (xid=0x2e844b8f)
DHCPACK of from
reload: Unknown instance: 
invoke-rc.d: initscript smbd, action "reload" failed.
RTNETLINK answers: File exists
 * Stopping NTP server ntpd
 * Starting NTP server ntpd
bound to -- renewal in 41963 seconds.

The ntpd service is restarted, yet running ntpq -cpe -cas afterwards I still do not see my local ntp server in the list of ntp servers.

Of course my dhcpd server does have option ntp-servers

subnet netmask {
        max-lease-time 604800;
        default-lease-time 86400;
        ignore client-updates;

        option ntp-servers; #self

        ... (many other options)
  • 1
    In my DHCPD server I pass to the clients the NTP server to use with option ntp-servers x.x.x.x – Rui F Ribeiro Dec 4 '16 at 15:27
  • @RuiFRibeiro Hi there, yes this option is indeed part of my dhcpd server. – nass Dec 4 '16 at 15:51
  • 2
    serverfault.com/questions/329596/… may give you some clues. You probably want to look at /etc/dhcp/dhclient-exit-hooks.d/ntp to find the actual filename being used. Make sure that your dhclient.conf file is set up to request ntp-servers as well. – icarus Dec 4 '16 at 17:49
  • You're using Ubuntu as to client? Which version? – roaima Mar 6 '17 at 8:57
  • @roaima client may be ubuntu but a more generic solution would help. If it make things any easier, lets say ubuntu 14.04 LTS is the client in this case. – nass Mar 6 '17 at 9:22

If the dhcp server you are using is configured to provide the ntp-servers option, you can configure your dhclient to request ntp-servers by adding ntp-servers to the default request line in dhclient.conf, as shown at the end of this example from Ubuntu Linux (16.04 now, but was installed as 12.04):

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

/etc/ntp.conf and the information from DHCP will be used to create /etc/ntp.conf.dhcp.

Your ntpd must be told to use /etc/ntp.conf.dhcp if it exists. On the version of Ubuntu that I'm using, this is done via /etc/dhcp/dhclient-exit-hooks.d/ntp. <-- this is the file that tells NTPd to use /etc/ntp.conf.dhcp if it exists, and to just use /etc/ntp.conf if it doesn't.

  • 2
    In Ubuntu 18.04 this file is in /run/ntp.conf.dhcp, you can look up it's location in any event in /etc/dhcp/dhclient-exit-hooks.d/ntp – DustWolf Aug 9 '18 at 13:59

chronyd being used these dayd, yes it still use NTP protocol. You might went to check couple of sources:





I recommend the last 2.

  • 1
    Hi Abdullah, Chrony is a useful alternative to be aware of but your answer doesn't show how it can be used to get DHCP clients to make use of the NTP information provided by a DHCP server. – Anthony Geoghegan Mar 6 '17 at 11:24
  • @AnthonyGeoghegan Hello, If you add it as a comment I would delete my answer, – Abdullah Mar 6 '17 at 11:33
  • Don't just post some links (these tend to rot away) but include the needed information in your answer. – Martin Schröder Aug 15 '18 at 21:05

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.