Monday, September 28, 2015

Setup NTP Server in Ubuntu

In order to ensure the LAN client all time is same and reduce the network usage, you may implement a local NTP server rather than each of the PC in LAN get update from internet.

If you are using terminal only you can use date command to check the system date time.

So here we going to install NTP server.

sudo apt-get install ntp

As usual after install the ntp server, we may proceed with doing the configuration by using the below configuration to do the change.

sudo nano /etc/ntp.conf
After open up the ntp.conf file with nano, you will see some show as below. Here is the list of NTP server that you get update from it. So by default is Ubuntu server, if you wish to change the NTP server as your preference you may delete and change it to your preferred server.

# 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

After change the conf, please do not forget to save it. To ensure the change is made, you may verify it by using command below to check the performance or summary of the NTP server.

sudo ntpq -p
Here is an example output after assign the command.
# sudo ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+stratum2-2.NTP. 129.70.130.70    2 u    5   64  377   68.461  -44.274 110.334
+ntp2.m-online.n 212.18.1.106     2 u    5   64  377   54.629  -27.318  78.882
*145.253.66.170  .DCFa.           1 u   10   64  377   83.607  -30.159  68.343
+stratum2-3.NTP. 129.70.130.70    2 u    5   64  357   68.795  -68.168 104.612
+europium.canoni 193.79.237.14    2 u   63   64  337   81.534  -67.968  92.792

After change the ntp server in the ntp.conf file, you have to remember to reload the file or restart the service in order to apply the change.

You may reload the service by command below.
sudo service ntp reload
or you can restart the service as command below.
sudo service ntp restart
Stop the service by using command below.
sudo service ntp stop
Start the service by using command below.
sudo service ntp start


No comments:

Post a Comment