How to disable time changing?

Problems setting up the ntp.conf

How to disable time changing?

Postby jignatiu on 02.12.2009 16:45

I would like to prevent ntp changing the time on my PC if the time from the NTP server is out by more than 2s. Reason being any change by 2s or more will cause problems to my mission critical system. Is there any way of doing this?

If the difference in time is within 2s then I want ntp to slowly adjust the time, as normal.
jignatiu
 
Posts: 7
Joined: 02.12.2009 16:26

Re: How to disable time changing?

Postby Gregoire Diehl on 03.12.2009 08:08

Hi,

this is not possible the way you want .
How would you detect that your are 2 seconds off, if your only time reference is reporting this? You have no chance.

You must configure multiple references (at least 3 time server) on client side. If one of your time servers is reporting a wrong time it will be detected and easily discarded by the NTP service.

Adjustment between 128ms and 1024 seconds will be set hard (time reset). Offsets below 128ms will be slewed. Normally NTP will only do a time reset on startup and afterwards only slew the time during operation. NTP will be closed when the offset is larger then 1024 seconds.

I hope this answers are from assistance.
Gregoire Diehl
Site Admin
 
Posts: 282
Joined: 21.09.2005 13:15

Re: How to disable time changing?

Postby jignatiu on 03.12.2009 09:44

When I say 'out by 2s' I mean there is a difference of 2s or more between the NTP server and my PC. I don't mean the time on the NTP server is wrong. I mean, somehow, there's been a drift on my PC. I know this is highly unlikely to happen, with NTP running on my PC, but I have to make sure that there is no jump in time on my PC.

Can I change the offset to 2s instead of 1024s?
jignatiu
 
Posts: 7
Joined: 02.12.2009 16:26

Re: How to disable time changing?

Postby jignatiu on 04.12.2009 10:07

I think I need to add this in my config file:

tinker panic 2

Can you confirm?
jignatiu
 
Posts: 7
Joined: 02.12.2009 16:26

Re: How to disable time changing?

Postby Gregoire Diehl on 04.12.2009 11:39

Can I change the offset to 2s instead of 1024s?


No this is not changeable and in fact make absolutely no sense.

If it can happen that your time is off by 2 seconds suddenly then you should check whats the reason for this behaviour and try to fix it.
Shutdown NTP is not the best solution, because your system is left without any synchronization and how will you compensate this 2 seconds without a time step.

Normally there should be no time steps when NTP is running, only one step during startup if NTP detects that the client is off by more than 128ms. If there are additional steps during operating then there is something wrong on this system and you should try to find out what it is.
Gregoire Diehl
Site Admin
 
Posts: 282
Joined: 21.09.2005 13:15

Re: How to disable time changing?

Postby jignatiu on 08.12.2009 09:08

I understand what you're saying but in my system there is a possibility that the time on the reference server could be changed. It's not likely but it could happen, and I have a requirement to cover that case. If the change in time is more than 2s then I don't want NTP to change the time on my PC.

I believe in this instance this line will do what I want:

tinker panic 2

Does the NTP daemon continue run? And if say, the time on the reference server is corrected to within 2s of the time on my PC will NTP work as normal, slowly synchronising the time on my PC to the time on the reference server?
jignatiu
 
Posts: 7
Joined: 02.12.2009 16:26

Re: How to disable time changing?

Postby jignatiu on 08.12.2009 10:04

I forgot to add that the time on the reference server could be set by mistake. It's not likely to happen but nevertheless it could. I don't want the PC having the same time as the server in this case if the time is out more than 2s.
jignatiu
 
Posts: 7
Joined: 02.12.2009 16:26

Re: How to disable time changing?

Postby Gregoire Diehl on 09.12.2009 10:07

For this reason you have to configure multiple (three or more) time servers as reference source on your NTP client.
If one of these time server is delivering a wrong time NTP can easily detect which one is off by a simple majority decision and discard the so called "falseticker".
If you just use one time reference you have no choice which time it is. Your client will follow the server.
If you have only two time server configured you can't detect a falseticker as your client can't say which one is delivering a wrong time. So you will need at least three time sources to be secured against one falseticker.

Please see http://support.ntp.org/bin/view/Support/SelectingOffsiteNTPServers#Section_5.3.3. for more information.
Gregoire Diehl
Site Admin
 
Posts: 282
Joined: 21.09.2005 13:15

Re: How to disable time changing?

Postby jignatiu on 09.12.2009 15:17

I only have two time servers - an accurate time server and the local clock. The external time source is my preferred server. If the time on that was to change by more than 2s, would the time on my PC stay unchanged? Then if I was to adjust the PC clock to be within 1s of the time server, would NTP then adjust the time on my PC to be same as the time on the time server?
jignatiu
 
Posts: 7
Joined: 02.12.2009 16:26

Re: How to disable time changing?

Postby Gregoire Diehl on 09.12.2009 16:03

If you can't configure multiple time servers then you have a problem.

Of course you can use the command:

tinker panic 2

in order to stop the NTP service if an offset of more then 2 seconds between client and server is detected. But please consider that it might also happen that your client jumps or loose some timer ticks, due to e.g. heavy database activities or hard disc access. In this case the NTP will shutdown as well.
Gregoire Diehl
Site Admin
 
Posts: 282
Joined: 21.09.2005 13:15

Re: How to disable time changing?

Postby jignatiu on 16.12.2009 10:14

OK. It is possible that after ntp shuts down (because of the >2s time difference), the PC is rebooted. In this case I do not want the PC to re-sync with the time server. If I remove 'iburst' in the server line will that suffice?
jignatiu
 
Posts: 7
Joined: 02.12.2009 16:26

Re: How to disable time changing?

Postby Gregoire Diehl on 21.12.2009 10:54

It is possible that after ntp shuts down (because of the >2s time difference), the PC is rebooted. In this case I do not want the PC to re-sync with the time server. If I remove 'iburst' in the server line will that suffice?


The tinker panic will also shutdown the NTP service after startup if the initial offset exceeds the tinker panic value.
The iburst keyword is just for a faster synchronisation by sending multiple requests in a short interval to the NTP server after startup.
Gregoire Diehl
Site Admin
 
Posts: 282
Joined: 21.09.2005 13:15


Return to Configuration problems

Who is online

Users browsing this forum: No registered users and 1 guest