Testing NTP services

Periodically I need to update my systems with new NTP server information. Since I have no idea if the remote servers are well kept, I tend to run ntpdate in test mode prior to starting ntpd or adding ntpdate to root’s crontab. To run ntpdate in test mode, you can use the “-d” option:

$ /usr/sbin/ntpdate -d 192.168.1.1

12 Feb 17:36:36 ntpdate[24068]: ntpdate 4.1.2@1.892 Tue Feb 24 06:32:26 EST 2004 (1)
transmit(192.168.1.1)
receive(192.168.1.1)
transmit(192.168.1.1)
receive(192.168.1.1)
transmit(192.168.1.1)
receive(192.168.1.1)
transmit(192.168.1.1)
receive(192.168.1.1)
transmit(192.168.1.1)
server 192.168.1.1, port 123
stratum 3, precision -18, leap 00, trust 000
refid [192.168.1.1], delay 0.02592, dispersion 0.00000
transmitted 4, in filter 4
reference time:    c97b6a71.b4251202  Mon, Feb 12 2007 17:36:33.703
originate timestamp: c97b6ab2.f2ec3995  Mon, Feb 12 2007 17:37:38.948
transmit timestamp:  c97b6a74.f210f0e9  Mon, Feb 12 2007 17:36:36.945
filter delay:  0.02609  0.02592  0.02594  0.02596 
         0.00000  0.00000  0.00000  0.00000 
filter offset: 62.00322 62.00318 62.00317 62.00316
         0.000000 0.000000 0.000000 0.000000
delay 0.02592, dispersion 0.00000
offset 62.003182

In addition to printing the timestamps, it also provides the offset the clock will be adjusted by. Certain applications dislike the time moving forward or back, which makes the ntpdate test option even more useful.

Leave a Reply

Your email address will not be published. Required fields are marked *