-1

ntpdate -u ipaddress working fine but ntpd not updating the time. Please suggest what is the reason.

[root@commander_a ~]# ntpdate -d 10.120.8.32
13 Jan 01:14:46 ntpdate[6172]: ntpdate 4.2.6p3@1.2290 Fri Aug 28 07:43:22 UTC 2015 (1)
Looking for host 10.120.8.32 and service ntp
host found : 10.120.8.32
transmit(10.120.8.32)
receive(10.120.8.32)
transmit(10.120.8.32)
receive(10.120.8.32)
transmit(10.120.8.32)
receive(10.120.8.32)
transmit(10.120.8.32)
receive(10.120.8.32)
transmit(10.120.8.32)
server 10.120.8.32, port 123
stratum 4, precision -6, leap 00, trust 000
refid [10.120.8.32], delay 0.04166, dispersion 0.00772
transmitted 4, in filter 4
reference time:    da406681.2209f623  Wed, Jan 13 2016  1:00:33.132
originate timestamp: da4069fc.e9768166  Wed, Jan 13 2016  1:15:24.911
transmit timestamp:  da4069dc.bc3ab362  Wed, Jan 13 2016  1:14:52.735
filter delay:  0.07344  0.04166  0.04185  0.04182
         0.00000  0.00000  0.00000  0.00000
filter offset: 32.18569 32.16714 32.16395 32.17640
         0.000000 0.000000 0.000000 0.000000
delay 0.04166, dispersion 0.00772
offset 32.167146

13 Jan 01:14:54 ntpdate[6172]: step time server 10.120.8.32 offset 32.167146 sec

My ntp.conf :

driftfile /etc/ntp/drift

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

server 10.120.8.32

restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

restrict 127.0.0.1
restrict ::1

The output of the ntpd is as follows

daemon.notice: Jan 13 07:01:56 ntpd  ntpd 4.2.6p3@1.2290 Fri Aug 28 07:43:22 UTC 2015 (1)
daemon.notice: Jan 13 07:01:56 ntpd  proto: precision = 0.120 usec
daemon.debug: Jan 13 07:01:56 ntpd  ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
daemon.info: Jan 13 07:01:56 ntpd  Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
daemon.info: Jan 13 07:01:56 ntpd  Listen and drop on 1 v6wildcard :: UDP 123
daemon.info: Jan 13 07:01:56 ntpd  Listen normally on 2 lo 127.0.0.1 UDP 123
daemon.info: Jan 13 07:01:56 ntpd  Listen normally on 3 eth0 10.120.9.199 UDP 123
daemon.info: Jan 13 07:01:56 ntpd  Listen normally on 4 eth1 192.168.31.11 UDP 123
daemon.info: Jan 13 07:01:56 ntpd  Listen normally on 5 eth1:0 192.168.31.1 UDP 123
daemon.info: Jan 13 07:01:56 ntpd  Listen normally on 6 eth0 fe80::202:6bff:fe10:742d UDP 123
daemon.info: Jan 13 07:01:56 ntpd  Listen normally on 7 eth1 fe80::202:6bff:fe10:742e UDP 123
daemon.info: Jan 13 07:01:56 ntpd  Listen normally on 8 lo ::1 UDP 123
daemon.info: Jan 13 07:01:56 ntpd  peers refreshed
daemon.info: Jan 13 07:01:56 ntpd  Listening on routing socket on fd #25 for interface updates

Here we are running a custom Ubuntu OS where i cannot run ntpq -c pe and ntpq -c rv.

Thanks for quick reply. When I execute ntpdate -d with the IPAdd of the NTP server which is located in my company network I got the following output.

[root@commander_a ~]# ntpdate -d 10.120.8.32
14 Jan 06:09:29 ntpdate[5566]: ntpdate 4.2.6p3@1.2290 Fri Aug 28 07:43:22 UTC 2015 (1)
Looking for host 10.120.8.32 and service ntp
host found : 10.120.8.32
transmit(10.120.8.32)
receive(10.120.8.32)
transmit(10.120.8.32)
receive(10.120.8.32)
transmit(10.120.8.32)
receive(10.120.8.32)
transmit(10.120.8.32)
receive(10.120.8.32)
transmit(10.120.8.32)
server 10.120.8.32, port 123
stratum 4, precision -6, leap 00, trust 000
refid [10.120.8.32], delay 0.04179, dispersion 0.00783
transmitted 4, in filter 4
reference time:    da41fe81.d7c98f2a  Thu, Jan 14 2016  6:01:21.842
originate timestamp: da420077.52aad6d8  Thu, Jan 14 2016  6:09:43.322
transmit timestamp:  da42006f.a18e4ab9  Thu, Jan 14 2016  6:09:35.631
filter delay:  0.04184  0.04179  0.04193  0.04195
         0.00000  0.00000  0.00000  0.00000
filter offset: 7.685453 7.697911 7.694673 7.691484
         0.000000 0.000000 0.000000 0.000000
delay 0.04179, dispersion 0.00783
offset 7.697911

14 Jan 06:09:37 ntpdate[5566]: step time server 10.120.8.32 offset 7.697911 sec

And when I execute ntpdate -d with the IPAdd of the NTP server which is located in outside company network I got the following out.

[root@commander_a ~]# ntpdate -d 120.88.46.10
14 Jan 06:09:51 ntpdate[5578]: ntpdate 4.2.6p3@1.2290 Fri Aug 28 07:43:22 UTC 2015 (1)
Looking for host 120.88.46.10 and service ntp
host found : 120.88.46.10
transmit(120.88.46.10)
transmit(120.88.46.10)
transmit(120.88.46.10)
transmit(120.88.46.10)
transmit(120.88.46.10)
120.88.46.10: Server dropped: no data
server 120.88.46.10, port 123
stratum 0, precision 0, leap 00, trust 000
refid [120.88.46.10], delay 0.00000, dispersion 64.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Sun, Dec 31 1899 19:00:00.000
originate timestamp: 00000000.00000000  Sun, Dec 31 1899 19:00:00.000
transmit timestamp:  da420085.ea58e3ed  Thu, Jan 14 2016  6:09:57.915
filter delay:  0.00000  0.00000  0.00000  0.00000
         0.00000  0.00000  0.00000  0.00000
filter offset: 0.000000 0.000000 0.000000 0.000000
         0.000000 0.000000 0.000000 0.000000
delay 0.00000, dispersion 64.00000
offset 0.000000

14 Jan 06:09:59 ntpdate[5578]: no server suitable for synchronization found

Do you know what is the reason for this. Because you told that ntpdate -d option will bypass the firewall. In that case ntpdate should work in both the cases at least.

bummi
  • 162
  • 2
  • 2
  • 9

1 Answers1

0

Firstly, ntpdate -d doesn't set the clock; this from man ntpdate:

   -d      Enable the debugging mode, in which ntpdate will go through all
           the steps, but not adjust the local clock.  Information  useful
           for general debugging will also be printed.

Secondly, you give us no reason to think that you're actually running ntpd (and some that you're not). Can you confirm ntpd is running, and show us the output of ntpq -c pe and ntpq -c rv?

Edit: thanks for the output. I accept that you are running ntpd, but there are a number of reasons why ntpd might not adjust the clock - one of which is famously that it's more than 20 minutes wrong.

I accept that you say you're running ntpdate with -u, but that's not what you show us. Could we see the output of ntpdate -u ..., then some evidence that the clock is right, followed by a later observation that it's wrong?

By the way, why are you running ntpdate with -u? If you find that you have to do that to get past an idiot local firewall that won't let packets with source port 123 out, which is what the flag is for, then be aware that ntpd is going to have exactly the same problem.

Edit 2: please read more carefully what I wrote. I did not say that "ntpdate -d option will bypass the firewall". I said that you insisted you were running ntpdate -u (even though you have showed me only output from ntpdate -d), and asked if you were doing that to bypass a stupid firewall, because if you were ntpd would predictably fail.

(That does not mean that ntpdate -u will magically bypass all firewalls; it just means that it makes the request come from a local unprivileged port, which is a technique to get past some very old and stupid firewalls.)

Until you start reading what I wrote and showing us what you're actually doing, and what I asked for, I don't think this question can be answered.

MadHatter
  • 79,770
  • 20
  • 184
  • 232
  • Thank you very much for the reply. I have updated the details you asked in my question itself please check. and I am running ntpdate -u to updated the time manually not ntpdate -d. When i use ntpdate -u time is getting updated but not when i run ntpd deamon. – Madhusudhan Jan 14 '16 at 09:58
  • Hi Am new to this forum so instead of posting a question i posted it as answer please check my another question posted. – Madhusudhan Jan 14 '16 at 11:19