NTPD: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
(Copy from old)
 
m (Arfon moved page NTPD - temp to NTPD: Fixing page name)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''ntpd (Network Time Protocol Daemon)'''<br>
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 ==
'''Automating the time synchronization'''<br>
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).
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-<br>
'''Running ntpd all the time'''<br>
::Just enable rc.ntpd script:
::Just enable rc.ntpd script:
::::<code>chmod +x /etc/rc.d/rc.ntpd</code>
::::<code>chmod +x /etc/rc.d/rc.ntpd</code>
Line 12: Line 9:
::::<code>/etc/rc.d/rc.ntpd start</code>
::::<code>/etc/rc.d/rc.ntpd start</code>


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


 
==Manually updating the time==
'''Manually updating the time'''<br>
Issue the following commands:
Issue the following commands:
::::<code>ntpdate -o 4 pool.ntp.org</code>
::::<code>ntpdate pool.ntp.org</code>
::::<code>hwclock --systohc</code>
::::<code>hwclock --systohc</code>
<br>
<br>


 
==Choosing the right time server==
'''Choosing the right time server'''<br>
On ntp.org you will find a complete list with the right time server for you.
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 <code>de.pool.ntp.org</code>. A complete List is available at http://support.ntp.org/bin/view/Servers/NTPPoolServers
Let's say you live in germany, then you will choose <code>de.pool.ntp.org</code>. A complete List is available at http://support.ntp.org/bin/view/Servers/NTPPoolServers
<br>
<br>


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


NOTE: Slackware 11 is immune to the 2007 DST changes.
==PROBLEMS==
 
'''PROBLEM:''' "Unable to contact time server:" error with KDE's Time Control Module.<br>
 
'''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.
'''Possible Errors & Fixes'''<br>
ERROR: "Unable to contact time server:" error with KDE time Control Module.<br>
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.




[[Category:Tutorials]]
[[Category:Tutorials]]

Latest revision as of 15:04, 30 August 2012

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 pool.ntp.org <---(updates the time)
hwclock --systohc <------(saves the time to the hardware clock)



Manually updating the time

Issue the following commands:

ntpdate 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.

PROBLEMS

PROBLEM: "Unable to contact time server:" error with KDE's 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.