NTP: Difference between revisions

From Leo's Notes
This page was last edited on 24 March 2017, at 18:36.
m Text replacement - "</code>" to "}}"
No edit summary
Line 4: Line 4:


To see the peers of the local server, run:
To see the peers of the local server, run:
ntpdc -c monlist
{{highlight|lang=terminal|code=
$ ntpdc -c monlist
}}


You can also try querying a remote server by running:
You can also try querying a remote server by running:
ntpdc -c monlist IP
 
{{highlight|lang=terminal|code=
$ ntpdc -c monlist IP
}}


== NTP Peers ==
== NTP Peers ==


To see the peers of a server, run:
To see the peers of a server, run:
ntpq -pn
 
{{highlight|lang=terminal|code=
$ ntpq -pn
}}


== NTP Synchronization ==
== NTP Synchronization ==


To sync with a server, run:
To sync with a server, run:
ntpdate 136.159.5.75
 
{{highlight|lang=terminal|code=
$ ntpdate 136.159.5.75
}}


You can get debug information with the {{code|-dv}} option:
You can get debug information with the {{code|-dv}} option:
ntpdate -dv 136.159.5.75
 
{{highlight|lang=terminal|code=
$ ntpdate -dv 136.159.5.75
}}
 
== Systemd ==
You can also sync time with systemd. To enable, run:
 
{{highlight|lang=terminal|code=
## Edit the config at /etc/systemd/timesyncd.conf
# vi /etc/systemd/timesyncd.conf
 
## Enable
# timedatectl set-ntp true
 
## Check status
# timedatectl status
}}
 
 
See Also:
* https://wiki.archlinux.org/index.php/systemd-timesyncd
 


== Troubleshooting ==
== Troubleshooting ==

Revision as of 18:36, 24 March 2017

To query a NTP server, use the ntpdc command.

NTP Monlist

To see the peers of the local server, run:

$ ntpdc -c monlist

You can also try querying a remote server by running:

$ ntpdc -c monlist IP

NTP Peers

To see the peers of a server, run:

$ ntpq -pn

NTP Synchronization

To sync with a server, run:

$ ntpdate 136.159.5.75

You can get debug information with the -dv option:

$ ntpdate -dv 136.159.5.75

Systemd

You can also sync time with systemd. To enable, run:

## Edit the config at /etc/systemd/timesyncd.conf
# vi /etc/systemd/timesyncd.conf

## Enable
# timedatectl set-ntp true 

## Check status
# timedatectl status


See Also:


Troubleshooting

When NTP stops syncing time, there are a few things to try:

  1. Does ntpdate -q timeserver produce any results? Possibly a network issue.
  2. Check the NTP server's peer list ntpq -pn to see if peers are bad.
  3. Use tcpdump port 123 to monitor NTP traffic.
  4. Verify that your ntp.conf is not restricting access or ignoring to your source servers. Try and use an unmodified configuration file and verify whether it works.

Server dropped: strata too high

136.159.5.75: Server dropped: strata too high
server 136.159.5.75, port 123
stratum 16, precision -22, leap 11, trust 000
refid [136.159.5.75], delay 0.02577, dispersion 0.00002
transmitted 4, in filter 4
reference time:    00000000.00000000  Sun, Dec 31 1899 16:26:08.000
originate timestamp: d7a8d436.b9474d41  Wed, Aug 27 2014 16:03:34.723
transmit timestamp:  d7a8d448.c3f0311e  Wed, Aug 27 2014 16:03:52.765
filter delay:  0.02588  0.02577  0.02582  0.02582 
         0.00000  0.00000  0.00000  0.00000 
filter offset: -18.0417 -18.0417 -18.0417 -18.0417
         0.000000 0.000000 0.000000 0.000000
delay 0.02577, dispersion 0.00002
offset -18.041794

The server is either misconfigured or there is a network issue between the client and the server. Verify that the client is not restricting the server.

Server dropped: Leap not in sync

136.159.2.251: Server dropped: Leap not in sync
server 136.159.2.251, port 123
stratum 1, precision -9, leap 11, trust 000
refid [NTP], delay 0.02748, dispersion 0.00070
transmitted 4, in filter 4
reference time:    d7a64b67.11374bc6  Mon, Aug 25 2014 17:55:19.067
originate timestamp: d7a8d4ab.fae147ae  Wed, Aug 27 2014 16:05:31.980
transmit timestamp:  d7a8d4ba.f4c9d0fb  Wed, Aug 27 2014 16:05:46.956
filter delay:  0.02831  0.02748  0.02757  0.03752 
         0.00000  0.00000  0.00000  0.00000 
filter offset: -15.0758 -15.0762 -15.0761 -15.0711
         0.000000 0.000000 0.000000 0.000000
delay 0.02748, dispersion 0.00070
offset -15.076202

The server may be misconfigured. Ensure that the server is synchronized or use another server.

On the server, force a sync by running ntpdate -b timeserver.