Operating System - HP-UX
1824976 Members
3732 Online
109678 Solutions
New Discussion юеВ

NTP stratum? offset? dispersion? list of servers?

 
SOLVED
Go to solution
Steve Post
Trusted Contributor

NTP stratum? offset? dispersion? list of servers?

I just went through the admin guide on hp internet servers (B2355-90774) and looked up NTP. It talks about stratum-1,2,3. It mentions offset, dispersion. It talks at length about choosing the the proper time server with a low ping response. It says to make sure you properly request access to the time server before using it.

It does NOT say:
what stratum is.
what dispersion is.
what offset is.
HOW to get a list of time servers.
HOW to get permission to use a time server.


I'm having a hard time setting up NTP with these holes in my information.

steve
4 REPLIES 4
Pete Randall
Outstanding Contributor
Solution

Re: NTP stratum? offset? dispersion? list of servers?

Stratum is just the different levels of NTP servers. Stratum 2 servers sync to Stratum 1, and 3 to 2. Us common folk are supposed to sync to stratum 3.

Dispersion means picking servers to sync to that are physically located across a wide area.

Offset is the amount of time correction required.

List of time servers:

http://support.ntp.org/bin/view/Servers/WebHome

Generally the listing will also tell you who/how to contact in order to get permission.


Pete

Pete
A. Clay Stephenson
Acclaimed Contributor

Re: NTP stratum? offset? dispersion? list of servers?

You have a very good document on your HP-UX box that explains almost all of these points very well, /usr/share/doc/NTP_Primer.txt. It also explains why you need multiple time servers and why stratum generally does not need to be specified. (Stratum 1 servers are the highest quality.)

A typical /etc/ntp.conf file needs no more than this:

driftfile /etc/ntp.drift
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org
server 3.us.pool.ntp.org
server 127.1.1 stratum 10 # local fallback


The serverN.us.pool.org timeservers are a pool of public timeservers and you need no permission to use them. The hostnames correspond to a pool of round-robin IP addresses so that each time you start an NTP daemon, you will likeky get a new set of servers.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: NTP stratum? offset? dispersion? list of servers?

Ooops,

server 127.1.1 stratum 10 # local fallback

should be:

server 127.127.1.1 stratum 10 # local fallback

If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: NTP stratum? offset? dispersion? list of servers?

NTP (internally) is a very complex tool that is able to maintain very accurate time without affecting the number of seconds per day. Setup is trivial but not documented clearly at all.

Bookmark this location: www.ntp.org and look at the link called the NTP Pool project. The pool project eliminates the permission problems of the past.

Now check that you can reach an Internet NTP server:

ntpq -p pool.ntp.org

If your system is not blocked by a firewall, you'll get a response from several open servers. This step is always the most difficult. If you get a response, all is well and you can proceed. If not, your system is blocked from using port 123 (the NTP port) out to the Internet. Start with your network administrator. They can open this port for you, or as a better alternative, setup the firewall to act as an NTP server, The NetAdmin would point the firewall to pool.ntp.rg (or better yet, the closest International server such as us.pool.ntp.org or europe.pool.ntp.com). Then you would run the ntpq -p test poiting to the IP address of your local firewall. When that works (it will report some of the stats you mentioned above), you can proceed.

Replace the (very lengthy) /etc/ntp.conf file with the following:

server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
fudge 127.127.1.1 stratum 10
driftfile /etc/ntp.drift

That's it. All the other options are for researchers and people with more time on their hands...

Now to start NTP, first make sure the time is close to actual time. NTP can't adjust more than a 10 minute difference. Also (and this is really important) make sure your $TZ value is correct for your local timezone. To verify this, type the command date -u and then compare the result with one of the many GMT or UTC websites:

http://www.worldtimeserver.com/current_time_in_UTC.aspx

HP-UX only keeps one time: UTC (aka, Zulu or the deprecated but commonly used GMT). This is the internal clock and must not be changed for things like Daylight Saving...if someone has changed the internal clock so it is off by an hour, etc, you'll need to schedule a reboot after shutting down ALL applications and user logins. To set the clock correctly, get the UTC time and then use date -u mmddhhmm to set the time. Then edit the default timezone in the file /etc/TIMEZONE. If you have not patched your tztab file, download the latest version:

PHCO_37053 (11.11)
PHCO_37054 (11.23)
PHCO_37055 (11.31)

Timezone and Daylight Saving changes are all handled in the tztab file, never by using the date command.

Once your internal clock is within a few minutes of GMT time (verified by date -u), then you can start xntpd (as root). It is a daemon and will immediately disconnect from your terminal session and run in the background. Now tail syslog to see what it reports:

tail /var/adm/syslog/syslog.log

Look for any problems or error messages. Then check that ntpq is working:

ntpq -p

By specifying -p with no destination, ntpq will evaluate your local machine. All you are really interested in is that you see numbers in the columns. The reach column will start at 0 and progress up to a maximum of 377 indicating a good connection (after an hour or two). The delay, offset and dispersion numbers indicate the stability relative to your local system and network connection. The poll column indicates how often (in seconds) that a time check is performed. The minimum will be 64 (once every 64 seconds). After a few hours the poll will back off to 128, then 256, etc all the way to 1024 (17 minutes) for a reliable connection. The increase in the poll interval takes place when time is within 128ms of the NTP time servers . NTP is very accurate.

Within a few hours, your time will be accurate and you can essentially forget about it. You might occasionally run ntpq -p to see how things a re going.

One last step: edit the startup parameters for reboot. vi the file /etc/rc.config.d/netdaemons and change two lines:

export NTPDATE_SERVER="us.pool.ntp.org"
export XNTPD=1

And now your server will be synchronized at bootup and maintain time to within 128ms.


Bill Hassell, sysadmin