For System Administrator managing the huge number of systems on their LAN. It is best practice to set up your own NTP server and synchronize the time of all LAN system from it. Main NTP server will synchronize its time from public NTP servers. This article will help you to Setup time synchronization (NTP) server on Ubuntu, Debian, and its derivatives operating systems.
Step 1 – Install NTP Server
You can simply install the ntpd server from default repositories by executing the following command from terminal.
sudo apt-get install ntp
Step 2 – Configure NTP Server
Now we need to set up local NTP server to synchronize their time from public NTP server. You can choose ntp pool server as per your choice or location. Visit pool.ntp.org to find ntp pool. For this example, I am using default Ubuntu’s ntp pool servers.
sudo vi /etc/ntp.conf
Edit /etc/ntp.conf and change following pools as per your choice. By default these servers are configured:
# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board # on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for # more information. server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org
Step 3 – Reload NTP Server
After making changes in ntp.conf, reload your server to apply changes.
sudo service ntp reload
Step 4 – Open Firewall Ports
NTP server uses port 123 for service requests. So we need to open port 123 in the firewall.
sudo iptables -A INPUT -m state --state NEW -p tcp --dport 123 -j ACCEPT
sudo ufw allow 123/tcp
Step 5 – Synchronize Time on Client
After making all configuration’s, now verify server configuration by synchronizing client systems. For example, if your server IP is 192.168.1.100, then run the following command through a terminal on the client system.
ntpdate -s 192.168.1.100