This guide shows you how to set up your Linux server to synchronize its clock using the NTP Pool Project, a worldwide network of volunteer time servers. By the end, your server will automatically maintain accurate time by querying pool.ntp.org, which is the recommended way for most public-facing systems.
What You’ll Need
- A Linux server with root or sudo access
- An internet connection (outbound UDP port 123 must be open)
- One of the common NTP daemons installed:
ntpd(classic),chrony(modern default on many distros), orsystemd-timesyncd(minimal)
Step-by-Step
- Check what time sync service is already running. Run
timedatectl(most systemd-based distros) to see if NTP is active and which service is in use. If you seesystemd-timesyncd, you can either keep it or switch to a full NTP daemon. For this guide, we’ll coverchronyandntpd. - Install the NTP daemon of your choice.
- For chrony (recommended):
sudo apt install chrony(Debian/Ubuntu) orsudo dnf install chrony(Fedora/RHEL). - For classic ntpd:
sudo apt install ntporsudo dnf install ntp.
- For chrony (recommended):
- Stop and disable any conflicting time sync services. If you’re using chrony, stop systemd-timesyncd:
sudo systemctl stop systemd-timesyncdandsudo systemctl disable systemd-timesyncd. Similarly, if you switch from ntpd to chrony, disable ntpd first. - Edit the configuration file.
- For chrony, edit
/etc/chrony/chrony.conf(or/etc/chrony.confon some distros). - For ntpd, edit
/etc/ntp.conf.
Find the lines that specify NTP servers (they start with
serverorpool). Replace them with the NTP Pool Project servers. For most servers, use the generic pool:pool 0.pool.ntp.org iburst pool 1.pool.ntp.org iburst pool 2.pool.ntp.org iburst pool 3.pool.ntp.org iburst
The
iburstoption speeds up the initial synchronization. If your server is in a specific region (e.g., Europe, North America), you can use region-specific subdomains like0.europe.pool.ntp.orgfor better latency, but the generic pool is fine for most cases. - For chrony, edit
- Add or adjust access restrictions (optional but recommended). In the same config file, ensure you have lines that restrict who can query your server. For a typical client-only setup, add:
restrict default nomodify notrap nopeer noquery restrict 127.0.0.1 restrict ::1
This allows your server to sync but prevents others from using it as a time source unless you intend to be a public server.
- Start and enable the service.
- For chrony:
sudo systemctl start chronyandsudo systemctl enable chrony. - For ntpd:
sudo systemctl start ntpandsudo systemctl enable ntp(service name may bentpdon some distros).
- For chrony:
- Verify the service is running. Use
chronyc tracking(for chrony) orntpq -p(for ntpd) to see the list of servers and the current offset. You should see servers with a*(selected) or+(candidate) prefix. - Check that time is actually syncing. Run
timedatectlagain. TheNTP synchronizedfield should sayyes. You can also compare your server’s time with a known source usingdateand a quick web search. - Allow UDP port 123 through the firewall (if you have one). For example, with UFW:
sudo ufw allow 123/udp. If you’re using firewalld:sudo firewall-cmd --add-service=ntp --permanentand reload.
Common Mistakes
- Forgetting to stop the default
systemd-timesyncdservice. It will fight with chrony or ntpd for control of the time. - Using
serverinstead ofpoolfor the NTP Pool. Thepooldirective is designed for the pool project and handles server rotation correctly. - Not including
iburst– this makes initial sync take much longer (often minutes vs. seconds). - Typo in the config file (e.g., missing dot in
0.pool.ntp.org). - Firewall blocking outbound UDP 123 – your server can’t reach the pool if outbound is blocked.
Tips
- Use the generic pool (
0.pool.ntp.orgetc.) unless you have a specific reason to use a regional pool. The pool project automatically balances load. - For servers that are behind a NAT or have a dynamic IP, the pool project asks that you use the generic pool and not the regional ones, to avoid overloading specific regions.
- If you have multiple servers in your infrastructure, consider configuring one as a local NTP server that syncs to the pool, and have the others sync to that local server. This reduces load on the pool.
- Monitor your time sync with a simple cron job that logs the offset from
chronyc trackingorntpq -p. - Keep the NTP daemon updated with the rest of your system to get security and reliability fixes.
Troubleshooting
- No servers appear in
chronyc sourcesorntpq -p. Check your network connectivity and firewall. Tryping 0.pool.ntp.org(ICMP may be blocked, but if DNS resolves, it’s a start). Usechronyc makestepto force an immediate sync attempt and watch the output. - Time is still not synchronized after a few minutes. Check the service logs:
journalctl -u chronyorjournalctl -u ntp. Look for errors like “Name resolution failed” or “Connection refused”. Also verify that your system clock isn’t too far off (more than 1000 seconds) – chrony may refuse to step by default. You can temporarily setmakestep 1 -1in the config to allow stepping at any time. - NTP synchronized shows ‘no’ in
timedatectl. Ensure the service is running and that you’ve disabled other time sync services. Also check that theSetNTPproperty is true:timedatectl set-ntp true. - Getting ‘Permission denied’ when editing config files. Use sudo. The config files are owned by root.
- After changing config, the service won’t restart. Run
chronyd -Q -f /etc/chrony/chrony.conf(orntpd -c /etc/ntp.conf) to test the config syntax. It will report any errors.
Frequently Asked Questions
- Do I need to register my server with the NTP Pool Project? No, you don’t need to register to use the pool. Registration is only for servers that want to volunteer their own time to the pool.
- Can I use the pool for a home server? Yes, absolutely. The pool is for everyone. Just use the generic pool and don’t set up a public server unless you have a static IP and good bandwidth.
- What’s the difference between chrony and ntpd? Chrony is newer, generally more accurate on virtual machines and with unstable network connections, and has a simpler configuration. Ntpd is the classic daemon and is still widely used. Both work fine with the pool.
- Why does my server’s time jump forward/backward after a reboot? That’s normal if the hardware clock is wrong. The NTP daemon will gradually correct it. You can use
timedatectl set-local-rtc 0to ensure the hardware clock is in UTC. - Is it safe to use the pool for a production server? Yes, the pool is designed for this. The servers are monitored and the pool uses a voting system to avoid bad actors. Just ensure your server can reach the pool and that you have proper monitoring.
- How often does my server sync with the pool? It depends on the daemon. Chrony typically polls every few minutes, but it adjusts the interval based on network conditions. Ntpd uses a similar adaptive approach. You don’t need to configure this manually.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Student ID Card in Apple Wallet: iPhone & Watch
- How to Set Up Surround Sound in Windows
- LG V10: How to Close and Turn Off Background Apps
- Wireless Mouse Not Working? Fix It Fast
- How to Delete Old Telegram Profile Pictures
- How to Use a Bluetooth Mouse with iPhone or iPad