Configuring Network Time Protocol (NTP)

Getting NTP to work on a Linux box seems like it ought to be fairly simple, and it isn't that complicated. But I had a bear of a time getting it to work on some Red Hat boxes, although I had no troubles on some HP-UX and Sun boxes, and even some other Red Hat boxes.

The key things were:

  • Have the time server that you're synching to in /etc/ntp.conf. You can have all sorts of settings in there, but the key one is the 'server' line. Linux Magazine has good article that includes a short ntp.conf file.
  • Make sure the time server's address is in the /etc/ntp/step-tickers file.
  • Make sure all (three) files in /etc/ntp are owned by ntp and not root. I think at least some of the files get written to when /etc/init.d/ntpd is started, and ntpd runs under the ntp ID.
  • When you run 'service ntpd start', you should see a message from ntpd saying it is synchronizing with the time server. If you don't see this message, something is still wrong.
  • Use ntptrace to check whether synching is working or not.