![]() | ![]() |
The first line identifies the server. This is the minimum you'll need. The second establishes which events will be logged. The last line identifies a drift file. This is used by ntpd to store information about how the clock on the system drifts. If ntpd is stopped and restarted, it can use the old drift information to help keep the clock aligned rather than waiting to calculate new drift information. One minor warning about ntpd is in order. If your clock is too far off, ntpd will not reset it. (Among other things, this prevents failures from propagating throughout a network.) This is rarely a problem with computers, but it is not unusual to have a networking device whose clock has never been set. Just remember that you may need to manually set your clock to something reasonable before you run ntpd. ntpdate can be used to do a onetime clock set:server 205.153.60.20 logconfig =syncevents +peerevents +sysevents +allclock driftfile /etc/ntp.drift
ntpdate cannot be used if ntpd is running, but there shouldn't be any need for it if that is the case. ntpq can be used to query servers about their state:bsd2# ntpdate 205.153.60.20 4 Jan 10:07:36 ntpdate[13360]: step time server 205.153.60.20 offset 11.567081 sec
In this example, we have queried a system for a list of its peers. ntptrace can be used to discover the chain of NTP servers, i.e., who gets their signal from whom:bsd2# ntpq -p 172.16.2.1 remote refid st t when poll reach delay offset jitter ============================================================================== *ntp.lander.edu .GPS. 1 u 18 64 173 5.000 -1.049 375.210 CHU_AUDIO(1) CHU_AUDIO(1) 7 - 34 64 177 0.000 0.000 125.020 172.16.3.3 0.0.0.0 16 - - 64 0 0.000 0.000 16000.0 172.16.2.2 0.0.0.0 16 u - 64 0 0.000 0.000 16000.0
Only two servers were involved in this example, but you should get the basic idea. Each of these tools has other features that are documented in their manpages. NTP can be an involved protocol if used to its fullest. Fortunately, a lot of documentation is available. Whatever you want -- information, software, a list of public NTP servers -- the best place to start is at http://www.eecis.udel.edu/~ntp. The work of Dave Mills and others, this is a remarkable site.bsd2# ntptrace 172.16.2.1 NLCisco.netlab.lander.edu: stratum 2, offset 0.009192, synch distance 0.00526 ntp.lander.edu: stratum 1, offset 0.007339, synch distance 0.00000, refid 'GPS '