Overview

You can use the clock commands to set the time and date on your system manually. These commands allow you to specify settings such as the source of the time, the time zone, and dates for seasonal time changes.

You can configure your router to update its clock automatically by configuring it as a Network Time Protocol (NTP) client. NTP provides a method of synchronizing the system clocks of hosts on the Internet to Universal Coordinated Time (UTC). Using NTP allows the system to record accurate times of events. You can view the log file of events to monitor the status of the network.

Since there is only one system clock, you can configure an NTP client on one virtual router only. Other virtual routers obtain clock parameters from the system clock. However, multiple virtual routers can act as NTP servers.

NTP

NTP uses a hierarchical structure of hosts, such as computers and routers, that form client-server and peer associations. An NTP client synchronizes with an NTP server, which in turn synchronizes with another time source. If two hosts provide synchronization for each other, they are peers.

Primary or stratum 1 servers synchronize directly with an accurate time source, such as a radio clock or an atomic clock. Secondary or stratum n servers synchronize with other servers, and are n hops from an accurate time source.

To obtain high precision and reliability with NTP, clients typically synchronize with several NTP servers at different physical locations. Peer associations, especially for stratum 1 and 2 servers, provide redundancy for the network.

Hosts synchronize by exchanging NTP messages through UDP. NTP uses the IP and UDP checksums to confirm data integrity.

By default, the router is an NTP client. You must configure NTP client parameters to start NTP client operation. You can also configure the router as an NTP server, whether or not you configure NTP client parameters.

Figure 27 shows an example of an NTP hierarchy.

Figure 27: Example of an NTP Hierarchy

Example of an NTP Hierarchy

System Operation as an NTP Client

To synchronize to the clock of a server, the system must receive time information from NTP servers recurrently. The way the system receives such information depends on how you configure it:

By default, NTP servers respond to the interface from which an NTP request originated. You can direct responses from all NTP servers to one interface on the system, or from a specific NTP server to a specific interface.

Note: When the system is not configured as either an NTP client or an NTP server, it responds to NTP requests with an invalid stratum number.

Synchronization

There are three stages to synchronization:

Preliminary Synchronization

Preliminary synchronization is a stage during which the system evaluates the initial time situation and decides how to proceed with longer-term synchronization. This stage involves the following steps:

  1. The system obtains several readings of time data from NTP servers.
  2. The system analyzes time data in the messages and compares the readings from different servers. Using this information, the system identifies the initial best time source (the best server).
  3. The system calculates the difference between its own clock and the best server’s clock (the offset) and proceeds as follows:
    • If the offset is greater than 15 minutes, the system disables NTP and displays a message advising you to check the time zone and clock settings.
    • If the offset is less than 15 minutes, the system sets its clock to that of the best server.
  4. Provided the system has not disabled NTP, it proceeds to the next stage:
    • If a frequency calibration is available, the system starts progressive synchronization.
    • If the system has never performed a frequency calibration or the calibration has been deleted, the system starts a frequency calibration.

Frequency Calibration

Frequency calibration takes place the first time you use NTP or when you reboot the system. During this stage, the system evaluates the frequency error of its clock by measuring change in the offset error. A frequency calibration takes 15 minutes.

Progressive Synchronization

After the system has established initial NTP parameters, it continues to synchronize to a server as follows:

  1. The system acquires time information from servers periodically.
  2. The system evaluates which server is currently the best time source (the master) by analyzing time data in the messages and comparing the data from different servers.
  3. The system gradually synchronizes its clock to that of the master.

System Operation as an NTP Server

The NTP server supports both unicast (user-to-user addressing protocol) and broadcast modes. Depending on the server configuration you choose, the system functions in different ways:

If the system is configured both as an NTP client and an NTP server, the system effectively synchronizes its clients to its master’s clock. If the system is configured as an NTP server but not an NTP client, the system synchronizes its clients to its own clock, which can be set by the clock commands.

Note: When the system is not configured as either an NTP client or an NTP server, it responds to NTP requests with an invalid stratum number.