1

I have a FreeIPA server running on Centos 6 and one of its functions is to provide time sync to client hosts. NTP is version 4.2.6

The problem is that its own NTP synchronisation is nor working properly & I can't see why. This is then affecting the Kerberos/authentication functions.

The FreeIPA server cannot directly get to the internet so it needs to use another server that can see the internet.

Here is an nptq listing from the "master" time server whose IP address is 10.20.1.23.

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*46.101.52.119   81.174.136.35    2 u  111  128  377   10.234    0.865   3.491
+51.141.4.8      85.199.214.102   2 u  121  128  377   14.806   -0.365   2.858
+178.62.16.103   195.66.241.3     2 u  117  128  377   10.677    0.816   1.931
+129.250.35.250  249.224.99.213   2 u  100  128  377   14.064   -1.678   1.525

All pretty standard stuff. 46.101.52.119 is being used as reference

Here is the output from another client using that server for time sync

# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.20.1.23       46.101.52.119    3 u  230  256  377    0.439  1095.65  34.637
 127.127.1.0     .LOCL.           5 l  49m   64    0    0.000    0.000   0.000

This is fine telling me 10.20.1.23 is using 46.101.52.119 as its ref

But when I go to me FreeIPA server I get

# ntpq -pn
    remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.20.1.23       LOCAL(0)         6 u   97  128  377   32.193  92334.0  17.646

The refid is different and it tells me we have about a minute & a half offset. In fact I set the clocks within a second by hand but now it's being pulled off by ntpd.

Terry
  • 11
  • 1
  • Can you post the output of `ntpq -c associations` ? – Thomas N Feb 20 '17 at 22:53
  • Things have changed and the sys_peer is now correct. The problem is that it fails back and the problem returns. When it does that the peer gets marked as falsetick and I have to restart ntpd to clear it. ntpq -c associations ind assid status conf reach auth condition last_event cnt =========================================================== 1 64586 963a yes yes none sys.peer sys_peer 3 – Terry Feb 21 '17 at 10:47
  • Can you check the output of `ntpq -c rv 963a` ? This is the assID (no, really, I can't make this stuff up...) of your peer associate and should give you a better idea of why you're seeing so much time source jitter in respect to your local clock. – Thomas N Feb 21 '17 at 16:40
  • I'm pretty sure the jitter is caused when the refid changes from what it should be, a pool NTP server, and refid=LOCAL(0). The the offset changes by about 125291ms, at the moment. If I can convince that the refid is the correct one it all falls into place – Terry Feb 21 '17 at 16:57
  • Curently I have srcadr=10.20.1.23, srcport=123, dstadr=10.0.4.121 10.0.4.121 is the address of my freeipa server which is supposed to be the client On all other clients it is correct. It's just my freeipa server has got it into its head that the time server is refering back to the freeipa server – Terry Feb 21 '17 at 17:02
  • Is it possible that you have a configuration management service that is changing the ntp.conf on the FreeIPA server? – Thomas N Feb 21 '17 at 17:13
  • I'm pretty sure that is not the case. The ntp.conf file looks fairly standard – Terry Feb 22 '17 at 14:49

1 Answers1

1

Also see: Why is NTP syncing to LOCAL rather than remote server?

What seems to be going on is that your local clock is running way too fast in relation to the time source that it's trying to sync against. As a result it trashes the synchronization source and goes with what it thinks is the best answer, which is it's own local kernel timesource. There are a couple of things you can do to help alleviate this condition and try getting your local clock into better shape.

First, to alleviate the issue, you can set the local clock to a higher stratum than your synchronization sources. An example in your ntp.conf file would be:

server 127.0.0.1
fudge 127.0.0.1 stratum 16   ## or some value greater than it's synchronization peer

This will make it a less-desirable source when NTP starts selection of peers for synchronization.

Next, if your local clock is really out of whack, you can adjust it using adjtimex. BE CAREFUL, you are playing with the hardware clock at this point. An example would look something like:

# adjtimex -p         ## List out how the clock is currently running...
     mode: 0
   offset: 0
frequency: 0
 maxerror: 0
 esterror: 0
   status: 64
time_constant: 4
precision: 1
tolerance: 32768000
     tick: 9900
 raw time:  1272299204s 17444us = 1272299204.017444
return value = 5

And adjust the value of the 'tick' field:

adjtimex -t 9800

Restart ntpd and see how it behaves. If it makes the jitter more acceptable, then leave it at that, or adjust it again, if necessary. NTP can be somewhat obscure and I hope I've helped things, but if you need more information, I'd trust the source at http://support.ntp.org

References

http://support.ntp.org/bin/view/Support/TroubleshootingNTP

http://log.or.cz/?p=80

Thomas N
  • 435
  • 2
  • 9
  • I have eased the problem by adding a local clock. I played with the kernel tick and it was very inconclusive. What is nuts is that using ntpq -pn the freeipa server thinks that its time source is locked to the freeipa server. There used to be a circular reference but I took that out. Something seems to be remembering it despite restarting ntpd on both servers. No other ntp client shows the same problem On the freeipa server ntpq -pn gives me remote refid offset 10.20.1.23 10.20.4.179 84321.6 10.20.4.179 is the address of the freeipa server – Terry Feb 22 '17 at 15:12
  • Probably the best thing to do would be to get more peers defined for the FreeIPA server to select from. Are there any other systems in the network that can fill this role? Preferably ones with an internet connection to a higher stratum peer? – Thomas N Feb 23 '17 at 15:44
  • Unfortunately that is not an option. I have given it a local clock as an option and now it runs more stably. When the peer appears to jump to the wrong time this server uses its own clock until the proper peer seems ok. During this time the peer is working properly, it's just that this server sees it as wrong.. – Terry Mar 01 '17 at 14:44