« HOWTO Use dnsmasq

Network Time Protocol (NTP) HOWTO

14/07/08

Network Time Protocol (NTP) HOWTO

Configuring Your First Machine

Internal Clock, Out Of Sync When First Turned On.

As already stated there can be a delay in synchronization of your clock when NTP is first started. If the internal clock on your machine is inaccurate which most PC clocks are and you frequently turn off your machine for long periods. Such as over night or when you are at work. This will mean your machine will be badly out of synchronization when it is first tuned on. There are two solutions to this, you can use either.

Using The -g Flag With ntpd.

The command line flag -g for ntpd is used when you want to force the clock to be set when the time variance is greater than the panic threshold of 1000 seconds. A time variance of this size or greater would normally cause ntpd to close down. You can set this option by amending the file /etc/default/ntp and adding '-g' as should on the code line below

New line for /etc/default/ntp
NTPD_OPTS='-g'

Running ntpdate

ntpdate is an old utility program that is due to be retired from NTP. But while it is still included... . The official documentation suggest you use a call to ntpd using the -g -q command line switches.

A second way to set the internal clock on your machine at boot time is to add a call to ntpdate into the B/etc/rc.local> file. Commands in this file are run after all the other init scripts for the current run level are completed. This means that there will already be a copy of ntpd running and so UDP port 123 will already be in use. This means you will need to stop and start ntpd.

A third way is to add a call to ntpdate in the NTP startup script /etc/init.d/ntp. Add the lines to define the variable NTPDATE_SERVERS and then add the extra lines of code.

sudo nano /etc/init.d/ntp
New Lines for /etc/init.d/ntp:
NTPDATE_SERVERS="0.uk.pool.ntp.org 1.uk.pool.ntp.org 2.uk.pool.ntp.org 3.uk.pool.ntp.org"  
 
case $1 in  
        start)  
                log_daemon_msg "Initial date/time being set" "ntpdate"  
                NTPDATE_OUT=`ntpdate -u $NTPDATE_SERVERS`  
                log_daemon_msg $NTPDATE_OUT "ntpdate" 
Hint
If you are not in the UK you should use different time servers. 
 

We now have all that is needed to get your machine synchronized with the time servers in the pool. It will work but it is really insecure. NTP has an access control list mechanism containing address/match combinations.


Pages: 1 · 2 · 3 · 4 · 5 · 6 · 7 · 8

No feedback yet

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
PoorExcellent
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
What can birds and aeroplanes both do?
antispam test