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.
This documentation is not a detailed description but rather a most commonly used features reference
Processes the config file, the command line, 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
|-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
Not a good idea, as it bypasses the clock state machine which is designed to cope with large time and frequency errors. Since the slew rate is limited to 0.5 ms/s, each second of adjustment requires an interval of 2,000 seconds ( 33 minutes). An adjustment of many seconds can take hours or days . This option can be used with the
|-a||Enable authentication mode (default).|
|-A||Disable authentication mode.|
|-c conffile ||configuration file. (Disable netinfo?)
||-d ||debugging mode. multiple times, greater detail of display.
||-D level ||debugging level directly. D 9 sample
||-f driftfile ||drift file.
||-l logfile || 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 126.96.36.199 (requires multicast kernel).
|-p pidfile || name to record the ntpd's process ID.
|| run 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.
The choice of servers is in:
/etc/ntp.conf. For Example:
A useful command is:
which quits after one update, does NOT fork, disables the sanity check permiting large adjustments and slews to the new time.
sudo ntpd -q -n -x -D 9 -g |more
ntpd is first started, the clock may be set back.
-x causes slew corrections to be used to avoid this.
After that the current frequency offset is written to the file at hourly intervals.
Normally operates continuously while monitoring for small changes in frequency and trimming the clock for the ultimate precision. It can operate in a one-time mode where the time is set from an external server and frequency is set from a previously recorded frequency file. A broadcast/multicast or manycast client can discover remote servers, compute server-client propagation delay correction factors and configure itself automatically. This makes it possible to deploy a fleet of workstations without specifying configuration details specific to the local environment.
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),
See NTP.org a 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->188.8.131.52 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 184.108.40.206 event 'event_reach' (0x84) status 'unreach, conf, 1 event, event_reach' (0x8014) transmit:at 1 192.168.1.8->220.127.116.11 mode 3 receive:at 1 192.168.1.8<-18.104.22.168 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->22.214.171.124 mode 3 receive:at 3 192.168.1.8<-126.96.36.199 mode 4 code 1 auth 0