How NTP Works
You can use the ntpd daemon on Linux to synchronize time with another NTP time provider. In
fact, a system running ntpd can function as both a time consumer and a time provider
at the same time. The NTP protocol operates over IP port 123. The time consumer sends a time
synchronization request to the time provider on port 123. The time provider sends its time to the
consumer, and the system time on the consumer is adjusted according to the NTP algorithm.
Because NTP is designed to synchronize time across global networks, it
assumes all systems involved are configured to use UTP time.
Here are several key NTP concepts you need to be familiar with:
• Stratum
NTP uses the concept of stratum to define a hierarchy of NTP servers:
• Stratum 1
Stratum 1 time servers get their time from a reference time source, such
as the Naval atomic clock. (See tycho.usno.navy.mil for more information.)
• Stratum 2
Time servers that get their time from stratum 1 servers.
• Stratum 3
Time servers that get their time from stratum 2 servers.
• Stratum n
NTP servers can continue to a depth of 256 strata.
Although they are available on the Internet, you probably won’t be allowed access to a
Stratum 1 server. However, many Stratum 2 servers are publicly available. To reduce the
load on these public time sources, you should configure a very limited number of systems
on your internal network to sync time with the public time provider. In fact, many
organizations configure only a single Stratum 3 server on their network that gets its time
from a public Stratum 2 server on the Internet. They then configure all their internal
hosts to get their time from that server. On a larger network, you may need to configure
several Stratum 4 servers and configure them to get time from your Stratum 3 server and
then configure the rest of your network hosts to get time from the Stratum 4 servers.
This is shown in Figure 16-11.
• Stepping and slewing
The NTP protocol initially syncs time between the time
consumer and the time provider about once per minute. However, the interval increases
gradually to once every 17 minutes once time is closely synced between the provider and
consumer. Essentially, large adjustments occur relatively quickly, but then only small
adjustments are made across a longer time interval.
If the time difference between the provider and the consumer is small (less than
128 milliseconds), NTP adjusts the time on the consumer gradually. This is called
slewing.
If, on the other hand, the time difference between provider and consumer is
relatively large, the time adjustments are made more quickly on the consumer. This
is called stepping.
• Insane time
If the time difference between the provider and consumer is more than 17 minutes off, the
NTP daemon (ntpd) considers time to be “insane” and will not adjust it.
• Drift
NTP measures and corrects for incidental clock frequency errors (called
drift). It writes the current frequency value to the ntp.drift file in the /var/lib/ntp/drift/ directory.
If you stop and then restart the NTP daemon, it initializes the clock frequency using the
value in this file. This prevents ntpd from having to relearn the frequency error associated
with the system clock on your system. Here is a sample ntp.drift file:
openSUSE:/var/lib/ntp/drift # cat ./ntp.drift
0.000
• Jitter
Jitter is the estimated time difference between the consumer and the provider
since the last time poll.
LX0-104 Exam Objectives (N)
LX0-104 Exam Objectives (N)
No comments:
Post a Comment