For System Administrator managing huge number of systems on their LAN. It is best practice to set up your own NTP server and synchronize 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.
Install NTP Server
To install ntpd server execute following command from a terminal
$ sudo apt-get install ntp
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 you choice or location. Visit pool.ntp.org to find ntp pool. For this example I am using default Ubuntu’s ntp pool servers.
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
Reload NTP Server
After making changes in ntp.conf, reload your server
$ sudo service ntp reload
Open Firewall Ports
NTP server uses port 123 for service requests. So we need to open port 123 in firewall.
$ sudo iptables -A INPUT -m state --state NEW -p tcp --dport 123 -j ACCEPT
$ sudo ufw allow 123/tcp
Synchronize Time on Client
After making all configuration’s, now verify server configuration by synchronizing client systems. For example if you server ip is 192.168.1.100, then run following command through terminal on client system.
$ ntpdate -s 192.168.1.100