In our production box, I am a facing a problem with ntpd. I am enabling the NTP feature for our production box and observing one isssue.
We start the ntpd daemon in the initialization process of our box. During that time internet connection is not there. Below is my small ntp.conf
file
driftfile /etc/ntp.drift
logconfig =syncstatus
server pool.ntp.org iburst
Our box get internet connectivity little late once the interface comes up. That time I see that ntpd does not sync the clock. When I do ntpq -c as
, I get no association id's found
. I did wait for almost 30 min but still got no association id's found
I have to restart the ntpd. After restarting it, ntpd syncs the clock and everything works normally.
But again if I reboot my box then same issue happens. Again I have to restart ntpd, once box comes up and internet is reachable.
Did any one faced similar kind of problem?
Should I delay start of ntpd till the time interface comes up?
Update
I did some more experiment and I replaced server pool.ntp.org iburst
with pool pool.ntp.org iburst
and with this change ntpd sync the clock automatically. I didn't have to restart the ntpd. So here arises another question to me.
What happened when I replaced server
with pool
?
Should I always use pool
keyword instead of server
?
When should I use pool
and when should I use server
?
I did some research and found that
pool is the same as server, except it resolves one name into several addresses and uses them all
if they are doing same thing then why server pool.ntp.org iburst
didn't worked for me but pool pool.ntp.org iburst
worked.
Update
As suggested, I have used pool
instead of server
but still my clock is not able to synchronize at bootup. Previously no association id's found
was coming but after using pool it is displaying the list.
GW:/admin# ntpq -c lpeer
remote refid st t when poll reach delay offset jitter
===================================================================== =========
time.google.com .POOL. 16 p - 64 0 0.000 +0.000 0.002
GW:/admin# ntpq -np
remote refid st t when poll reach delay offset jitter
time.google.com .POOL. 16 p - 64 0 0.000 +0.000 0.002
GW:/admin# ntpq -c as
ind assid status conf reach auth condition last_event cnt
===========================================================
1 34173 8811 yes none none reject mobilize 1
GW:/admin# ntpq -c "rv 34173"
associd=34173 status=8811 conf, bcast, sel_reject, 1 event, mobilize,
srcadr=0.0.0.0, srcport=0, srchost="time.google.com", dstadr=0.0.0.0,
dstport=0, leap=11, stratum=16, precision=-19, rootdelay=0.000,
rootdisp=0.000, refid=POOL, reftime=(no time), rec=(no time), reach=000,
unreach=0, hmode=3, pmode=0, hpoll=6, ppoll=10, headway=0,
flash=1400 peer_dist, peer_unreach, keyid=0, offset=+0.000, delay=0.000,
dispersion=16000.000, jitter=0.002,
filtdelay= 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00,
filtoffset= +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00,
filtdisp= 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0 16000.0
I see flash status as 1400
. What is the meaning of 1400
I was not able to found the flash status 1400
in ntp documentation.
Update
It started working. I replaced iburst
with minpoll 3 maxpoll 4
and after that it is working on reboot. I used pool like this pool pool.ntp.org minpoll 3 maxpoll 4
.
I am not sure what difference does this change made.
I also read that we should avoid using minpoll and maxpoll.
Too frequent for a sustained period and public NTP services may block you. ntpd is already good at dynamically selecting the pool interval.
Anyway thank you all for helping me.