I have a config script that is configuring the ntp server of a machine (which is running Ubuntu 14.04) by stripping lines matching ^server .*
from /etc/ntp.conf
and adding a new line server new.ntp.address
. Now I want to test that this change is valid and working.
My initial thought was to have new.ntp.address
be my desktop (which is running ntp
) and set my desktop's time to something new, but after some reading I noticed that ntp will reject all but slight changes to the current time. How can I verify that my change to the ntp server config is correct and working?
Per this question, I ran sudo ntpdate -dv <my ip address>
from the client machine I was configuring. The output showed it did not find an npt server because the strata was too high:
$ sudo ntpdate -dv 192.168.12.125
23 Sep 16:30:37 ntpdate[26673]: ntpdate [email protected] Wed Oct 9 19:08:07 UTC 2013 (1)
Looking for host 192.168.12.125 and service ntp
host found : 192.168.12.125
transmit(192.168.12.125)
receive(192.168.12.125)
transmit(192.168.12.125)
receive(192.168.12.125)
transmit(192.168.12.125)
receive(192.168.12.125)
transmit(192.168.12.125)
receive(192.168.12.125)
192.168.12.125: Server dropped: strata too high
server 192.168.12.125, port 123
stratum 16, precision -23, leap 11, trust 000
refid [192.168.12.125], delay 0.02586, dispersion 0.00011
transmitted 4, in filter 4
reference time: 00000000.00000000 Sun, Dec 31 1899 16:00:00.000
originate timestamp: d7cc8124.166c9d3f Tue, Sep 23 2014 16:30:44.087
transmit timestamp: d7cc8124.16e4ba7a Tue, Sep 23 2014 16:30:44.089
filter delay: 0.02586 0.02736 0.02599 0.02586
0.00000 0.00000 0.00000 0.00000
filter offset: -0.00204 -0.00129 -0.00211 -0.00204
0.000000 0.000000 0.000000 0.000000
delay 0.02586, dispersion 0.00011
offset -0.002042
23 Sep 16:30:44 ntpdate[26673]: no server suitable for synchronization found
EDIT1: I used these instructions to fudge the strata on my desktop, which is acting as the ntp server. Now, when I run sudo ntpdate <my ntp server address>
from the client machine it updates its time (in my case I had to set a fairly small but noticeable change to the server time to witness this working, about 55 seconds skew is what I introduced on my desktop). However, when I start ntp
on the client again and try to see it automatically pick up the changes, I'm unable to see it adjust the clock time even though I waited several minutes after starting ntp
(it seemed from googling that the standard polling frequency is 60 seconds). How can I troubleshoot this?
EDIT2: Eventually the clocks did synchronize, but it took significantly longer than a minute. I think this suffices to verify my experiment, but I'm still interested in if there is a better way.