Wednesday, September 10, 2008

Linux Network Time Protocol (NTP)

Time sync is important for both Windows and Unix computers and this is usually accomplished in an enterprise environment using an external NTP server. Both operating systems come with their own preferred servers, however, there are a slew of time servers available and the most popular ones can be found at the National Institute of Standards and Technology (NIST) - http://tf.nist.gov/service/time-servers.html

Your ntp.conf is located in the /etc directory on your *nix host. If you examine the file (vi, cat, more) it should look something like this:


Restrict default nomodify notrap noquery
restrict 127.0.0.1
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
keys /etc/ntp/keys
server www.time.gov
restrict time mask 255.255.255.255 nomodify notrap noquery


If you cd to /usr/sbin and run ntpq -p you should see your NTP server listed and the status of the server.

remote refid st t when poll reach delay offset jitter
==============================================================================
*www.time.gov 192.43.244.18 2 u 987 1024 377 10.471 3.530 1.369




If you don't see the * in front of your time server it signifies that the time is not in sync with the remote time server. If the jitter is a really large number, that also is a clue that the NTP is not working. You could have a firewall that is not allowing the time protocol to pass or perhaps that time server is not available.

My recommendation is to use a dedicated host inside your network as the time server, that utilizes a pool of time servers. Point all your hosts to the local time server and create an alias called "time" that you reference in your ntp.conf file instead of using a specific time host. This will allow time servers to come and go and you don't have to update the ntp.conf on every host.

Enjoy!


No comments: