This is an old revision of the document!
Table of Contents
NTP
- There is a dedicated page for public NTP servers.
- There is a dedicated page to Infoblox NTP.
- A good overview of NTP is here on the meinbergglobal page.
DO NOT use burst or iburst against public NTP servers unless they are announced they accept it (e.g. don't use it against *.ntp.org servers). More details here.
DO NOT configure your system to use leap-smearing NTP servers as well as non-leap-smearing NTP servers at the same time. e.g. do not combine Google NTP with Cloudflare NTP. See here.
Try to use sources with a low poll time.
NTP overview from an NTP author and there is a best practice guide here.
One argument for using UTC on all devices everywhere is that, if the government of a country (e.g Mexico late 2022) decides to scrap daylight savings, and if the computer systems are not updated with this information, they can still implement daylight savings and cause massive issues.
NTP Timezones
NTPQ Commands
AWS NTP
You can query NTP in AWS at this IP
169.254.169.123
The 169.254.169.123 clock smooths out leap seconds over a period of time (commonly called leap smearing) which makes it easy for your applications to deal with leap seconds.
Windows NTP
REMEMBER It is important to note that W32Time will only actively synchronize with one time source at a time, even though you are able to list more than one time source. (source)
Most NTP implementations would poll all the servers to choose the best sample, but as of Server 2008, Windows doesn't.
Test Windows NTP
You can test NTP manually using Windows using the following command (where 192.168.1.1 is the IP of the NTP server).
w32tm /stripchart /dataonly /computer:192.168.1.1
Resync Windows NTP
Resynchronize the clock
w32tm /resync
Show Windows NTP Timezone
Show current timezone settings
w32tm /tz
Show Windows NTP External Servers
List external NTP servers (peers)
w32tm /query /peers
or
w32tm /query /peers /verbose
Stop and Start Windows NTP
net stop w32time
net start w32time
Manually set Windows NTP
w32tm /config /manualpeerlist:0.uk.pool.ntp.org,1.uk.pool.ntp.org,2.uk.pool.ntp.org,3.uk.pool.ntp.org,0x1 /syncfromflags:MANUAL /reliable:yes /update
Linux NTP
Set Linux Time
sudo date -s "22 JUN 2020 13:11:30"
Check Status
Check status of NTP on Ubuntu 16.04+
timedatectl status
If NTP is not on, try the following command
sudo timedatectl set-ntp on
Show NTP Status
ntpstat
ntpq -pn
ntpq -p
-p prints peers and -n means it will print IP and not FQDN
The left most character is the “tally code”. For reference, see the documentation on the Select Field values, where the T column documents the codes associated with each value.
Judging from your output, it looks you have two NTP servers which declare themselves as stratum 1, but do not agree on the time (i.e. the offsets differ by ~330 ms).
Since a stratum 1 time server is intended to have highly accurate time by being directly connected to a hardware reference clock, disagreement between two of them is causing your local NTP daemon to consider them both untrustworthy.
The * character is used to mark which peer you are currently synced to. The + character denotes “high quality candidate” The - character is used to mark peers being ignored (because they are so far out of the agreed time pool). The x character denotes “discarded by intersection algorithm”
| Code | Message | T | Description |
|---|---|---|---|
| 0 | sel_reject | discarded as not valid (TEST10-TEST13) | |
| 1 | sel_falsetick | x | discarded by intersection algorithm |
| 2 | sel_excess | . | discarded by table overflow (not used) |
| 3 | sel_outlier | - | discarded by the cluster algorithm |
| 4 | sel_candidate | + | included by the combine algorithm |
| 5 | sel_backup | # | backup (more than tos maxclock sources) |
| 6 | sel_sys.peer | * | system peer |
| 7 | sel_pps.peer | o | PPS peer (when the prefer peer is valid) |
Refid
From here.
Reference ID (refid) is a 32-bit code identifying the particular server or reference clock. The interpretation depends on the value in the stratum field.
For packet stratum 0 (unspecified or invalid), this is a four-character ASCII [RFC1345] string, called the “kiss code”, used for debugging and monitoring purposes.
For stratum 1 (reference clock), this is a four-octet, left-justified, zero-padded ASCII string assigned to the reference clock. The authoritative list of Reference Identifiers is maintained by IANA; however, any string beginning with the ASCII character “X” is reserved for unregistered experimentation and development. The identifiers in the list below have been used as ASCII identifiers:
| ID | Clock Source |
|---|---|
| INIT | Initialising. NTP Server not yet reached. |
| LOCL | The local system clock |
| LCL | undisciplined local clock |
| LOCL | Undisciplined local clock |
| GOOG | means it is using one of Google's time clocks |
| FB.. | means it is using Facebook time servers |
| MRS | is a multi-reference clock |
| SHM | means Shared Memory Driver |
| ATOM | with ATOM PPS |
| DCFa | DCF77 (with amplitude modulation) |
| DCFp | DCF77 (with phase modulation/pseudo random phase modulation) |
| GPSs | GPS (with shared memory access - Meinberg) |
| GPSi | GPS (with interrupt based access - Meinberg) |
| GLNs | GPS/GLONASS (with shared memory access - Meinberg) |
| GLNi | GPS/GLONASS (with interrupt based access - Meinberg) |
| GOES | Geosynchronous Orbit Environment Satellite |
| GPS | Global Position System |
| GAL | Galileo Positioning System |
| PPS | Generic pulse-per-second |
| IRIG | Inter-Range Instrumentation Group |
| WWVB | LF Radio WWVB Ft. Collins, CO 60 kHz |
| DCF | LF Radio DCF77 Mainflingen, DE 77.5 kHz |
| HBG | LF Radio HBG Prangins, HB 75 kHz |
| MSF | LF Radio MSF Anthorn, UK 60 kHz |
| JJY | LF Radio JJY Fukushima, JP 40 kHz, Saga, JP 60 kHz |
| LORC | MF Radio LORAN C station, 100 kHz |
| TDF | MF Radio Allouis, FR 162 kHz |
| CHU | HF Radio CHU Ottawa, Ontario |
| WWV | HF Radio WWV Ft. Collins, CO |
| WWVH | HF Radio WWVH Kauai, HI |
| NIST | NIST telephone modem |
| ACTS | NIST telephone modem |
| USNO | USNO telephone modem |
| PTB | European telephone modem |
| MRS | Multi Reference Sources |
Burst and iBurst
Using the burst option against a public server is considered abuse. Do not use this option with public NTP servers. Use it only for applications within your own organization.
Burst and iBurst are only relevant if the NTP Servers you are synchronising to actually support these features, if not they can be switched off.
The 'burst' option is used to increase the average quality of time offset statistics. At every poll interval, when the NTP server responds, the system will send a burst of up to eight packets instead of the usual one packet. For use with the server command to improve the average quality of the time-offset calculations as well as accurately measure jitter with long poll intervals.
The 'iburst' option is used to improve the time taken for initial synchronization. When the NTP server is unreachable, the NTP client sends a burst of eight packets instead of the usual one packet and then shorten the time until the first sync. The packet spacing is normally 2 seconds. The iburst mode continues to send frequent NTP queries until the server responds and time synchronization starts. After the first minute, the iburst mode typically synchronizes the clock so that queries need to be sent at intervals of 64 seconds or more.
Microsoft only support Simple Network Time Protocol (sntp) which is compatible with NTP clients but does not offer all the functionality of NTP (including Burst and iBurst). Microsoft servers will just ignore the burst and iburst options.
NTP Authentication
If you need to put in the full MD5 or SHA1 hash but only have a keystring, you can generate the hash in PowerShell.
$stringAsStream = [System.IO.MemoryStream]::new() $writer = [System.IO.StreamWriter]::new($stringAsStream) $writer.write("ThisIsMyKeyString") $writer.Flush() $stringAsStream.Position = 0 Get-FileHash -InputStream $stringAsStream - Algorithm xxx| Select-Object Hash
