Configure Offline NTP Time Sync on Ubuntu/Debian with systemd-timesyncd
This guide explains how to install and configure systemd-timesyncd for reliable NTP time synchronization on Ubuntu or Debian systems, especially in isolated environments, including selecting domestic NTP servers, restarting the service, and verifying synchronization status with timedatectl.
Ubuntu's default time synchronization server is ntp.ubuntu.com, while Debian uses 0.debian.pool.ntp.org; each Linux distribution provides its own official NTP servers. In China these servers may have high latency, but the impact on clock synchronization is minimal.
In environments without internet access, such as corporate intranets or cloud subnets, you must configure time synchronization yourself.
This article shows how to set up time synchronization without building your own NTP server.
Installation
systemd-timesyncd is usually pre‑installed. If it is missing, install it manually: sudo apt install systemd-timesyncd The package conflicts with the traditional ntp package, so only one can be installed at a time.
Configuration
Edit /etc/systemd/timesyncd.conf and set the NTP servers to ones reachable from within 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 systemd-timesyncd.service unit is missing, you can restore it with:
sudo dpkg-reconfigure systemd-timesyncdVerify Synchronization
Use timedatectl status to view detailed synchronization information, for example:
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: activeDomestic NTP Server List
Some Alibaba Cloud NTP servers that can be used (choose the best with ping):
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.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
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.
