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
OUTPUT:
remote refid st t when poll reach delay offset jitter ============================================================================== +morose.quex.org 128.118.25.5 2 u 56 64 377 312.518 6.665 1.926 +conquest.kjsl.c 69.36.224.15 2 u 51 64 377 242.611 13.283 1.001 *clock-a.develoo 164.67.62.212 2 u 46 64 377 223.659 11.650 12.113 -kiri.nonexiste. 173.9.142.98 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
OUTPUT:
remote refid st t when poll reach delay offset jitter ============================================================================== +206.222.28.90 128.118.25.5 2 u 24 64 377 312.518 6.665 0.426 +198.137.202.16 69.36.224.15 2 u 18 64 377 241.980 14.347 1.365 *207.171.7.151 164.67.62.212 2 u 10 64 377 250.055 -1.022 0.764 -173.45.238.221 173.9.142.98 3 u 57 64 377 290.828 -8.391 7.969