Configuring the NTP Daemon

Consumer hardware is notoriously bad at keeping accurate time. NTP is a service that can query other computers over the network and synchronize your computer's clock to their time. It's very complex to configure, since the network itself isn't instantaneous, and two or more computers will usually disagree as to exactly what time it is.

There is a list of publically accessible NTP servers at, or see the actual NTP informational homepage at for other details.

Red Hat Linux comes with a sample /etc/ntp.conf, but if you just want your machine to synchronize with a public server, I recommend removing that file and starting with a far simpler script. Remove the existing file and create one that looks like the following.

/etc/ntp.conf (complete sample file)
# A very simple client-only ntp configuration.
server # local clock
fudge stratum 10 
driftfile /etc/ntp/drift
restrict default ignore
restrict mask
authenticate no

Choose your preferred NTP servers. Note that some servers are not available to the public, and some servers are too busy to handle new requests. Please do your homework in choosing appropriate servers that are geographically near you, and which will accept new public connections, and whether you must obtain their permission first.

You should select two or three servers for best results. For each server you find, discover its hostname and its fixed numerical address. Then add lines like the following to the /etc/ntp.conf file you created above.

/etc/ntp.conf (additional lines for each server)
server ntp5.someserver.etc
restrict nomodify  # ntp5.someserver.etc

(The over-simplified Red Hat Linux time and date settings application allow a single-server configuration, but usually mangles the lines in the file, unfortunately, so don't use that utility once you've edited your own /etc/ntp.conf manually.)

Next, a separate ticker file must be created that lists the servers. The following command will read the /etc/ntp.conf file you've made, and create the proper list of servers for the ticker file. This finds the hostnames listed on lines beginning with 'server', except for the initial local clock, and lists them in the ticker file.

$ su -
# awk '/^server/ {print $2}' /etc/ntp.conf | grep -v '' > /etc/ntp/step-tickers

Before starting the service, roughly synchronize your clock using one of the servers with ntpdate. Ensure your configuration is set to run the NTP daemon ntpd to track and alleviate clock drifting.

$ su -
# chkconfig --list ntpd
ntpd        0:off   1:off   2:off   3:off   4:off   5:off   6:off
# ntpdate -u ntp5.someserver.etc
 9 Dec 15:15:15 ntpdate[12345]: step time server offset 7.879896 sec
# chkconfig --level 345 ntpd on

If your system clock is likely more than a few minutes off, it is best to shut down as many applications as possible before performing gross clock corrections. Some programs may have bugs which cause them to lose data or crash. A minimal environment such as running at runlevel 1 (single user mode) is the ideal situation for drastic clock changes.

Contact Ed Halley by email at
Text, code, layout and artwork are Copyright © 1996-2005 Ed Halley.
Copying in whole or in part, with author attribution, is expressly allowed.
Any references to trademarks are illustrative and are controlled by their respective owners.
Make donations with PayPal - it's fast, free and secure!