On 2008-10-14, Mohit Aron <[EMAIL PROTECTED]> wrote: > I've ready in numerous places that ntpdate is going to be deprecated > and that one should use 'ntpd -q -g' instead. I have also read > complaints by people that 'ntpd -q -g' is slow, but I haven't read > about any suitable resolution to this issue. My own system uses 'ntpd > -q -g' to synchronize with an Internal time server and the call to > 'ntpd -q -g' takes more than 3 minutes to complete.
In my tests 'ntpd -gq' takes all of 11 seconds to run with an ntp.conf which just specifies a time server on the LAN. >This slows up the startup of my machine. If you don't need to block the boot process while the clock is initially set there is no need to use 'ntpq -gq'. Starting ntpd with '-g' is enough to ensure that the time will be set correctly no matter how far off the system clock may be. > Here's the /etc/ntp.conf of my client machine (where the our local ntp > server has the IP 10.50.33.100): Reordered for clarity ... > logfile /var/log/ntp.log > driftfile /var/log/ntp.drift > restrict default notrust nomodify notrap noquery > > server 10.50.33.100 iburst minpoll 4 > restrict 10.50.33.100 > > server 127.127.1.0 > fudge 127.127.1.0 stratum 11 > restrict 127.127.1.0 The Undisciplined Local Clock (127.127.1.x) is not needed unless this ntpd is serving time to others. However this has nothing to do with your slow start-up. > I also ran a tcpdump to capture the ntp packets being exchanged between the > client and the server. It seems the client sends a total of 13 requests to > the server - each of which is responded to immediately. The first 9 requests > are spaced at period of 2 seconds each. The 10th one is sent one second > after the 9th request. The 11th one is sent 18s after then 10th. The 12th > one is sent 65 seconds after the 11th. Finally, the 13th one is sent 66s > after the 12th one. Personally, I would have been extremely happy if 'ntpd > -q -g' terminated after the first request was sent and the reply was > received. ntpd has to collect a certain amount of data before it will believe a particular time source. The first volley of polls are generally more than enough to allow ntpd to determine a close approximation of the correct time. If the clock is more than 128ms off it will be stepped otherwise a slew will be initiated; ntpd exits immediately after the step or the initiation of the slew. > Issuing 'ntpdate 10.50.33.100' completes almost instantaneously. That's because ntpdate blindly accepts the first reply it receives. -- Steve Kostecke <[EMAIL PROTECTED]> NTP Public Services Project - http://support.ntp.org/ _______________________________________________ questions mailing list [email protected] https://lists.ntp.org/mailman/listinfo/questions
