HP OpenVMS Systems Documentation
Compaq TCP/IP Services for OpenVMS
The Network Time Protocol (NTP) synchronizes time and coordinates time distribution throughout a TCP/IP network. NTP provides accurate and dependable timekeeping for hosts on TCP/IP networks. TCP/IP Services NTP software is an implementation of the NTP Version 4 specification and maintains compatibility with NTP Versions 1, 2, and 3.
Time synchronization is important in client/server computing. For example, systems that share common databases require coordinated transaction processing and timestamping of instrumental data.
NTP provides synchronization that is traceable to clocks of high absolute accuracy and avoids synchronization to clocks that keep incorrect time.
This chapter reviews key concepts and describes:
Synchronized timekeeping means that hosts with accurate system timestamps send time quotes to each other. Hosts that run NTP can be either time servers or clients, although they are often both servers and clients.
NTP does not attempt to synchronize clocks to each other. Rather, each server attempts to synchronize to Coordinated Universal Time (UTC) using the best available source and the best available transmission paths to that source. NTP expects that the time being distributed from the root of the synchronization subnet will be derived from some external source of UTC (for example, a radio clock).
If your network is isolated and you cannot access other NTP servers on
the internet, you can designate one of your nodes as the reference
clock to which all other hosts will synchronize.
B.1.1 Time Distributed Through a Hierarchy of Servers
In the NTP environment, time is distributed through a hierarchy of NTP time servers. Each server adopts a stratum that indicates how far away it is operating from an external source of UTC. NTP times are an offset of UTC. Stratum 1 servers have access to an external time source, usually a radio clock. A stratum 2 server is one that is currently obtaining time from a stratum 1 server; a stratum 3 server gets its time from a stratum 2 server; and so on. To avoid long-lived synchronization loops, the number of strata is limited to 15.
Stratum 2 (and higher) hosts might be company or campus servers that obtain time from some number of primary servers and provide time to many local clients. In general:
Internet time servers are usually stratum 1 servers. Other hosts
connected to an internet time server have stratum numbers of 2 or
higher and may act as time servers for other hosts on the network.
Clients usually choose one of the lowest accessible stratum servers
from which to synchronize.
B.1.2 How Hosts Negotiate Synchronization
The identifying stratum number of each host is encoded within UDP datagrams. Peers communicate by exchanging these timestamped UDP datagrams. NTP uses these exchanges to construct a list of possible synchronization sources, then sorts them according to stratum and synchronization distance. Peers are accepted or rejected, leaving only the most accurate and precise sources.
NTP evaluates any new peer to determine whether it qualifies as a new (more suitable) synchronization source.
NTP accepts the peer under the following conditions:
The OpenVMS system clock is maintained as a software timer with a resolution of 100 nanoseconds, updated at 10-millisecond intervals. A clock update is triggered when a register, loaded with a predefined value, has decremented to zero. Upon reaching zero, an interrupt is triggered that reloads the register, thus repeating the process.
The smaller the value loaded into this register, the more quickly the
register reaches zero and triggers an update. Consequently, the clock
runs more quickly. A larger value means more time between updates;
therefore, the clock runs more slowly. A clock tick is
the amount of time between clock updates.
B.1.4 How NTP Makes Adjustments to System Time
Once NTP has selected a suitable synchronization source, NTP compares the source's time with that of the local clock. If NTP determines that the local clock is running ahead of or behind the synchronization source, NTP uses a general drift mechanism to slow down or speed up the clock as needed. NTP accomplishes this by issuing a series of new clock ticks. For example, if NTP detects that the local clock is drifting ahead by +0.1884338 second, it issues a series of new ticks to reduce the difference between the synchronization source and the local clock.
If the local system time is not reasonably correct, NTP does not set the local clock. For example, if the new time is more than 1000 seconds off in either direction, NTP does not set the clock. In this case, NTP logs the error and shuts down.
NTP maintains a record of the resets it makes along with informational
messages in the NTP log file, TCPIP$NTP_RUN.LOG. For details about
event logging and for help interpreting an NTP log file, see
B.1.5 Configuring the Local Host
The system manager of the local host, determines which network hosts to use for synchronization and populates an NTP configuration file with a list of the participating hosts.
NTP hosts can be configured in any of the following modes:
The NTP service can be shut down and started independently of TCP/IP Services. The following files are provided:
To preserve site-specific parameter settings and commands, create the following files. These files are not overwritten when you reinstall TCP/IP Services:
The NTP configuration file TCPIP$NTP.CONF contains a list of hosts your system will use for time synchronization. Before configuring your host, you must do the following:
To simplify configuration file maintenance, avoid configuring peer
associations with higher stratum servers.
B.3.1 Creating the Configuration File
To create a configuration file for your local host, edit a copy of the file TCPIP$NTP.TEMPLATE (located in SYS$SPECIFIC:[TCPIP$NTP]) to add the names of participating hosts, then save the file as SYS$SPECIFIC:[TCPIP$NTP]TCPIP$NTP.CONF. This file is not overwritten when you install subsequent versions of TCP/IP Services.
If a UCX version of NTP is configured on your system, your TCPIP$NTP.CONF file is created automatically and is populated with entries from the file UCX$NTP.CONF when you run the TCPIP$CONFIG procedure.
In the following configuration statements, the various modes are determined by the statement keyword and the type of the required IP address. Addresses are classsed by type as ( s ) a remote server or peer (IP class A, B, and C), ( b ) the broadcast address of a local interface, ( m ) a multicast address (IP class D), or ( r ) a reference clock address (127.127.x.x).
NTP configuration statements are formatted as follows:
|key ID||For all packets sent to the address, includes authentication fields encrypted using the specified key identifier, an unsigned 32-bit integer. The default is no encryption.|
|version number||Specifies the version number to be used for outgoing NTP packets. Versions 1, 2, 3, and 4 are the choices. The default is 4.|
|prefer||Marks the server as preferred. This host will be chosen for synchronization among a set of correctly operating hosts.|
|burst||When the server is reachable and at each poll interval, send a burst of eight packets instead of the usual one packet. The spacing between the first and the second packets is about 16 seconds to allow a modem call to complete, while the spacing between the remaining packets is about 2 seconds. This is designed to improve timekeeping quality with the server command and s addresses.|
|iburst||When the server is unreachable and at each poll interval, send a burst of eight packets instead of the usual one. As long as the server is unreachable, the spacing between packets is about 16 seconds to allow a modem call to complete. Once the server is reachable, the spacing between packets is about 2 seconds. This is designed to speed the initial synchronization acquisition with the server command and s addresses.|
|minpoll interval||Specifies the minimum polling interval for NTP messages, in seconds to the power of 2. The allowable range is 4 (16 seconds) to 14 (16384 seconds), inclusive. This option is not applicable to reference clocks. The default is 6 (64 seconds).|
|maxpoll interval||Specifies the maximum polling interval (in seconds), for NTP messages. The allowable range is 4 (16 seconds) to 14 (16384 seconds) inclusive. The default is 10 (1024 seconds). This option does not apply to reference clocks.|
|ttl nn||Specifies the time-to-live for multicast packets. Used only with broadcast and manycast modes.|