Sync Linux Server Time with NTP Daemon


I have web server which serving forum service and it’s powered with few linux web server boxes.

Time accuracy for the forum posting for each server is quite critical. If not, all posting from different server will be mess up.

To keep server time in sync for all servers I install NTP daemon and here is what the step taken on my Linux box :

  1. Install the ntp service if it’s not already installed.

    # yum install ntp

  2. Both UDP port 123 have to be open for incoming and outgoing on the firewall.
  3. Find a reliable close ntp pool server. For default installation ntp server should be
    server 0.pool.ntp.org
    server 1.pool.ntp.org
    server 2.pool.ntp.org

  1. The 0, 1 and 2.pool.ntp.org names point to a random set of servers that will change every hour.

    You can view the ntp server list by opening the "/etc/ntp.conf" file.

  2. Make sure your computer’s clock is set to something sensible (within a few minutes of the ‘true’ time) - you could use `ntpdate pool.ntp.org` to start pooling server time.
  3. Now enable the ntp service daemon to starts up at boot and then start the service:

    # /sbin/chkconfig ntpd on
    #/sbin/service ntpd start

  4. Ater some time if you want to see exactly what is happening, you can run the query command:
    # ntpq -pn localhost

Tips:

  1. Make sure that the time zone configuration of your computer is correct. ntpd itself does not do anything about the time zones, it just uses UTC internally.
  2. If you are synchronising a network to pool.ntp.org, please set up one of your computers as a time server and synchronize the other computers to that one.
  3. Good reading How do I setup NTP to use pool

No Comments

Leave a reply

You must be logged in to post a comment.