NTP

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 18:46, 4 December 2020 by Admin (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks. NTP is intended to synchronize all participating computers to within a few milliseconds of Coordinated Universal Time (UTC). NTP can usually maintain time to within tens of milliseconds over the public Internet, and can achieve better than one millisecond accuracy in local area networks.

Implementations send and receive timestamps using the User Datagram Protocol (UDP) on port number 123.

NTP servers use "UTC" time (formerly "GMT" time), which is the same throughout the world. The timezone you are in doesn't matter to this NTP server. The translation to a time zone is handled completely by your NTP client software.

Variations

The NTP server uses UDP port 123 ("ntp"). Other time clients use other time protocols. That is, port 13 ("daytime"), 37 ("time"), or 525 ("timed").

Simple Network Time Protocol (SNTP) is a less complex implementation of NTP, using the same protocol but without requiring the storage of state over extended periods of time.

W32Time is a bastardized variation which has the ability to synchronize the computer clock to an NTP server. Windows 2000 and Windows XP only implements SNTP, and violates several aspects of the NTP. Microsoft states that W32Time cannot reliably maintain time synchronization with one second accuracy

Daytime

NIST Internet Time Servers continue to support the "TIME" protocol that uses tcp port 37 for the forseeable future. However, this protocol is very expensive in terms of network bandwidth, since it uses the complete tcp machinery to transmit only 32 bits of data. Users are *strongly* encouraged to upgrade to the network time protocol (NTP), which is both more accurate and more robust.

Users of the NIST "DAYTIME" protocol on tcp port 13 are also strongly encouraged to upgrade to the network time protocol, which provides greater accuracy and requires less network bandwidth.

Authenticated NTP

Authentication support allows the NTP client to verify that the server is in fact known and trusted and not an intruder intending accidentally or on purpose to masquerade as that server.

Test NTP Service from Linux CLI

sudo apt install ntpdate
ntpdate -q time.google.com

Installs the utility. The -q command switch tells ntpdate not to sync the system clock, only show results of query as well as it compares to your system clock.

keywords: time.gov nmtp time network

Router or Gateway aks for Time aka NTP Server

Simply use:

pool.ntp.org

According to NTP Pool Project:

If you just want to synchronise your computers clock to the network, the configuration file (for the ntpd program from the ntp.org distribution, on any supported operating system - Linux, *BSD, Windows and even some more exotic systems) is really simple:

driftfile /var/lib/ntp/ntp.drift
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org

The 0, 1, 2 and 3.pool.ntp.org names point to a random set of servers that will change every hour. Make sure your computer's clock is set to something sensible (within a few minutes of the 'true' time) - you could use ntpdate pool.ntp.org, or you could just use the date command and set it to your wristwatch. Start ntpd, and after some time (this could take as long as half an hour!), ntpq -pn should output something like:

$ ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+81.6.42.224     193.5.216.14     2 u   68 1024  377  158.995   51.220  50.287
*217.162.232.173 130.149.17.8     2 u  191 1024  176   79.245    3.589  27.454
-129.132.57.95   131.188.3.222    3 u  766 1024  377   22.302   -2.928   0.508

The IP addresses will be different, because you've been assigned random timeservers. The essential thing is that one of the lines starts with an asterisk (*), this means your computer gets the time from the internet - you'll never have to worry about it again!

Looking up pool.ntp.org (or 0.pool.ntp.org, 1.pool.ntp.org, etc) will usually return IP addresses for servers in or close to your country. For most users this will give the best results.