The Solaris NTP daemon is xntpd. It operates by listening for requests from NTP clients, and sends responses appropriately. The server processes a request, modifies the appropriate fields with the correct time and so forth, and then returns the modified request data as a response. The response allows the client to modify its clock settings appropriately. In addition, the server is able to provide data from a number of different authoritative sources.
The accuracy of a client’s time can be improved by selecting the most accurate server. Fortunately, there are measurements available to determine which clocks provide the most accurate data. Reliability and accuracy data is returned in the response data when a client makes a request to the server.
In a more complex network, where a time server must be highly available, it may be more appropriate to create a hierarchical system of NTP servers where dynamic reconfiguration is possible. This is only necessary where hardware or software failures can affect a single production system’s reliability. In this case, multiple servers can act as peers to each other. A primary time server in this setup obtains its time from a reference such as an external clock device, which it transmits to other secondary servers. Alternatively, there may be multiple primary time servers, and secondary servers must determine which course is most accurate. Clients then access secondary sources directly.
Of course, this creates a stratum of accuracy, with primary servers (1) being the most accurate, secondary servers (2) being the next most accurate, and clients (3) being the least accurate. Millisecond accuracy should be possible at least at level 2. However, errors can be estimated at lower levels and corrections made to improve the overall accuracy of the time estimation.
The timestamp lies at the core of the NTP data model. It is represented by a 64-bit unsigned floating-point number, and is the number of seconds that have elapsed since 01/01/1900 00:00. The first 32 bits represent the integer portion of the number, while the last 32 bits represent the fractional portion of the number.
The number of seconds in one nonleap year is 31536000. Given that only 64 bits are available to store time data in the NTP timestamp format, the maximum value will be reached in the year 2036. Given the number of legacy applications even now that use timestamping, a significant amount of planning will be required in around 30 years time to develop a new, high-capacity timestamp format that is backward compatible with existing formats.
A sample NTP server configuration file is located in /etc/inet/ntp.server. This file provides a pro forma template for configuring an NTP server that utilizes an external clock device, provides for local clock synchronization, and broadcasts times across the network. A sample file is shown here:
server 127.127.XType.0 prefer fudge 127.127.XType.0 stratum 0 broadcast 224.0.1.1 ttl 4 enable auth monitor driftfile /var/ntp/ntp.drift statsdir /var/ntp/ntpstats/ filegen peerstats file peerstats type day enable filegen loopstats file loopstats type day enable filegen clockstats file clockstats type day enable keys /etc/inet/ntp.keys trustedkey 0 requestkey 0 controlkey 0
The server entry indicates the primary server that this system prefers. The broadcast entry directs the server to broadcast messages to clients. The driftfile relates to a local clock’s accuracy and its frequency offset.
EXAM TIP |
You should be able to interpret a NTP server configuration file. |
In both cases where “XType” appears, a legal value for a clock device must be inserted. The clock device could be one of the devices shown in Table 39-1.
XType |
Device |
RefID |
Description |
---|---|---|---|
1 |
local |
LCL |
Undisciplined local clock |
2 |
trak |
GPS |
TRAK 8820 GPS receiver |
3 |
pst |
WWV |
PSTI/Traconex WWV/WWVH receiver |
4 |
wwvb |
WWVB |
Spectracom WWVB receiver |
5 |
true |
TRUE |
TrueTime GPS/GOES receivers |
6 |
irig |
IRIG |
IRIG audio decoder |
7 |
chu |
CHU |
Scratchbuilt CHU receiver |
8 |
parse |
---- |
Generic reference clock driver |
9 |
mx4200 |
GPS |
Magnavox MX4200 GPS receiver |
10 |
as2201 |
GPS |
Austron 2201A GPS receiver |
11 |
arbiter |
GPS |
Arbiter 1088A/B GPS receiver |
12 |
tpro |
IRIG |
KSI/Odetics TPRO/S IRIG interface |
13 |
leitch |
ATOM |
Leitch CSD 5300 master clock controller |
15 |
* |
* |
TrueTime GPS/TM-TMD receiver |
17 |
datum |
DATM |
Datum precision time system |
18 |
acts |
ACTS |
NIST automated computer time service |
19 |
heath |
WWV |
Heath WWV/WWVH Receiver |
20 |
nmea |
GPS |
Generic NMEA GPS receiver |
22 |
atom |
PPS |
PPS clock discipline |
23 |
Ptb |
TPTB |
PTB automated computer time service |
24 |
Usno |
USNO |
USNO modem time service |
25 |
* |
* |
TrueTime generic receivers |
26 |
Hpgps |
GPS |
Hewlett Packard 58503A GPS receiver |
27 |
Arc |
MSFa |
Arcron MSF receiver |
Once the settings for the NTP server have been modified, they should be saved in the file /etc/inet/ntp.conf. When started in debug mode, the NTP server produces the following output:
/usr/lib/inet/xntpd -d tick = 10000, tickadj = 5, hz = 100 kernel vars: tickadj = 5, tick = 10000 adj_precision = 1, tvu_maxslew = 495, tsf_maxslew = 0.002070b9 create_sockets(123) bind() fd 19, family 2, port 123, addr 00000000, flags=1 bind() fd 20, family 2, port 123, addr 7f000001, flags=0 bind() fd 21, family 2, port 123, addr 0a401203, flags=1 init_io: maxactivefd 21 getconfig: Couldn't open </etc/inet/ntp.conf> report_event: system event 'event_restart' (0x01) status 'sync_alarm, sync_unspe c, 1 event, event_unspec' (0xc010)
In this output, an error message is generated because the file /etc/inet/ntp.conf could not be found—it’s a common mistake not to copy across the template /etc/inet/ntp.server file to /etc/inet/ntp.conf! To observe the set of internal variables used by xntpd during its operation, the ntpq command can be used.