Hostxpeed
Login Get Started →
Server Management

How to Sync Time with NTP

4 min read
24 views
Jun 13, 2026

Prerequisites

Before setting up NTP, make sure you have:

  • SSH access to your VPS
  • Root or sudo privileges

Method 1: Using timedatectl (Modern systems)

Connect to your VPS:

ssh hxroot@YOUR_SERVER_IP -p 22
sudo timedatectl set-ntp true

Check status:

timedatectl status

You should see "NTP service: active" and "System clock synchronized: yes".

Method 2: Install and Configure NTP (Full NTP client)

Install NTP:

sudo apt install ntp -y

Edit configuration (optional):

sudo nano /etc/ntp.conf

Add/change pool 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

Start and enable NTP:

sudo systemctl start ntp
sudo systemctl enable ntp

Method 3: Using chrony (Modern, faster)

sudo apt install chrony -y
sudo systemctl start chrony
sudo systemctl enable chrony

Force Time Sync Immediately

With timedatectl:

sudo timedatectl set-ntp false
sudo timedatectl set-ntp true

With ntpdate (one-time sync):

sudo apt install ntpdate -y
sudo ntpdate -s time.nist.gov

Check Time Synchronization Status

ntpq -p

Shows NTP peers and their status.

timedatectl show-timesync

Shows detailed sync information.

Troubleshooting Time Sync

If clock is still off, check firewall (UDP port 123 must be open).

sudo ufw status | grep 123

Check NTP service logs:

sudo journalctl -u ntp -n 50

✅ NTP is now synchronizing your server clock automatically.

Was this article helpful?