Configure systemd-timesyncd for Accurate NTP Sync on Linux
This guide explains why the default NTP servers may be slow in China, when manual configuration is needed, and provides step‑by‑step commands to install, configure, restart, and verify systemd‑timesyncd using local Alibaba NTP servers.
Original article: https://note.qidong.name/2020/09/install-powerline/ Author: 零壹軒
Background
Ubuntu uses ntp.ubuntu.com as its default time‑sync server and Debian uses servers such as 0.debian.pool.ntp.org. Accessing these from China often incurs high latency, though the impact on clock synchronization is usually minor.
Why configure manually?
In isolated environments—such as corporate intranets or cloud subnets without internet access—you cannot reach the public NTP servers, so you must set up your own synchronization source.
Installation
Most systems already have systemd-timesyncd installed. If it is missing, install it with: sudo apt install systemd-timesyncd Note that systemd-timesyncd conflicts with the traditional ntp daemon; only one can be installed at a time.
Configuration
Edit /etc/systemd/timesyncd.conf and set the NTP lines to servers reachable from China, for example:
[Time]
NTP=ntp7.aliyun.com
NTP=ntp6.aliyun.comAfter saving the file, restart the service for the changes to take effect:
sudo systemctl restart systemd-timesyncd.serviceIf the service file is missing, recreate it with:
sudo dpkg-reconfigure systemd-timesyncdVerify the configuration
Use timedatectl status to view detailed synchronization information. Example output:
$ timedatectl status
Local time: Tue 2020-09-22 20:06:05 CST
Universal time: Tue 2020-09-22 12:06:05 UTC
RTC time: Tue 2020-09-22 12:06:05
Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
NTP service: active
RTC in local TZ: noChinese NTP server list
Alibaba Cloud provides several NTP servers that can be pinged to choose the fastest one:
ntp1.aliyun.com
ntp2.aliyun.com
ntp3.aliyun.com
ntp4.aliyun.com
ntp5.aliyun.com
ntp6.aliyun.com
ntp7.aliyun.comSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
