If you wish to synchronize your system time with a world time servers all you need to do is to install a ntpdate utility and issue a following linux command as a root user and you are done:

# ntpdate pool.ntp.org

The above command will synchronize your system time / clock. However, if you want to stay synchronized you need to do little bit more work. The work involves installation and configuration of NTPD daemon. NTPD uses NTP ( network time protocol ) to access a specified time server over the internet. Later, it will keep your system time synchronized without your further intervention.

First we need to install NTPD service. On Debian or Ubuntu this step is easy as:

# apt-get install ntp

In most cases your NTP Daemon will be configured out of the box and installation of ntp package is all you would ever need to do to keep your system time synchronized with internet standard time servers. However, it is good to check certain settings whether they are in place before we leave a system time in hands of NTP daemon. The absolute bare configuration is:

driftfile - this file is used by a ntp daemon to store a clock drift / synchronization error

driftfile /var/lib/ntp/ntp.drift

The second must is a fully qualified domain name of a time server which we intend to use for a time synchronization. On Ubuntu or Debian You may see default settings like:

server 0.debian.pool.ntp.org iburst
server 1.debian.pool.ntp.org iburst
server 2.debian.pool.ntp.org iburst
server 3.debian.pool.ntp.org iburst

at this point your are done with installation and configuration of NTPD daemon. All what left is to start / restart ntpd:

# /etc/init.d/ntp restart
Stopping NTP server: ntpd.
Starting NTP server: ntpd.

Next check whether your ntpd is functioning by listing of time server peers your connected to:

# ntpq  -p


     remote           refid      st t when poll reach   delay   offset  jitter
+morose.quex.org     2 u   56   64  377  312.518    6.665   1.926
+conquest.kjsl.c     2 u   51   64  377  242.611   13.283   1.001
*clock-a.develoo    2 u   46   64  377  223.659   11.650  12.113
-kiri.nonexiste.     3 u   24   64  377  290.828   -8.391   7.969

or if you wish to view a external server IP address instead of host info:

# ntpq  -pn


     remote           refid      st t when poll reach   delay   offset  jitter
+     2 u   24   64  377  312.518    6.665   0.426
+     2 u   18   64  377  241.980   14.347   1.365
*    2 u   10   64  377  250.055   -1.022   0.764
-     3 u   57   64  377  290.828   -8.391   7.969
FIND LATEST LINUX JOBS on LinuxCareers.com
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed.
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
Get extra help by visiting our LINUX FORUM or simply use comments below.