Table of Contents
What you will read?
Setting up your own NTP (Network Time Protocol) server is essential if you want to sync time across multiple machines in a private network. Here’s how to configure it on Ubuntu 24.10.
Step 1: Install the NTP Package
sudo apt update
sudo apt install ntp -y
This installs the traditional ntpd service which runs as a background daemon.
Step 2: Configure NTP Server Settings
Edit the main config file:
sudo nano /etc/ntp.conf
You’ll see default pool servers like:
pool 0.ubuntu.pool.ntp.org iburst
pool 1.ubuntu.pool.ntp.org iburst
You can leave these if you want your NTP server to sync with the internet.
If you want a fully local NTP server, comment those out and add a local clock fallback:
# Local NTP server (fallback)
server 127.127.1.0
fudge 127.127.1.0 stratum 10
Now allow your LAN clients to access it. Find this section:
restrict -4 default kod notrap nomodify nopeer noquery
And add or modify to allow your local subnet (example for 192.168.1.0/24):
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
Save and exit.
Step 3: Restart NTP Service
sudo systemctl restart ntp
Check status:
sudo systemctl status ntp
Step 4: Open Port 123/UDP (If Using Firewall)
sudo ufw allow 123/udp
Verify it’s open:
sudo ufw status
Step 5: Verify the Server is Working
Run:
ntpq -p
You should see a list of time sources or the local clock.
To test from a client machine:
ntpdate -q your-server-ip
It should return the offset and delay.
