Ubuntu: NTP not receiving useful peers


I have several machines running 16.10, both servers and laptops, all on the same network. All of them occasionally have the same problem with NTP. The clock drifts slightly out of sync and when I check the NTP peers there is only one and it's not being used.

> ntpstat   unsynchronised     polling server every 8 s    > sudo ntpq -p       remote           refid      st t when poll reach   delay   offset  jitter  ==============================================================================   10.x.x.x        .INIT.          16 u    -   64    0    0.000    0.000   0.000  

I've tried with the default Ubuntu ntp.conf server list (from 0 to 3) of

pool 0.ubuntu.pool.ntp.org iburst  ...  

And also with the standard ntp list (also from 0 to 3) like so:

server 0.pool.ntp.org  ...  

But the issue is the same. The IP address of the unused server is always the same on all the machines, regardless of their ntp.conf.

I can temporarily solve it by making a change to ntp.conf and restarting ntpd but would like to fix the source of the problem so that useful peers are found automatically.

What can I try to fix this?


The servers and pools in /etc/ntp.conf were being ignored because the default Ubuntu configuration gives precedence to NTP servers found via DHCP.

There is a script, /etc/dhcp/dhclient-exit-hooks.d/ntp which creates a copy of /etc/ntp.conf at /var/lib/ntp/ntp.conf.dhcp, removes any specific servers and pools requested in the original and substitutes servers found via DHCP.

When /etc/init.d/ntp is run, if it finds a newer configuration at /var/lib/ntp/ntp.conf.dhcp it will launch NTP with that. This can be disabled in many ways, but I chose to comment out that behaviour in /etc/init.d/ntp like so:

# if [ /var/lib/ntp/ntp.conf.dhcp -nt /etc/ntp.conf ]; then  #       NTPD_OPTS="$NTPD_OPTS -c /var/lib/ntp/ntp.conf.dhcp"  # fi  

Then reload daemon scripts and restart NTP:

sudo systemctl daemon-reload  sudo systemctl restart ntp  

Now when NTP is started, the DHCP-discovered NTP servers are ignored and the pools are used to find working NTP servers.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »