ntp and ntpdate not working

Issues related to configuring your network
Post Reply
davea66
Posts: 2
Joined: 2017/03/23 10:25:06

ntp and ntpdate not working

Post by davea66 » 2017/03/23 10:36:24

Hi

We have a private neworkt established with internet breakout except from the central site.
On the central site I have a CentOS 7 machine to act as a time server which is getting its time from 0,1,2 and 3.uk.pool.ntp.org and this is working fine.

ntpd on this machine needs to act as a time server for other machines in the private network.
I have a machine running CentOS 5 on another site I am using to test to get this set up.

Port forwarding on the central site directs port 123 UDP to the time server.

From the remote machine if I run ntpdate -q I get:-

Code: Select all

[root@localhost etc]# ntpdate -q 172.31.7.127
server 172.31.7.127, stratum 2, offset 57.711920, delay 0.07162
23 Mar 10:31:13 ntpdate[16069]: step time server 172.31.7.127 offset 57.711920 sec
If I run ntpdate -d I get:-

Code: Select all

ntpdate -d 172.31.7.127
23 Mar 10:32:20 ntpdate[32093]: ntpdate 4.2.6p5@1.2349-o Sat Dec 20 02:53:40 UTC 2014 (1)
Looking for host 172.31.7.127 and service ntp
host found : 172.31.7.127
transmit(172.31.7.127)
receive(172.31.7.127)
transmit(172.31.7.127)
receive(172.31.7.127)
transmit(172.31.7.127)
receive(172.31.7.127)
transmit(172.31.7.127)
receive(172.31.7.127)
server 172.31.7.127, port 123
stratum 2, precision -23, leap 00, trust 000
refid [172.31.7.127], delay 0.07231, dispersion 0.00020
transmitted 4, in filter 4
reference time:    dc7e2179.35b463a7  Thu, Mar 23 2017 10:27:05.209
originate timestamp: dc7e22f8.c5f05485  Thu, Mar 23 2017 10:33:28.773
transmit timestamp:  dc7e22bf.08772c98  Thu, Mar 23 2017 10:32:31.033
filter delay:  0.07607  0.07231  0.07288  0.07304
         0.00000  0.00000  0.00000  0.00000
filter offset: 57.71543 57.71658 57.71656 57.71635
         0.000000 0.000000 0.000000 0.000000
delay 0.07231, dispersion 0.00020
offset 57.716588
However if I run ntpdate or try to user service ntpd to poll to set the time it fails:-

Code: Select all

[root@localhost etc]# ntpdate 172.31.7.127
23 Mar 10:33:44 ntpdate[18571]: no server suitable for synchronization found

Code: Select all

 ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 172.31.7.127    .INIT.          16 u    -   64    0    0.000    0.000   0.000

Any advice please??

Thanks

Dave

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: ntp and ntpdate not working

Post by avij » 2017/03/23 14:16:42

ntpdate's -q and -d options have a funny side effect -- using those will change the source port to an unprivileged port. Without those options, the UDP packets are sent from port 123 on the client to port 123 on the server. Port 123 to port 123 is also the way ntpd works.

So in short, this is likely a firewall issue. You may need to allow incoming UDP to port 123 from your time server to your clients.

davea66
Posts: 2
Joined: 2017/03/23 10:25:06

Re: ntp and ntpdate not working

Post by davea66 » 2017/03/23 16:07:12

Thanks for the reply!

The firewall on both machine is off whilst I try to get this working.
Port 123 is forwarded on the router to the time server at the central site.
The router firewall is also off

Scratching my head a bit :)

Cheers

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: ntp and ntpdate not working

Post by avij » 2017/03/23 16:34:18

You can use tcpdump (with appropriate options) to see what's going on.

Post Reply