NTPD

From SlackWiki
Revision as of 05:29, 4 June 2009 by Erik (talk | contribs) (Copy from old)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ntpd (Network Time Protocol Daemon)
The ntpd program is an operating system daemon which sets and maintains the system time of day in synchronism with Internet standard time servers. It is a complete implementation of the Network Time Protocol (NTP) version 4, but also retains compatibility with version 3, as defined by RFC-1305, and version 1 and 2, as defined by RFC-1059 and RFC-1119, respectively.


Automating the time synchronization
You have two choices for automatic time updating, you can run ntpd all the time as a background process or you can have it run once in awhile (if you are tight on system resources).

Running ntpd all the time-

Just enable rc.ntpd script:
chmod +x /etc/rc.d/rc.ntpd
After the script is enabled you probably will want ntpd to start immediately so, can either restart the system or manually start ntpd with:
/etc/rc.d/rc.ntpd start

Running ntpd once in awhile-

You have many choices but the two best ones are:
1) Set up a cron job
2) Set up a /etc/rc.d/rc.local entry and update the time on start-up only.
Either way, you need to add the following commands into your cron job or rc.local script:
ntpdate -o 4 pool.ntp.org <---(updates the time)
hwclock --systohc <-----------------(saves the time to the hardware clock)


Manually updating the time
Issue the following commands:

ntpdate -o 4 pool.ntp.org
hwclock --systohc


Choosing the right time server
On ntp.org you will find a complete list with the right time server for you. Let's say you live in germany, then you will choose de.pool.ntp.org. A complete List is available at http://support.ntp.org/bin/view/Servers/NTPPoolServers


DST changes
If your time is off due to DST changes, you must update the /etc/localtime file. You should be able to find a correct file on the internet and just replace the old /etc/localtime file.

NOTE: Slackware 11 is immune to the 2007 DST changes.


Possible Errors & Fixes
ERROR: "Unable to contact time server:" error with KDE time Control Module.
FIX: Make sure ntpd is NOT running. If ntpd is running, manual ntp and KDE ntp updates will return errors due to ntpd having control of the ntp port.