| « HOWTO Use dnsmasq |
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
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.
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.