Friday, August 20, 2004

Network Time Protocol

Configuring NTP on Linux Server

Network Time Protocol, NTP is a service that can query other computers over the network
and synchronize the computer's clock to the server's time.

Steps
--------

1) Connect to server using SSH

2) Install NTP. Download rpm from rpmfind.net for the relevant Redhat release.
3) Create the backup of existing /etc/ntp.conf file.
mv /etc/ntp.conf /etc/ntp.conf.bkp

4) Create a new /etc/ntp.conf file with following contents.

--------------------------------

server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

# servers added by Zed www.bldrdoc.gov/timefreq/service/time-servers.html
server 129.6.15.28
server 129.6.15.29
server 63.149.208.50
server 132.163.4.101
server 132.163.4.102
server 132.163.4.103
server 128.138.140.44
server 192.43.244.18
server 131.107.1.10
server 216.200.93.8
server 208.184.49.9
server 207.126.103.204
server 207.200.81.113
server 205.188.185.33

driftfile /etc/ntp/drift
multicastclient # listen on default 224.0.1.1
broadcastdelay 0.008

#
# Authentication delay. If you use, or plan to use someday, the
# authentication facility you should make the programs in the auth_stuff
# directory and figure out what this number should be on your machine.
#
authenticate no

-----------------------------

5) Create the separate ticker file /etc/ntp/step-tickers that contains the list of time servers. Use the following command to create the step-tickers file.
awk '/^server/ {print $2}' /etc/ntp.conf | grep -v '127.127.1.0' > /etc/ntp/step-tickers

6) Change the timezone of the server.

ln -sf /usr/share/zoneinfo/GMT /etc/localtime

7) Edit /etc/sysconfig/clock and make sure it has the below entries. If not change it.

ZONE="GMT"
UTC=true
ARC=false

8) Before starting the service, synchronize your clock using one of the servers with ntpdate command.
ntpdate -u nist1.datum.com

9) Start the NTPD daemon.
/etc/rc.d/init.d/ntpd start

10) Check the configuration using ntpq -p command.

11) Configure your server to start NTPD at startup.
chkconfig --level 345 ntpd on