ntpd-- Network Time Protocol daemon
ntpd [-aAbdgLmnPqx] [-c conffile] [-D level]
[-f driftfile] [-k keyfile] [-l logfile] [-p pidfile]
[-s statsdir] [-t key] [-v variable] [-V variable] [-N high] [-r broadcastdelay]
Maintains local time-of-day synchronism with time servers.
ntp.conf at startup or the command line or
-c conffile or
ntpdc to query or change options on the fly.
|-q|| quit after the first time the clock is set (as does |
This will not be sufficient to synchronize the clock.
|-g||disable sanity once. Normally, ntpd exits if the offset exceeds the sanity limit, which is 1000 seconds by default. If the sanity limit is set to zero, no sanity checking is performed and any offset is acceptable. After that, ntpd will exit if the limit is exceeded. used with the -q option.|
|-x|| slew time in all cases (prevents reducing the time). Normally, the time is slewed if the offset is less than the step threshold, (128 ms by default) and stepped if above the threshold.
If the step threshold is set to zero, all offsets are stepped, regardless of value and regardless of the
|-a||Enable authentication mode (default).|
|-A||Disable authentication mode.|
|-c conffile||name of the configuration file. (Disable netinfo?)|
|-d||debugging mode. multiple times, greater detail of display.|
|-D level||debugging level directly. D 9 sample|
|-f driftfile||name of the drift file.|
|-l logfile||name of the log file. The default is the system log facility syslog.|
|-s statsdir||directory path for files created by the statistics facility.|
|-L||Listen to virtual IPs.|
| use broadcast messages. |
use multicast messages on the IP multicast group address 22.214.171.124 (requires multicast kernel).
|-p pidfile||name to record the ntpd's process ID.|
|run the ntpdat a high priority.|
|-P||Override the priority limit set by the operating system.|
|-r delay||default propagation delay . necessary only if the delay cannot be computed automatically by the protocol.|
|-k keyfile||file containing the NTP authentication keys.|
|-t key||Add a key number to the trusted key list.|
|-v variable||Add a system variable listed by default.|
> cat ntp.conf
A useful command is:
sudo ntpd -q -n -g -x -D 9 |more
Hardware incorporates a time component (maintained by a battery) which runs when the power is off.
When the machine is booted, this is used to initialize the
operating system time. After synchronized to a NTP server, the operating system corrects the chip .
If this component is more than 17 minutes from the server time,
exits with a panic message to the system log.
-g overrides this check and the clock will be set to the
server time regardless of the chip time. To protect against broken hardware, such as when
the battery fails or the component becomes defective, once the clock has been set, an error
greater than 1000secs will cause ntpd to exit anyway.
ntpd is first started, the error may cause the clock to be set backwards.
Where this is unacceptable
-x causes slew corrections to be used.
The local clock can take a long time to converge (33 minutes) for each second the clock is outside the acceptable range. attempts to quickly correct the frequency and restore operation to the normal tracking mode.
ntpdis started and the the frequency file does not exist, ntpd enters a special mode designed to quickly adapt. This takes approximately 15 minutes, then the time and frequency are set to nominal values and the ntpd enters normal mode. After one hour the frequency file is updated.
ntpdis started and the file exists, the ntpd frequency is initialized from the file and enters normal mode immediately.
-qis intended for this purpose. ntpd to exit just after setting the clock for the first time. ntpd is run in continuous mode with selected servers in order to measure and record the intrinsic clock frequency offset in the frequency file. It may take some hours for the frequency and offset to settle down. Then the ntpd is stopped and run in one-time mode as required. At each startup, the frequency is read from the file and initializes the kernel frequency.
minpollcommand to a value not less than 16 secs. This value is used for all configured associations, unless overridden by the
minpolloption on the configuration command. that most device drivers will not operate properly if the poll interval is less than 64 s and that the broadcast server and manycast client associations will also use the default, unless overridden.
To increase the minimum interval to
a few tens of minutes and maximum interval to a day, once the
clock discipline loop has stabilized the interval will be increased in steps from the minimum to the
maximum. This assumes the intrinsic clock frequency error is small enough for the discipline
loop correct it. The capture range of the loop is 500 PPM at an interval of 64s decreasing by a factor
of two for each doubling of interval. at a minimum of 1,024 s, for example, the capture range is only
31 PPM. If the intrinsic error is greater than this
ntp.drift will have to be specially tailored to reduce the residual error below this limit. Once this is done, the drift file is
automatically updated once per hour and is available to initialize the frequency on subsequent daemon
restarts. If the system is conserving energy by spinning down the disk or sleeping when idle then the
update is deferred until ntpd terminates.
If umask for
ntpd is zero, it is set to 022 so files are created with rwxr-xr-x.
ntp.conf, ntpdate, ntpdc, ntpq(8),
Local documentation is at file:///usr/share/doc/ntp/index.html
NTP.org is a great reference and discusses choosing a time server to sync to.
Sample output from -D 9some duplicated lines deleted, some lines combined on same line
> cat ntp.conf server 0.us.pool.ntp.org > sudo ntpd -q -g -x -n -d ntpd firstname.lastname@example.org Mon Sep 24 01:42:27 UTC 2007 (1) addto_syslog: precision = 1.000 usec create_sockets(123) bind() fd 20, family 2, port 123, addr 0.0.0.0, flags=9 Added addr 0.0.0.0 to list of addresses addto_syslog: Listening on interface wildcard, 0.0.0.0#123 Disabled bind() bind() fd 21, family 30, port 123, addr ::, flags=1 Added addr :: to list of addresses addto_syslog: Listening on interface wildcard, ::#123 Disabled bind() bind() fd 22, family 30, port 123, addr fe80::1, flags=21 Added addr fe80::1 to list of addresses addto_syslog: Listening on interface lo0, fe80::1#123 Enabled bind() bind() fd 23, family 2, port 123, addr 127.0.0.1, flags=21 Added addr 127.0.0.1 to list of addresses addto_syslog: Listening on interface lo0, 127.0.0.1#123 Enabled bind() bind() fd 24, family 30, port 123, addr ::1, flags=21 Added addr ::1 to list of addresses addto_syslog: Listening on interface lo0, ::1#123 Enabled bind() bind() fd 25, family 30, port 123, addr fe80::219:e3ff:fe32:f8c, flags=17 Added addr fe80::219:e3ff:fe32:f8c to list of addresses addto_syslog: Listening on interface en1, fe80::219:e3ff:fe32:f8c#123 Enabled bind() fd 26, family 2, port 123, addr 192.168.1.8, flags=25 Added addr 192.168.1.8 to list of addresses addto_syslog: Listening on interface en1, 192.168.1.8#123 Enabled init_io: maxactivefd 26 local_clock: time 0 base 0.000000 offset 0.000000 freq 0.000 state 0 key_expire: at 0 peer_clear: at 0 next 1 assoc ID 14360 refid INIT newpeer: 192.168.1.8->126.96.36.199 mode 3 vers 4 poll 6 10 flags 0x201 0x1 ttl 0 key 00000000 local_clock: time 0 base 0.000000 offset 0.000000 freq 0.000 state 1 report_event: system event 'event_restart' (0x01) status 'sync_alarm, sync_unspec, 1 event, event_unspec' (0xc010) auth_agekeys: at 1 keys 1 expired 0 timer: refresh ts 0 peer 188.8.131.52 event 'event_reach' (0x84) status 'unreach, conf, 1 event, event_reach' (0x8014) transmit:at 1 192.168.1.8->184.108.40.206 mode 3 receive:at 1 192.168.1.8<-220.127.116.11 mode 4 code 1 auth 0 clock_filter: n 1 off 254.595285 del 0.068982 dsp 7.937501 jit 0.000001, age 0 transmit:at 3 192.168.1.8->18.104.22.168 mode 3 receive:at 3 192.168.1.8<-22.214.171.124 mode 4 code 1 auth 0