How to install NTP server and client on ubuntu 16.04/18.04

NTP full from is Network Time Protocol, Its a network protocol which clock synchronization with computer systems over packet-switched, Originally NTP developed by Professor David L.


Update ubuntu repository

Install NTP server using ubuntu 16.04/18.04.

apt-get update && apt-get install ntp -y

Get NTP pool server

Check you nearest NTP pool server list by follwoing the link.

https://www.ntppool.org/en/use.html

After got your nearest NTP pool, You need to configuration with ntp config file like this.

Example for india NTP server list :–

India — in.pool.ntp.org
server 0.in.pool.ntp.org
server 1.in.pool.ntp.org
server 2.in.pool.ntp.org
server 3.in.pool.ntp.org

NTP pool configuration

After getting NTP pool list, You need to open /etc/ntp.conf by following the commands.

vim /etc/ntp.conf

Add replace the following pool with your location NTP pool like this.

# Specify one or more NTP servers.

# 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.

pool 0.in.pool.ntp.org iburst
pool 1.in.pool.ntp.org iburst
pool 2.in.pool.ntp.org iburst
pool 3.in.pool.ntp.org iburst

Save and Exit from vim editor.

Restart the NTP daemon

Now you need to restart the NTP service by using following commands.

systemctl restart ntp
systemctl status ntp

Allow NTP port uisng UFW

Allow ntp port in network by using following commands.

ufw allow 123/udp

Client site installation and configuration

Update ubuntu repository

You need to install ntpdate by following the commands.

apt-get update && apt-get install ntpdate -y

Add Domain in Hosts file

configure domain of the NTP server or you can make changes in /etc/hots file like that.

vim /etc/hosts

Add tyour NTP server ip address and hostname by following files as given below :–

192.168.0.1       NTP-SERVER

Save and Exit

Ping and verify

You need to ping your NTP server you domain name which you have implemented.

ping NTP-SERVER

You should get 192.168.0.1 IP address in return.

Check synchronized with NTP

Now test manually client machine’s time is synchronized with NTP server or not by following the commands.

ntpdate NTP-SERVER

Now need to trun off systemd timesyncd service on the client.

timedatectl set-ntp off

Install NTP

You need to install NTP in your client machine by using the commands.

apt-get install ntp -y

NTP server configuration

Edit the /etc/ntp.conf and add your NTP Server like that.

vim /etc/ntp.conf

Add the given configuration

server NTP-SERVER prefer iburst

Save and Exit from vim editor.

Restart the NTP server

Now you need to restart the NTP Service and check NTP status.

systemctl restart ntp
systemctl status ntp

View the Time Synchronization Queue

Its time check list of View the Time Synchronization Queue by following the commands.

ntpq -ps

How to install NTP server and client on ubuntu 16.04/18.04

2 thoughts on “How to install NTP server and client on ubuntu 16.04/18.04

  1. Normally I do not read post on blogs, however I wish to say that this write-up very pressured me to check out and do so! Your writing taste has been surprised me. Thank you, quite great post.

Leave a Reply

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

Scroll to top