#StackBounty: #configuration #dhcp #ntp #ntpd #dhclient how do you set up a linux client to use ntp information provided through dhcp?

Bounty: 50

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

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)

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.