Setting up your node to use the IRLP NTP Servers

NTP stands for Network Time Protocol, and is a method of keeping system times synchronised across a network.

To set up your node as an NTP client, you will need to have the ntp programs installed (xntp3 for RH6.2). To check this, you can type

rpm -q ntp

rpm -q xntp3 (For RH6.2)

If ntp is installed on your system, you will see the RPM version returned, similar to the following:

[root@irlp-6290 etc]# rpm -q ntp
ntp-4.1.1-1

If you find that ntp is NOT installed, you can install it using apt-get install ntp, or yum install ntp depending on which one you use. if you don't use apt-get or yum you can browse the repository and download the RPM manually.

Once you have ntp installed, you need to edit the /etc/ntp.conf file. A sample config file that will synchronise with the servers is below:

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap noquery

# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1

# --- OUR TIMESERVERS -----
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

# --- GENERAL CONFIGURATION ---
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

#
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /var/lib/ntp/drift
broadcastdelay 0.008

If your clock is WAY off, ntp will not correct it. To initially sync your clock if there is a large error is to run the command:

ntpdate 0.pool.ntp.org

This command is a "one-off" sync of your clock to an ntp server, regardless of the time difference.

Now that you have the config file in place, you need to start the ntp daemon.

/etc/rc.d/init.d/ntpd start 

/etc/rc.d/init.d/xntpd start  (For RH 6.2)

Wait a few minutes for the time to synchronise, then enter ntpq -c peers (For RH6.2 it is xntpdc -c peers)
You should see an output listing the configured servers, thier status and the time offset:

[root@irlp-6290 etc]# ntpq -c peers -n
remote refid st t when poll reach delay offset jitter
==============================================================================
+128.208.109.7 140.142.2.8 3 u 568 1024 377 201.859 13.496 3.761
*64.142.114.146 64.142.103.194 2 u 549 1024 377 210.226 24.187 1.870
+80.85.129.25 138.195.130.71 3 u 317 1024 377 584.861 -119.63 16.100
127.127.1.0 LOCAL(0) 10 l 21 64 377 0.000 0.000 0.001

It may take several minutes before your ntp client synchronises, however eventually one server should be listed with an asterisk (*) next to it. This is the server with BEST ACCURACY, and is the server currently being used to synchronise your clock.

Any entries with a plus (+) next to them are accessible, but not currently being used. These are STANDBY servers, in the event that the current active server becomes unavailable.

The last line (127.127.1.0) is an INTERNAL server, that is used as a last resort, if no external servers can be reached. If you see an asterisk (*) next to this line, it means that your machine is in sync with itself, but essentially has a "free-running" clock.

Now all we need to do is to add the ntpd process to your system startup. The easiest way to do this is to enter:

chkconfig --level 345 ntpd on 

chkconfig --level 345 xntpd on  (For RH6.2)

Thats it - Your system time should now remain in sync with the rest of the network.