NTP is a TCP/IP protocol for synchronizing time over a network. Typically the client requests the current time from the server and sets its clock based on the result. This description is quite simple, but implementing this function is extremely complex - first, there must be multiple layers of NTP servers. The first layer of NTP servers connects to the atomic clock, and the second and third layers of servers take on the responsibility of load balancing to handle all requests from the Internet. Also, the client may be more complex than you think - it has to account for communication delays, adjust the time and not interfere with other processes running on the server. Fortunately, all of this complexity is encapsulated so you don't see it and don't need to see it. In Ubuntu, ntpdate and ntpd are used to synchronize time. timedatectl In the latest Ubuntu versions, timedatectl replaces the old ntpdate. By default, timedatectl will sync the time immediately at system boot, and check again later via the socket when the network connection is active. If ntpdate / ntp is already installed, timedatectl will fall back to letting you use the previous settings. This ensures that the two time synchronization services do not conflict with each other, while preserving original behavior and configuration when you upgrade. But this also means that when upgrading from older distributions ntp/ntpdate will still be installed, thus causing the new systemd-based time service to be disabled. timesyncd In the latest Ubuntu versions, timesyncd replaces the client part of ntpd. By default, timesyncd will periodically detect and synchronize the time. It also stores the updated time locally so that it can make single-step adjustments when the system is restarted. The current time status and time configuration set by timedatectl and timesyncd can be confirmed using the timedatectl status command. timedatectl status Local time: Fri 2016-04-29 06:32:57 UTC Universal time: Fri 2016-04-29 06:32:57 UTC RTC time: Fri 2016-04-29 07:44:02 Time zone: Etc/UTC (UTC, +0000) Network time on: yes NTP synchronized: no RTC in local TZ: no If NTP is installed and used instead of timedatectl to synchronize time, NTP synchronized will be set to yes. The nameserver used by timedatectl and timesyncd to obtain the time can be specified through /etc/systemd/timesyncd.conf. In addition, there are flexible additional configuration files under /etc/systemd/timesyncd.conf.d/. ntpdate Due to the existence of timedatectl, distributions have deprecated ntpdate and it is no longer installed by default. If you install it, it will set your computer's time according to Ubuntu's NTP servers during system boot. After that, every time a new network interface is started, it will retry to synchronize the time - during which time it will slowly drift away as long as the time difference it covers is not too large. This behavior can be controlled with the -B/-b switch. Time Server By default, systemd-based tools request time synchronization from ntp.ubuntu.com. Classic ntpd-based services basically use 2.ubuntu.pool.ntp.org from the [0-3].ubuntu.pool.ntp.org pool, as well as ntp.ubuntu.com, and support IPv6 if needed. If you want to force the use of IPv6, you can use ipv6.ntp.ubuntu.com, but this is not the default configuration. ntpd Install To install ntpd, enter in the terminal command line: sudo apt install ntp Configuration Edit /etc/ntp.conf - add/remove server line. The default configuration has the following servers: # Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board # on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for # more information. server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org After modifying the configuration file, you need to reload ntpd: sudo systemctl reload ntp.service View Status Use ntpq to see more information: # sudo ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== +stratum2-2.NTP. 129.70.130.70 2 u 5 64 377 68.461 -44.274 110.334 +ntp2.m-online.n 212.18.1.106 2 u 5 64 377 54.629 -27.318 78.882 *145.253.66.170 .DCFa. 1 u 10 64 377 83.607 -30.159 68.343 +stratum2-3.NTP. 129.70.130.70 2 u 5 64 357 68.795 -68.168 104.612 +europium.canoni 193.79.237.14 2 u 63 64 337 81.534 -67.968 92.792 PPS Support Starting from Ubuntu 16.04, ntp supports the PPS specification, which provides ntp with a local time source to provide higher accuracy. See the links listed below for more configuration information. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Detailed explanation of MySQL slow log query
>>: Web project development VUE mixing and inheritance principle
In the past, creating a printer-friendly version ...
inherit 1. What is inheritance Inheritance: First...
Mac uses Shell (Terminal) SSH to connect to the r...
Table of contents 1. Overview 2. Define a simple ...
difficulty Two mask creation of svg graphics Firs...
1. Demand The base has 300 new servers, and needs...
This article example shares the specific code of ...
VC6.0 is indeed too old VC6.0 is a development to...
Effect picture: Preface: Recently, I was working ...
Everyone is familiar with the meta tag in desktop...
Cell padding is the distance between the cell con...
This article shares with you the detailed install...
1. Trash or Classic? Web technology updates very ...
Table of contents Preface Environment Preparation...
Table of contents Preface 1. System Service Contr...