1830132 Members
2304 Online
109999 Solutions
New Discussion

ntp question

 
Philip J. Priest_1
Frequent Advisor

ntp question

I have config a ntp to sync with an external stratum 1. Now the powers that by are asking me:

When does this sync occur? does it occur with any set schedule? twice a day etc?

As far as me reading, ntp does the sync by itself and not on any set schedule.

Is there a way in the /etc/ntp.conf to make it do a sync like twice a day?

thanks!
Phil
8 REPLIES 8
Tom Danzig
Honored Contributor

Re: ntp question

ntp uses a built in algorithm to determine how often to check. You can see how often it is currently polling with the "ntpq -p" command.

The time in seconds that each extenal server is being queried is listed undet the "poll" column.

If you only wanted to update the time twice a day (not recommended), you could run the ntpdate command twice a day via cron instead of the ntp daemon.

The ntp algorithms are quite complex (and very good) so I would just let ntp do its thing.
Steven E. Protter
Exalted Contributor

Re: ntp question

Most of these issues are explained on the following website:

http://www.ntp.org

Management may view this as a potential security risk. By experience, the communication is happening many times a day.

How often depends on your configuration of the ntp.conf file.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Fred Ruffet
Honored Contributor

Re: ntp question

Depending on how rapidly your server lose or add time, running ntpdate twice a day will produce some steps (not big ones, but steps), whereas letting ntp run all day long will produce a slice nobody will notice.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Philip J. Priest_1
Frequent Advisor

Re: ntp question

Ok tom, by my ntpq -p the ntp is polling every 512 secs.

Can you increase the time that it would poll?

like from 512 to every 8 hours?

thanks!
Phil
Tom Danzig
Honored Contributor

Re: ntp question

I don't think you can manually determine how often ntp queries. The may be config file entries you could make but why bother? There is very little server/network overhead in letting ntp do its thing but that's your decision (or your managers ;) to make.

If you only want updates every 8 hours, use ntpdate via a cron instead of the ntp daemon. You will, however, experience some time steps in doing this with the severity depending on how much your servers internal clock drifts. This may or may not be an issue with you (FYI, databases don't like big time steps!).
Sanjay_6
Honored Contributor

Re: ntp question

Hi Phil,

Maybe this will help you better understand the ntpq output,

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000076090198

The itrc doc id is KBRC00015657.

For the polling interval,

/Quote/

How often (in seconds) are we making a query to this server ? 512 seconds (approx 8 minutes) and 1024 seconds (approx 17 minutes) are very popular for network connections, but a machine with an external clock (like GPS) should poll it every 64 seconds or less.

This number can be specified with the minpoll and maxpoll directives, but it is better to let the daemon adjust it as needed. After stabilizing at startup this number will move automatically to 1024 for network servers and 64 (or sometimes 32) for external reference clocks.

/EndQuote/

Hope this helps.

Regds
Patrick Wallek
Honored Contributor

Re: ntp question

There really is no reason to mess with NTP's defaults. The way NTP works is that if the clock on your HP box stays in sync with the NTP server, then the polling time will slowly be increased, to a max. of 1024 seconds I believe.

Now you must keep in mind that these polls to the NTP server you have defined are very short and use almost no bandwidth. NTP is also pretty secure. There's not much of a threat to using external time sources.

8 hours is much too long to wait to poll. Just set NTP up and let it do its thing. You want to polling frequent enough to ensure that your clocks are always right on.

Bill Hassell
Honored Contributor

Re: ntp question

The NTP protocol is extremely complex in irder to reach 128ms accuracy. When you first start xntpd, the poll rate is once every 64secs and will continue sending a (very short) poll every 64secs until accuracy is within the 128ms window. The the polling jumps to 128, 256, 512 and then finally 1024 (once every 17 minutes) when the stability is high.

You don't want to change any of this. The reason is that NTP's goal is extfreme accuracy without ever 'jumping' the clock. When you jump the clock (move the time forward or backward even a few seconds), time-dependent code such as cron or databases will get confused. In fact, the date command (in the hand of root) is very dangerous to the health of your database.

The way that NTP syncs a system without jumping the clock is to adjust the hardware time tick so it is slightly faster or slower. That way, all 86,400 seconds in one day will actually occur. Any other method that simply changes the clock is archaic and risks a lot of problems with time-sensitive data.

The protocol is extremely efficient, sending just a few bytes for each poll. And inside a company, the best way ias to configure your firewall for NTP capability (almost all quality firewalls have this feature) and now you point all of your machines at the firewall for NTP sync. A typical firewall can handle thousands of computers syncing with NTP and still maintain the 128ms accuracy.


Bill Hassell, sysadmin