ntpstat shows unsynchronised

General support questions
mshafiuddin
Posts: 24
Joined: 2019/03/07 10:55:29

ntpstat shows unsynchronised

Post by mshafiuddin » 2019/03/09 17:24:14

Experts: I have NTP server ( Windows 2016 server ) and we need our CentOS machines should take time from that ( Windows Server )
We have done required configuration in ntp.conf and CentOS machine shows it is communicating with NTP server, ( it is confirmed that CentOS time source is my NTP server ) below is the output of ntpq -pn

Code: Select all

[root@prod1 ~]# ntpq -pn
  remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 x.x.x.x      .LOCL.           1 u   44   64  377    0.549   27.278   0.719
But when i am checking the ntpstat it shows "unsynchronised" - here is our query that why it shows unsynchronised - below is output of ntpstat

Code: Select all

[root@prod1 ~]# ntpstat
unsynchronised
  time server re-starting
   polling server every 8 s
Note : I have attached my ntp.conf file here to refer and for better understanding.
Attachments
ntp.txt
(2.3 KiB) Downloaded 967 times

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

Re: ntpstat shows unsynchronised

Post by avij » 2019/03/09 19:23:22

I don't see anything particularly wrong with your config file. Are you running your CentOS machines as virtual machines or on real hardware? If virtual, which virtualization software? What does your uname -a (without hostname) report?

See if there's anything interesting in /var/log/messages: grep ntpd /var/log/messages

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: ntpstat shows unsynchronised

Post by TrevorH » 2019/03/09 21:54:24

That .LOCL. does not look right. I think that means it is preferring itself over any server that you've told it about. Since you've obscured the ip addresses of everything it's impossible to tell but are you sure that isn't your own local machine's ip?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: ntpstat shows unsynchronised

Post by hunter86_bg » 2019/03/10 02:25:23

Try to first synchronize the CentOS to your Win Server via ntpdate.

The output of

Code: Select all

ntpq -pn
will give you all you need.
The most important part is infront of the win 2016 server's IP. If it's a "*" - all is OK , but as per your post - there is no "*" infront of that.

Note: Best Practice is to have 4 NTP sources in order the NTP client's algorithm to kick in.

I have seen issues where an AD controller which was 30 min (yes, half an hour) away from it's own source.

mshafiuddin
Posts: 24
Joined: 2019/03/07 10:55:29

Re: ntpstat shows unsynchronised

Post by mshafiuddin » 2019/03/10 12:33:40

@ TrevorH : Yes i am sure , ntpq -an shows the IP address of my NTP server

@ hunter86_bg : Brother, Yes my NTP server is windows 2016 and my CentOS machine client both are ( virtual machines, and hosted on ESXi 6.7 - vmware virtual platform).

i did not understand you comment ( "If it's a "*" ) what it is ? and where you trying to see it ?
Let me know any output of any command i will update here so that you can check all things that you need.

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

Re: ntpstat shows unsynchronised

Post by avij » 2019/03/10 13:19:13

Here's ntpq -pn output from one of my time servers (as an aside, it's a pool server -- more NTP servers would be welcome).

Code: Select all

# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+194.100.49.152  193.166.4.49     2 u  607 1024  377    1.101    0.080   0.277
+178.251.154.103 194.100.2.194    2 u  684 1024  377    0.868    0.140   0.796
*194.100.2.194   .GPS.            1 u  771 1024  377    0.802    0.119   0.359
-185.31.136.34   193.79.237.14    2 u  555 1024  377    1.051   -2.489   0.537
The important thing here is the * in the first column. It marks the upstream time source ntpd has synchonized with.

If you run grep ntpd /var/log/messages you may get some information about why ntpd has failed to synchonize with the specified upstream time source.

Some old Windows Servers were not suitable as NTP time sources because they only supplied the time with a one second precision, but I think Windows Server 2016 is new enough so that this isn't a problem.

You could try synchonizing the clock manually to see if it works. Steps to do that:

Code: Select all

# systemctl stop ntpd.service
# ntpdate your.time.server
10 Mar 15:23:01 ntpdate[44447]: adjust time server your.time.server offset 0.030762 sec
# ntpdate your.time.server
10 Mar 15:23:09 ntpdate[44458]: adjust time server your.time.server offset 0.001049 sec
# systemctl start ntpd.service
You will need to stop ntpd before setting the clock. The reason for running ntpdate twice is to see that your clock was indeed set to the correct time. The offset in the output of the second invocation of ntpdate should be significantly smaller than in the first, like one millisecond in the above example. Finally restart the ntpd service again.

mshafiuddin
Posts: 24
Joined: 2019/03/07 10:55:29

Re: ntpstat shows unsynchronised

Post by mshafiuddin » 2019/03/10 15:07:51

@ avij : Hi Bor... I dont see anything in grep ntpd /var/log/messages, not sure why. below is the output of grep ntpd /var/log/messages
[root@prod1 ~]# grep ntpd /var/log/messages
[root@prod1 ~]#

I have issued commands as you said, below are the outputs. ( as you said 2 times issued command and can see small difference in offset )
[root@prod1 ~]# systemctl stop ntpd.service
[root@prod1 ~]# ntpdate 10.33.1.30
10 Mar 17:56:52 ntpdate[23021]: adjust time server 10.33.1.30 offset 0.062118 sec
[root@prod1 ~]# ntpdate 10.33.1.30
10 Mar 17:57:02 ntpdate[23022]: adjust time server 10.33.1.30 offset 0.059432 sec
[root@prod1 ~]# systemctl start ntpd.service

in output of command ntpq -pn i am having only 1 server IP and that is NTP server ( Windows 2016 it is Windows domain controller ) and in the output is not having any "*" you can see below output
[root@prod1 ~]# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
x.x.x.x .LOCL. 1 u 51 64 37 0.594 -30.969 63.487
[root@prod1 ~]#
Please let me know is there any suggestion ? to update more ntp servers ? because we can see there are more pool servers in ntp.conf .

server x.x.x.x iburst prefer
# server 0.centos.pool.ntp.org iburst
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: ntpstat shows unsynchronised

Post by hunter86_bg » 2019/03/10 16:38:23

Anything reported by

Code: Select all

journalctl -u ntpd.service -e

User avatar
TrevorH
Site Admin
Posts: 33216
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: ntpstat shows unsynchronised

Post by TrevorH » 2019/03/10 17:52:57

Is 10.33.1.30 the ntp server you are trying to use from nptd?

All those centos.pool server entries are commented out so are not being used.

Are you sure your Windows server has an accurate time? Is the port open in its windows firewall? Was that ntpdate output from a sync to the same server?

How long have you left it trying to sync? It can take 10 minutes or more sometimes.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

mshafiuddin
Posts: 24
Joined: 2019/03/07 10:55:29

Re: ntpstat shows unsynchronised

Post by mshafiuddin » 2019/03/10 19:38:29

@ hunter86_bg : below is output of command journalctl -u ntpd.service -e
Mar 09 20:26:48 prod1 ntpd[22550]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Mar 09 20:26:48 prod1 ntpd[22550]: Listen and drop on 1 v6wildcard :: UDP 123
Mar 09 20:26:48 prod1 ntpd[22550]: Listen normally on 2 lo 127.0.0.1 UDP 123
Mar 09 20:26:48 prod1 ntpd[22550]: Listen normally on 3 ens192 10.33.4.10 UDP 123
Mar 09 20:26:48 prod1 ntpd[22550]: Listen normally on 4 lo ::1 UDP 123
Mar 09 20:26:48 prod1 ntpd[22550]: Listen normally on 5 ens192 fe80::283:1e5a:38ea:b7f5 UDP 123
Mar 09 20:26:48 prod1 ntpd[22550]: Listening on routing socket on fd #22 for interface updates
Mar 09 20:26:48 prod1 ntpd[22550]: 0.0.0.0 c016 06 restart
Mar 09 20:26:48 prod1 ntpd[22550]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
Mar 09 20:26:48 prod1 ntpd[22550]: 0.0.0.0 c011 01 freq_not_set
Mar 10 17:56:32 prod1 ntpd[22550]: ntpd exiting on signal 15
Mar 10 17:56:32 prod1 systemd[1]: Stopping Network Time Service...
Mar 10 17:56:32 prod1 systemd[1]: Stopped Network Time Service.
Mar 10 17:57:11 prod1 systemd[1]: Starting Network Time Service...
Mar 10 17:57:11 prod1 ntpd[23030]: proto: precision = 0.041 usec
Mar 10 17:57:11 prod1 ntpd[23030]: 0.0.0.0 c01d 0d kern kernel time sync enabled
Mar 10 17:57:11 prod1 ntpd[23030]: line 18 column 23 syntax error, unexpected T_String, expecting T_EOC
Mar 10 17:57:11 prod1 ntpd[23030]: syntax error in /etc/ntp.conf line 18, column 23
Mar 10 17:57:11 prod1 ntpd[23030]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Mar 10 17:57:11 prod1 systemd[1]: Started Network Time Service.
Mar 10 17:57:11 prod1 ntpd[23030]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Mar 10 17:57:11 prod1 ntpd[23030]: Listen and drop on 1 v6wildcard :: UDP 123
Mar 10 17:57:11 prod1 ntpd[23030]: Listen normally on 2 lo 127.0.0.1 UDP 123
Mar 10 17:57:11 prod1 ntpd[23030]: Listen normally on 3 ens192 10.33.4.10 UDP 123
Mar 10 17:57:11 prod1 ntpd[23030]: Listen normally on 4 lo ::1 UDP 123
Mar 10 17:57:11 prod1 ntpd[23030]: Listen normally on 5 ens192 fe80::283:1e5a:38ea:b7f5 UDP 123
Mar 10 17:57:11 prod1 ntpd[23030]: Listening on routing socket on fd #22 for interface updates
Mar 10 17:57:11 prod1 ntpd[23030]: 0.0.0.0 c016 06 restart
Mar 10 17:57:11 prod1 ntpd[23030]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
Mar 10 17:57:11 prod1 ntpd[23030]: 0.0.0.0 c011 01 freq_not_set
=======================================================
@ TrevorH : Bro.. Yes 10.33.1.30 is my NTP server and want my CentOS to take it as time source.
1 - do i need to remove all "#" from centOS.pool ?
2 - my NTP server as of now taking time on its own ( Local time ) as of now, we are planning to make it NTP to take time from GPS ( not completed this activity as of now, within 2 or 3 days will do modification in NTP server )

As of now my NTP server is 2 minutes behind from GPS clock ( I mean internet timings as per my server geo location ).

Post Reply