|
|
Installing and Administering Internet Services: HP 9000 Networking > Chapter 7 Configuring the Network
Time Protocol (NTP)Getting Started with NTP |
|
The Network Time Protocol (NTP) is a family of programs used to adjust the system clock on your computer and keep it synchronized with external sources of time. All clocks drift including clocks inside your computers. Computers are very sensitive to time deviations caused by this drifting. NTP provides accuracy from the microsecond to millisecond range. Some of the pervasive computing processes that may be affected by disparity in time include, debugging, database and transaction processing, and compiling software using the make utility. Debugging system problems becomes difficult if the timestamp in the system logs are not true. Databases rely heavily on time. Databases and transaction processing application may get confused if clients and servers have differences in "correct" time. Many people use the make utility to manage the compilation of software. This utility looks at file timestamps, with one-second granularity, to decide which .0 files need to be rebuilt when the underlying source file has been changed. The problem is compounded when files on machines at various sites in different time zones need to be compiled and built into the "new" version of the source files. Also, if some of the directories are NFS mounted and the server and client have different notions of the current time, then make can fail to rebuild some derived objects and produce an executable that is not based on the most up-to-date sources. Even the one-second granularity of file stamps means that your client and server must be synchronized closer to 1000 milliseconds in order to guarantee that make will compile the correct files. You will need the following equipment to effectively use the NTP programs:
For your basic NTP configuration, you will need to do the following
The following sections cover these steps in detail. The time of day is officially defined, regulated, and distributed by government organizations. These organizations coordinate with one another and keep their clocks within nanoseconds of each other at all times. The first step in using NTP is selecting the best source of time for your organization. When selecting a source of time, you must be careful to choose the source of time that will be best for you. Examine them carefully and do not base your selection on price alone. If the kinds of applications and processes your network users run are sensitive to time, it is best to select the source of time that will provide stability and will not be affected by network delays or outages. Also, select a source of time that you can reach. The closer the source of time, the better. Choose a source that is physically close and one that takes very few network hops to reach. For more information on physical and network distance, seeXXXX "Configuring Mulltiple Time Servers" on page 221. The most common time distribution mechanisms used from which you can draw time are:
You can connect to public time servers via the internet free of charge, for a limited time. Public time servers also provide dial-up access through a modem. This is the cheapest and most popular method. One of the main problems with this option is that many people are protected behind firewalls and cannot use the public time servers. There are several public time servers that you can access. HP provides a public time server. It is located in Cupertino, California. This one is best to use if you are located in North America. Below are the details for this time server:
If you are behind a firewall, not connected to the internet, and cannot justify the expense of a radio receiver, you can still have a time server. You can declare your NTP machine as a time server. This machine can serve time within a closed domain. This is the least recommended option. Because the server is isolated, it has no way to synchronize to the real time. Beware, using this option will cause problems if you ever connect outside of your domain. To set up the local clock impersonator, add the following line to the /etc/ntp.conf file: server 127.127.1.1 minpoll 3 maxpoll 4 The radio receiver is the most accurate. When you use it, you have no worries about network delays, congestion, or outages. It is, however, the most expensive time distribution mechanism. Some of the popular radio receiver method are: GPS (Global Positioning System), WWV (terrestrial North America), and DCF77 (terrestrial Europe). If you select the radio receiver, remember that you must consider the cabling options. Antenna cables can be very expensive and RS232 cabling has a limited range. The official HP supported GPS receivers are HP58503 driver#26 and Trimble Palisade driver#29. The only supported WWVB receiver is Spectracom Netclock/2 driver#4. DCF77 (AM and FM) signals radiate from Frankfurt Germany. None of the DCF77 receivers are officially supported by HP.
When selecting a time server, it is best to select one that is physically nearby. Selecting a time source that is too far away can result in poor network connections and delays. Also consider the network paths that packets will need to travel. If a time server is physically nearby, but it takes an excessive number of network hops to reach it, you will also experience network delays. If applications on your network need to be accurate down to the millisecond, you must pay attention to the dispersion measurements and the network service quality. Dispersion is a measurement of the time server quality and network quality.
The best time server for you is the time server that returns a response from a PING the fastest. Figure 7-1 shows the best pimary server is the server located in California, if you are in California. The PING response time is only 5ms. The time server in New York returns a response slower, but still is not bad. You would not want to use the time server in Australia. The PING response time is 500ms. This will cause lots of delays for your network users. In Table 7-1 “Available Time Servers”, you can see that there are a number of servers the time client can access. The primary time server is NAVOBS1.MIT.EDU. The other time servers within reasonable physical and network distance are cs.columbia.edu, 129.236.2.199, and c.epsydra.dec.c . Table 7-1 Available Time Servers
Choose three (or more) that are nearby geographically. If you are in London, it would not be wise to choose time servers in Australia or Brazil. Long distances over water usually mean a poor network connection in terms of delay and path symmetry. Router hops also delay the packets in unpredictable ways. You will need to evaluate these potential time servers (and the network paths) to decide if they are close enough (ping time, delay and variation) and well configured before you use them. Some time servers may also require notification before you use them, so pay attention to the ettiquitte of the listings at UDelaware. Do not point more than three of your machines at any one public time server. Use that small group of your machines (at stratum-2 or stratum-3) as the main time servers for the rest of your organization. For more information about stratum levels, see the section “Stratum Levels and Time Server Hierarchy”. The public stratum-2 servers can provide good timeservice for almost anybody. Also, their access policies are less restrictive than the stratum-1 servers. The quality of the network service between your machine and the public time server (or your ISP) dominates the errors you will see. This makes the distinction between stratum-1 and stratum-2 almost meaningless for most purposes. Dispersion is a measurement of time server quality plus network quality. In reality, the network quality swamps everything else. If your network is slow or overloaded, then dispersion will be high no matter how good the time servers themselves are. NTP may be your first experience with an application that is actually sensitive to network service quality. Other applications (FTP, DNS, NFS, sendmail) can tolerate huge delays in packet delivery because their data is not time-critical. But NTP is different. Delays are deadly for your time service. Delays immediately show up in the dispersion figures. If you care about milliseconds, you must vigorously pursue your dispersion measurements and pay attention to network service quality. If you care about microseconds, you must abandon the network time servers and purchase a radio clock for each NTP client. You can evaluate different public time servers from the stratum-2 list. First is a machine that HP is providing in Silicon Valley for public use in North America. This machine was recently upgraded from stratum-2 to stratum-1 with a new GPS receiver, but the lists at UDelaware might not have been updated yet.
If you are located in Silicon Valley, you can ping this time server and see that it is about 5 milliseconds away:
You can query the time server using ntpq -p to find out what synchronization sources it is using:
Table 7-2 Locating Synchronized Time Servers
This time server is synchronized (asterisk in column one) to REFCLK(29,1), which is a Trimble Palisade GPS receiver. The offset from GPS is currently 0.004 milliseconds and the dispersion is 0.02 milliseconds (both excellent values, smaller is better here). This time server also has several good stratum-1 and stratum-2 servers which it can fall back on if the GPS receiver stops working for any reason. Notice the line for hpsdlo.sdd.hp.com which has delay, offset, and dispersion measures that are markedly worse than any of the other sources. The time server hpsdlo is good enough, but the network in between has some problems, mainly evidenced by the large dispersion figure. There is nothing that NTP can do to reduce the dispersion. NTP is simply reporting to you what it sees out on the network. You must complain to your network service provider if the dispersion numbers are too high. In summary, ntp-cup.external.hp.com is a well-configured time server that is only 5 milliseconds away from my location (in California) on the network. It would be a good choice for a public time server for my location. Whether it is good for you depends on the "ping" round-trip times at your location. Look at the time server located on the east coast of North America. Here are the details:
These ping round-trip times are significantly greater than the west coast example; the target is 5000 kilometers (3000 miles) further away. Nonetheless, 85 milliseconds is not too bad for general NTP purposes. You will generally see dispersion measurements somewhat less than the ping round-trip times. The NTP daemon has an interesting watershed at 128 milliseconds, but this example server at 85 milliseconds is comfortably below that. You can use the server at columbia.
Table 7-3 Evaluating Time Servers in Eastern United States
This time server at Columbia University has a variety of stratum-1, stratum-2, and stratum-3 sources, which is good. It also has three sources which are not responding right now (reach=0), and one with very large delay, offset, and dispersion (tick.CS.UNLV.EDU). As before, this is due to networking problems between client and server (New York to Las Vegas, over 3000 km), not some fault with the NTP implementation at either end. This time server at Columbia is currently synchronized to NAVOBS1.MIT.EDU, but three others (marked with "+" in column one) are attractive and could step in immediately if NAVOBS1 failed for any reason. Look at a time server in Australia. Here are the details:
Assume you are located in western United States and you ping this time server. The ping round-trip times are much larger; around 500 milliseconds. Do not use a time server at this distance unless you are really desperate and understand what 500 milliseconds step changes mean to your users and applications. However, depending on your location, ping round trip times from this server may be acceptable levels. The round-trip times from your own location might be much smaller. Also note that the variation in round-trip times is small. /usr/sbin/ntpq -p ntp.adelaide.edu.au Table 7-4 Evaluating Time Sources in Australia
This time server in Australia has one excellent stratum-1 source (tictoc.tip.CSIR) which it is currently synchronized to, one stratum-1 source which hasn't responded in a while (reach=0), and a wide selection of stratum-2 sources (attractive candidates marked with "+"). Some of the stratum-2 sources are less attractive due to high delay, offset, and dispersion numbers. They are marked "falseticker" ("x" in column one). This time server in Australia might be a good choice for you if you are reasonably nearby, but it is probably not a good choice for time clients in North America. When the time server in Silicon Valley is configured to use "sirius.ctr.columbia.edu" and "gpo.adelaide.edu" as time sources, the output from "ntpq -p" looks like this (about 10 minutes after daemon startup): Table 7-5 Output from ntpq for Configuring Silicon Valley Time Server
The time server in Australia has a delay of 470 milliseconds, which is very similar to the "ping" round-trip times seen earlier. This leads to an offset value of 54 milliseconds, which is significantly worse than any of the other time sources. It is interesting to note that the offest is much less than the delay, which means that the round-trip is almost symmetric. NTP must assume the outbound and inbound travel times are equal, and the offset value gives an idea how unequal they might be. This is considerably better than 470/2 which would be the offset if NTP did not make this assumption. Also interesting is the very low dispersion value, which means that the round-trip time does not vary a lot as more packets are exchanged. Less than 1 millisecond is an excellent dispersion value for a trip of 15,000 kilometers. The time server in Australia is working out better than we had any right to expect at this distance, but it is still noticeably poorer than the other choices that are in North America. The time server at Columbia is better than the time server in Australia, due to the closer distance, but still noticeably worse than all of the other time sources. You must choose a minimum of one time server, and it is a good idea to choose three or more for redundancy. Then put lines like this at the end of your /etc/ntp.conf file: server ntp-cup.external.hp.com After you have found a well-configured time server that is an acceptable distance away, you must select two additional servers. These servers will serve as back up time servers. The closest and fastest one will be your primary time server. The others will do the job if the primary server becomes unavailable. The process of establishing back-up servers is know as employing redundancy. It is a safeguard for your network users. It ensures that their time sensitive applications will always be able to run because there will always be a reliable source of time to synchronize to.
|
|