NTP stands for Network Time Protocol, and it is an Internet protocol used to synchronize the clocks of computers to some time reference. NTP is an Internet standard protocol that is implemented via UDP over port 123. It is the best way to set your system clock correctly.
According to a Survey of the NTP Network, there were at least 175,000 hosts running NTP in the Internet. Source: http://alumni.media.mit.edu/~nelson/research/ntp-survey99/
Here is a step by step guide on how to configure NTP on your Ubuntu machine. Please read my previous post to better understand this guide for NTP Server and Client Configuration.
NTP Server Configuration
Step 1: Install NTP server on your machine.
sudo apt-get install ntp
Step 2: Configure NTP server. NTP’s default main configuration file is located at /etc/ntp.conf.
a: add a number of servers to the server list
server 0.asia.pool.ntp.org server 1.asia.pool.ntp.org
b: restrict the server’s type of access
restrict otherntp.server.org mask 255.255.255.255 nomodify notrap noquery restrict ntp.research.gov mask 255.255.255.255 nomodify notrap noquery
Servers are not allowed to modify the run-time configuration or query your own NTP server.
c: set the localhost to have full access without any restricting keywords
restrict 127.0.0.1
d: define the network where NTP synchronization requests are accecpted by the NTP server
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
Step 3: Stop NTP.
/etc/init.d/ntp stop
Step 4: Run ntpdate command.
ntpdate 192.168.1.1
Step 5: Start NTP for the settings to take effect.
/etc/init.d/ntp restart
Step 6: Check if NTP is synchronized.
ntpq -p
Configured time servers are listed. For correct synchronization, the delay and offset values should be non-zero and the jitter value should be under 100.
NTP Client Configuration
Follow the same steps provided above and set your server configuration setting to your own server’s current ip address.
server configuration settings on ntp.conf
#server 192.168.1.1