Saturday, November 26, 2011

Network Time Protocol (NTP) configuration

One time updatentp

If you want to synchronize with NTP server just now, then execute the following command:

$ sudo ntpdate 1.in.pool.ntp.org

Here 1.in.pool.ntp.org is the NTP server we are synchronizing with. You can find closer NTP server to your country from www.pool.ntp.org

NTP automatic synchronization through service

$ sudo apt-get install ntp

$ sudo service ntp start

If you want to synchronize with more closer NTP servers, then edit ntp.conf file by replacing the existing NTP servers with closer servers.

$ sudo nano /etc/ntp.conf

now change ntp servers if you want and save the file and restart the service

$ sudo service ntp restart

NOTE: if you are running other distributions than Ubuntu, then login as root and run the command without “sudo” in front of it