Operating System - HP-UX
1820291 Members
3520 Online
109622 Solutions
New Discussion юеВ

Re: What is the sync interval time in NTP

 
SOLVED
Go to solution
senthil_kumar_1
Super Advisor

What is the sync interval time in NTP

Hi All,

I would like to test NTP configuration in my test server.

So I have just now configured NTP client for time synchronization.

After that the time has been synced with NTP server.

Ex:

#date

Tue Mar 9 11:19:00 CST 2010


Then I would like to check the synchronization with NTP server.

So that I have changed the time using the command date.

Ex:

# date 030910382010

Tue Mar 9 10:38:11 CST 2010

I have changed the time to 30 mins later.

Then I have waited for about 3 hrs to see whether the time is syncing with NTP server.

Still it is not synced with NTP server.

Still the time remail 30 mins later than NTP server.

What is the sync interval time in NTP?

When can we see the NTP server time in local serer?
10 REPLIES 10
James R. Ferguson
Acclaimed Contributor

Re: What is the sync interval time in NTP

Hi:

> I have changed the time to 30 mins later.
Then I have waited for about 3 hrs to see whether the time is syncing with NTP server.
Still it is not synced with NTP server.

You will never synchronize. NTP abandons its efforts if the difference in time between your server and an NTP source is ~ 1000 seconds (~ 16+ minutes). This prevents insane time corrections.

Read this chapter:

http://docs.hp.com/en/B2355-91060/ch04.html

In particular, see the trouble-shooting section and the 'ntpq' utility.

Regards!

...JRF...

senthil_kumar_1
Super Advisor

Re: What is the sync interval time in NTP

Hi James,

Now the difference is 8 mins between local server and NTP server.

I have changed the time accordingly.

Now also I am waiting for 10 mins still the time is not synchronized with NTP server.

How to solve this.
James R. Ferguson
Acclaimed Contributor

Re: What is the sync interval time in NTP

Hi (again):

In general, about 5-6 poll cycles (at 64-seconds by default) occur before synchronization. You can verify that you have reached (associated) with a time source with 'ntpq -p'. An asterisk ("*") will precede the the IP or node name to which synchronization has occured. A "+" indicates that the source is a candidate.

Regards!

...JRF...

Steven E. Protter
Exalted Contributor
Solution

Re: What is the sync interval time in NTP

Shalom,

ntp does not do instant time correction. It can't.

If your system was running fast and ntp rolled the time back, a database program like Oracle would immediately crash.

I've done it, not pretty.

ntp makes adjustments over time. It runs the clock slightly slower if its running fast and slightly faster if its behind.

If the difference is under an hour, it can take a while for this process to complete.

ntpq is a good utility for seeing what is going on.

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
rick jones
Honored Contributor

Re: What is the sync interval time in NTP

And while the NTP client on the system may have synced to an NTP server, it will still, as pointed-out, take quite some time to have the difference in time shrink to small values. NTP is very, well, patient, in this regard. It uses some rather sophisitcated algorithms to get the local clock moving forward in time in sync with the clock to which it has synced.
there is no rest for the wicked yet the virtuous have no pillows
James R. Ferguson
Acclaimed Contributor

Re: What is the sync interval time in NTP

Hi (again):

The default for 'xntpd' (NTP) is to *step* the server time rather than slew it. It is therefore generally advisable to configure 'ntpdate' to run at boot-time; step the clock; and then let 'xntpd' make small, further step or slew adjustments as necessary.

To cause 'ntpdate' to run as startup and thus adjust any large time delta immediately and once, set the following variables in '/etc/rc.config.d/netdaemons':

# export NTPDATE_SERVER=mytimeserver.xyz.com
# export XNTPD=1

To cause 'xntpd' to slew, do:

# export XNTPD_ARGS=-x

See the 'xntpd' manpages for more information.

Regards!

...JRF...
rick jones
Honored Contributor

Re: What is the sync interval time in NTP

It will "step" for differences greater than a threshold. It will slew for differences less than that threshold. And as already mentioned, it will give-up entirely for differences greater than another threshold.
there is no rest for the wicked yet the virtuous have no pillows
senthil_kumar_1
Super Advisor

Re: What is the sync interval time in NTP

Hi All,

I have some questions:

1)Instead of configuring NTP, can I just run ntpdate ntp_server_name in crontab to update the time at 5 mins time interval?


2)What is the disadvantage of doing that?

3)I have configured NTP and ntpdate in startup also. the time is syncing with NTP server. Suddenly one day I have changed the time manually using the command date to be 1 hr later, then if I am restarting the server, the ntpdate will be ran at startup and fetch the time form NTP server, at this situation, will my oracle corrupt?
James R. Ferguson
Acclaimed Contributor

Re: What is the sync interval time in NTP

Hi:

> 1)Instead of configuring NTP, can I just run ntpdate ntp_server_name in crontab to update the time at 5 mins time interval?

Why? The 'xntpd' daemon is just that, a process that runs all the time, making very small corrections. It is spawned once and runs "forever",

> 2)What is the disadvantage of doing that?

Your time control may not be as accurate and you impose the overhead of process creation when you don't need to do so (see #1, above).

> 3)I have configured NTP and ntpdate in startup also. the time is syncing with NTP server. Suddenly one day I have changed the time manually using the command date to be 1 hr later, then if I am restarting the server, the ntpdate will be ran at startup and fetch the time form NTP server, at this situation, will my oracle corrupt?

Changing time forward isn't as harmful as changing it backwards! However, a good policy with databases and other time-sensitive applications is to stop them before a manual time adjustment. In a "good" configuration, at startup, a valid time is established before your database(s) are started.

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: What is the sync interval time in NTP

>> 1)Instead of configuring NTP, can I just run ntpdate ntp_server_name in crontab to update the time at 5 mins time interval?

Never do that! I see this all the time in Linux systems and it is a leftover from 30 years ago when the time was simply 'jammed' into the system. Accuracy to within 5 minutes was considered acceptable, but there wasn't any Oracle or Sybase stuff to worry about. It defeats the purpose of NTP and that is to provide EXACTLY 86,400 seconds per day. If you run applications such as databases, especially on multiple systems, they may become corrupt if you add or drop even one second.

NTP keeps the time accurate to less than 128 milliseconds. Running ntpdate 'jumps' the time forward or backward and your 24 hour day no longer will have the right number of seconds. cron jobs may not run or worse, they will run multiple times. ntpdate should only be used at bootup where it should already be setup in /etc/rc.config.d/netdaemons. ntpdate will be run long before any applications and databases have started.

>> 2)What is the disadvantage of doing that?

Lousy timekeeping, unexpected jumps in time, or worse, you do not use a reliable NTP server and someone messes with the time on the NTP server. Then all the machines that depend on the NTP server will be messed up.

>> 3)I have configured NTP and ntpdate in startup also. the time is syncing with NTP server.

That is as expected. Be sure to run ntpq -p to verify that your server is synchronized.

>> Suddenly one day I have changed the time manually using the command date to be 1 hr later, then if I am restarting the server, the ntpdate will be ran at startup and fetch the time form NTP server, at this situation, will my oracle corrupt?

Why did you change the time? NEVER change the time on an active server. If you changed it by 1 hour, I will guess that your login did not have $TZ set correctly. To verify the system time, always use date -u and compare that with a Zulu or UTC clock. HP-UX has the ability to run 86,400 separate timezones at the same time, all defined by the current value of $TZ -- which is set by /etc/TIMEZONE in /etc/profile. But anyone can change TZ to a new value (or worse, unset TZ and get the default timezone) and the date command will look incorrect.

Will Oracle be corrupt? Certainly there is a possibility for corruption if you (or any root user) changes the time. Tell all the root users to NEVER change the time while any applications are running.

> What is the sync interval time in NTP?

Once every 64 seconds, the time is evaluated. If the NTP server's time is too far away from the current time (ie, more than 1000 seconds, then the NTP time is ignored. If you were to run ntpdate, it would immediately 'jump' the time, thus causing problems with databases and applications.

After several hours, xntpd will calculate the dependability of the time servers, pick the best one based on reliable responses, and will double the poll time to 128 seconds. If the round trip time for the poll and the returned values continue to be stable, the time is again increased to a maximum of 1024 seconds (once every 17 minutes).

>> Then I would like to check the synchronization with NTP server.

Use ntpq -p

>> So that I have changed the time using the command date.
>> Ex:
>> # date 030910382010
>> Tue Mar 9 10:38:11 CST 2010
>> I have changed the time to 30 mins later.

Don't ever do this on a running system. Use ntpq -p and also look in syslog.log for the current status of xntpd.


Bill Hassell, sysadmin