sodcalculator

10 Tech How-To

Configure NTP for the NTP Pool Project on Linux

Guide 10-15863 · Updated · Step by step

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), or systemd-timesyncd (minimal)

Step-by-Step

  1. 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 see systemd-timesyncd, you can either keep it or switch to a full NTP daemon. For this guide, we’ll cover chrony and ntpd.
  2. Install the NTP daemon of your choice.
    • For chrony (recommended): sudo apt install chrony (Debian/Ubuntu) or sudo dnf install chrony (Fedora/RHEL).
    • For classic ntpd: sudo apt install ntp or sudo dnf install ntp.
  3. Stop and disable any conflicting time sync services. If you’re using chrony, stop systemd-timesyncd: sudo systemctl stop systemd-timesyncd and sudo systemctl disable systemd-timesyncd. Similarly, if you switch from ntpd to chrony, disable ntpd first.
  4. Edit the configuration file.
    • For chrony, edit /etc/chrony/chrony.conf (or /etc/chrony.conf on some distros).
    • For ntpd, edit /etc/ntp.conf.

    Find the lines that specify NTP servers (they start with server or pool). 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 iburst option speeds up the initial synchronization. If your server is in a specific region (e.g., Europe, North America), you can use region-specific subdomains like 0.europe.pool.ntp.org for better latency, but the generic pool is fine for most cases.

  5. 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.

  6. Start and enable the service.
    • For chrony: sudo systemctl start chrony and sudo systemctl enable chrony.
    • For ntpd: sudo systemctl start ntp and sudo systemctl enable ntp (service name may be ntpd on some distros).
  7. Verify the service is running. Use chronyc tracking (for chrony) or ntpq -p (for ntpd) to see the list of servers and the current offset. You should see servers with a * (selected) or + (candidate) prefix.
  8. Check that time is actually syncing. Run timedatectl again. The NTP synchronized field should say yes. You can also compare your server’s time with a known source using date and a quick web search.
  9. 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 --permanent and reload.

Common Mistakes

  • Forgetting to stop the default systemd-timesyncd service. It will fight with chrony or ntpd for control of the time.
  • Using server instead of pool for the NTP Pool. The pool directive 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.org etc.) 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 tracking or ntpq -p.
  • Keep the NTP daemon updated with the rest of your system to get security and reliability fixes.

Troubleshooting

  • No servers appear in chronyc sources or ntpq -p. Check your network connectivity and firewall. Try ping 0.pool.ntp.org (ICMP may be blocked, but if DNS resolves, it’s a start). Use chronyc makestep to force an immediate sync attempt and watch the output.
  • Time is still not synchronized after a few minutes. Check the service logs: journalctl -u chrony or journalctl -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 set makestep 1 -1 in 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 the SetNTP property 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 (or ntpd -c /etc/ntp.conf) to test the config syntax. It will report any errors.

Frequently Asked Questions

  1. 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.
  2. 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.
  3. 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.
  4. 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 0 to ensure the hardware clock is in UTC.
  5. 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.
  6. 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

The whole Tech How-To bed →