How do I configure and troubleshoot NTP (Network Time Protocol) for time synchronization?


Configuring NTP

Install NTP

  • Linux: Install the NTP package using your package manager:
    sudo apt update && sudo apt install ntp
    or
    sudo yum install ntp

    Note: Many current distributions (RHEL 8+, Debian 10+, Ubuntu 20.04+) use chrony or systemd-timesyncd by default. If ntp isn’t available, install chrony instead.

  • Windows: NTP functionality is built into the Windows Time service. No additional installation is required.

Configure the NTP server

  • Linux:
    Edit /etc/ntp.conf and specify your NTP servers:
    server 0.pool.ntp.org iburst
    server 1.pool.ntp.org iburst
    server 2.pool.ntp.org iburst
    server 3.pool.ntp.org iburst

    The iburst option speeds initial synchronization when a server is temporarily unreachable.

    Replace pool.ntp.org with your organization’s internal NTP servers if you have them.

  • Windows:
    Configure via Command Prompt:
    w32tm /config /manualpeerlist:"0.pool.ntp.org 1.pool.ntp.org" /syncfromflags:manual /reliable:yes /update
    w32tm /resync

    Or use Group Policy: Computer Configuration > Administrative Templates > System > Windows Time Service > Time Providers.

Start the NTP service

  • Linux:
    sudo systemctl start ntp
    sudo systemctl enable ntp
  • Windows:
    Ensure the Windows Time service is running:
    net start w32time

Verify NTP status

  • Linux:
    ntpq -p
    or
    timedatectl

    This shows the peer list and synchronization status.

  • Windows:
    w32tm /query /status

    Displays the current synchronization state of the Windows Time service.


Troubleshooting NTP

1. Check service status

  • Linux: systemctl status ntp (or chronyd / systemd-timesyncd)
  • Windows: w32tm /query /status

2. Firewall rules

  • Ensure UDP port 123 is open for NTP traffic.

3. Verify time drift

  • Query a trusted NTP server directly:
    ntpdate -q <ntp-server>

    On systems where ntpdate is deprecated, use ntpd -q <server> or chronyc sources.

  • If drift exceeds your tolerance, investigate further.

4. Check network connectivity to NTP

  • Don’t rely on ping (ICMP). Test the NTP port directly:
    ntpdate -q 0.pool.ntp.org
    or
    nc -uvz <ntp-server> 123

5. Check logs

  • Linux: /var/log/syslog, /var/log/ntp.log, or journalctl -u ntp
  • Windows: Event Viewer → Applications and Services Logs > Microsoft > Windows > Time-Service

6. Force synchronization

  • Linux:
    sudo ntpd -q <ntp-server>
    sudo systemctl restart ntp
  • Windows:
    w32tm /resync

7. Verify configuration

  • Check /etc/ntp.conf or Windows NTP settings for typos or wrong server addresses.

8. Try a different NTP server

  • If a specific server is unreachable, switch to another public or internal source.

9. Persistent clock drift

  • On Linux, consider chrony instead of ntpd for systems with unstable clocks (VMs, laptops, hardware with poor RTC).

10. Keep NTP software updated

  • Apply security patches and updates for your NTP implementation.

Best practices

  1. Use multiple NTP servers for redundancy (minimum three, four is better).
  2. Prefer internal NTP servers in enterprise environments for lower latency and control.
  3. Monitor time synchronization with alerting on drift thresholds.
  4. Disable conflicting time services (e.g., SNTP, VMware Tools time sync) to avoid fights.
  5. Ensure hypervisors (ESXi, Hyper-V, KVM) run NTP so guests inherit correct time.

Liked this briefing? Get it in your inbox

Every morning: the stories that make tech leaders act, with official clips and primary sources. Free, 5-minute read.

Free. One click to unsubscribe. We never share your email. Privacy

How do I configure and troubleshoot NTP (Network Time Protocol) for time synchronization?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to top