ntpd -gq not working

as advised and documented, i'm trying to use the ntpd -gq instead of ntpdate. The result is that clock not set. as below. However ntpdate is working ok and had set the clock correctly

this is the ntp.conf file:

[root@CentOS5 ~]# cat /etc/ntp.conf
logfile  /var/log/ntp.log
driftfile /var/lib/ntp/drift
server 0.centos.pool.ntp.org

this is the output of command:

[root@CentOS5 ~]# ntpd -dqg
ntpd 4.2.2p1@1.1570-o Sat Dec 19 00:58:16 UTC 2009 (1)
addto_syslog: precision = 1.000 usec
create_sockets(123)
addto_syslog: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
bind() fd 16, family 2, port 123, addr 0.0.0.0, flags=9
Added addr 0.0.0.0 to list of addresses
addto_syslog: Listening on interface wildcard, 0.0.0.0#123 Disabled
bind() fd 17, family 10, port 123, addr ::, flags=1
Added addr :: to list of addresses
addto_syslog: Listening on interface wildcard, ::#123 Disabled
bind() fd 18, family 10, port 123, addr ::1, flags=1
Added addr ::1 to list of addresses
addto_syslog: Listening on interface lo, ::1#123 Enabled
bind() fd 19, family 10, port 123, addr fe80::20c:29ff:fedc:9809, flags=1
Added addr fe80::20c:29ff:fedc:9809 to list of addresses
addto_syslog: Listening on interface eth0, fe80::20c:29ff:fedc:9809#123 Enabled
bind() fd 20, family 2, port 123, addr 127.0.0.1, flags=5
Added addr 127.0.0.1 to list of addresses
addto_syslog: Listening on interface lo, 127.0.0.1#123 Enabled
bind() fd 21, family 2, port 123, addr 192.168.180.129, flags=25
Added addr 192.168.180.129 to list of addresses
addto_syslog: Listening on interface eth0, 192.168.180.129#123 Enabled
init_io: maxactivefd 21
local_clock: time 0 base 0.000000 offset 0.000000 freq 0.000 state 0
addto_syslog: frequency initialized 0.000 PPM from /var/lib/ntp/drift

key_expire: at 0
peer_clear: at 0 next 1 assoc ID 53071 refid INIT
newpeer: 192.168.180.129->194.38.104.240 mode 3 vers 4 poll 6 10 flags 0x201 0x1 ttl 0 key 00000000
local_clock: time 0 base 0.000000 offset 0.000000 freq 0.000 state 1
report_event: system event 'event_restart' (0x01) status 'sync_alarm, sync_unspec, 1 event, event_unspec' (0xc010)
transmit: at 1 192.168.180.129->194.38.104.240 mode 3
auth_agekeys: at 1 keys 1 expired 0
timer: refresh ts 0
1 receive: at 1 192.168.180.129<-194.38.104.240 mode 4 code 1 auth 0
peer 194.38.104.240 event 'event_reach' (0x84) status 'unreach, conf, 1 event, event_reach' (0x8014)
clock_filter: n 1 off 42904.765724 del 0.610083 dsp 7.937506 jit 0.000001, age 0
transmit: at 2 192.168.180.129->194.38.104.240 mode 3
3 receive: at 2 192.168.180.129<-194.38.104.240 mode 4 code 1 auth 0
clock_filter: n 2 off 42905.489022 del 0.390840 dsp 3.937510 jit 0.723298, age 0
4 transmit: at 4 192.168.180.129->194.38.104.240 mode 3
5 receive: at 4 192.168.180.129<-194.38.104.240 mode 4 code 1 auth 0
clock_filter: n 3 off 42905.489022 del 0.390840 dsp 1.937534 jit 1.572867, age 2
6 transmit: at 6 192.168.180.129->194.38.104.240 mode 3
7 receive: at 7 192.168.180.129<-194.38.104.240 mode 4 code 1 auth 0
clock_filter: n 3 off 42905.489022 del 0.390840 dsp 0.937575 jit 1.572867, age 5
8 transmit: at 8 192.168.180.129->194.38.104.240 mode 3
9 receive: at 9 192.168.180.129<-194.38.104.240 mode 4 code 1 auth 0
clock_filter: n 3 off 42905.489022 del 0.390840 dsp 0.437603 jit 1.572867, age 7
10 transmit: at 10 192.168.180.129->194.38.104.240 mode 3
11 receive: at 10 192.168.180.129<-194.38.104.240 mode 4 code 1 auth 0
clock_filter: n 4 off 42905.489022 del 0.390840 dsp 0.187593 jit 2.808103, age 8
12 transmit: at 12 192.168.180.129->194.38.104.240 mode 3
13 receive: at 12 192.168.180.129<-194.38.104.240 mode 4 code 1 auth 0
clock_filter: n 5 off 42905.489022 del 0.390840 dsp 0.062621 jit 3.808021, age 10
14 transmit: at 14 192.168.180.129->194.38.104.240 mode 3
15 receive: at 14 192.168.180.129<-194.38.104.240 mode 4 code 1 auth 0
clock_filter: n 6 off 42905.489022 del 0.390840 dsp 0.000132 jit 4.733917, age 12
16 addto_syslog: no reply; clock not set

Also attached is the trace file, from the trace file, everything seems ok, timestamps is sent and received:

How come you do not have a restrict statement in your /etc/ntp.conf? Something like

restrict default kod nomodify notrap nopeer noquery

when no restrict statement is there, the access is allowed for everything and everyhosts. this is from the man page of ntp_acc:

i have added the restrict to the config and the result is the same:

[root@CentOS5 ~]# cat /etc/ntp.conf
logfile  /var/log/ntp.log
driftfile /var/lib/ntp/drift
restrict 0.centos.pool.ntp.org
server 0.centos.pool.ntp.org

Please add this line to the top of your ntp.conf file

restrict default kod nomodify notrap nopeer noquery

and remove the line

restict 0.centos.pool.ntp.org

and try again.

as i said before, restrict 0.centos.pool.ntp.org will allow all ntp traffic for the mentioned host. the code:

restrict default kod nomodify notrap nopeer noquery

will create a default rule for all hosts not mentioned explicitly.

anyway, i have tried your suggestion but i still face the same problem. i'm afraid that it is a bug in the distribution.

Which Centos distribution are you using?

[root@CentOS5 ~]# uname -a
Linux CentOS5 2.6.18-194.11.1.el5 #1 SMP Tue Aug 10 19:09:06 EDT 2010 i686 i686 i386 GNU/Linux