By default, the system is an NTP client. You must
configure NTP client parameters to start NTP client operation. You
can also configure the system as an NTP server, whether or not you
configure NTP client parameters.
Enabling NTP Services
Before you can configure NTP client parameters
or enable a virtual router to act as an NTP server, you must enable
NTP services. When you enable NTP services, the NTP client associates
itself with the current virtual router. Because there is only one
system clock to update, only the virtual router on which you configure
NTP can act as the NTP client. However, any virtual router can act
as an NTP server. To enable NTP services:
(Optional) Access the virtual router with which you want
to associate NTP services.
Issue the ntp enable command.
ntp enable
Use to enable NTP services on the system.
This command associates NTP services and the NTP client
with the current virtual router.
Example
host1:boston(config)#ntp enable
Use the no version to disable
NTP polling and clock correction and to remove the association between
NTP services and the virtual router.
By default, an NTP server sends a response to the
interface from which an NTP request originated. You can now direct
responses from all NTP servers to one interface on the system or direct
responses from a specific NTP server to a specific interface.
ntp source
Use to direct responses from all NTP servers to a specific
interface. Using the source option with
the ntp server command overrides the ntp source command.
Example
host1(config)#ntp source atm 3/1
Use the no version to direct
all servers to reply to the interface from which the NTP request was
sent (the default setting).
You can prevent the system from receiving certain
types of broadcasts and specify the servers from which the system
will accept NTP broadcasts. To do so:
Note:
The system can accept, but does not use, NTP control
queries.
Use to specify the types of broadcasts that the system
will accept and respond to, and to specify an access list of servers
from which the system will accept broadcasts.You can enable the system
to:
Receive time requests, receive NTP control queries, and
synchronize itself to the servers specified on the access-list
Only receive time requests and NTP control queries from
specified servers
Only receive time requests from specified servers
Only receive NTP control queries from specified servers
Example
host1(config-line)#ntp access-group peer europe
Use the no version to enable
the system to receive all NTP broadcasts on interfaces configured
to receive broadcasts.
To enable a virtual router to act as an NTP server:
Access the virtual router context.
Specify that the virtual router acts as an NTP server.
Caution:
Be sure that you do not override a valid time
source if you specify the stratum of the NTP server. Issuing the ntp master command on multiple systems in the network
might lead to unreliable timestamps if those systems do not agree
on the time.
(Optional) Specify the stratum of this NTP server.
ntp broadcast
Use to enable broadcast server on an interface to send
NTP broadcast messages periodically.
The server sends the NTP broadcast messages to the local
network broadcast address (255.255.255.255).
Example—In this example, the interface supports
NTP software, version 4, and a poll interval of 5 (32 seconds) for
broadcasting NTP messages.
host1:boston(config-if)#ntp broadcast version
4 5
Use the no version to prevent
the interface from sending NTP broadcast messages.
Use to specify the stratum number of a virtual router
you configured as an NTP server
By default, the stratum number is set to the stratum number
of the master plus one.
Caution:
Although you can specify a stratum number of 1,
the system does not support stratum 1 service. The system can synchronize
only with an NTP server, and not directly with an atomic clock or
radio clock.
Specify a stratum number for the system in the range 1
– 15. A stratum n server is n hops from an accurate time source.
Example
host1:boston(config)#ntp master
Use the no version to restore
the default stratum number.
The following examples show how to configure the
system as an NTP client and an NTP server.
Example 1
NTP communications are established on the virtual router boston.
The system is a client of the NTP server with IP address 172.16.5.1.
host1#virtual-router boston
host1:boston#ping 172.16.5.1
Sending 5 ICMP echos to 172.16.5.1, timeout = 2 sec.
.....
Success rate = 100% (0/5), round-trip min/avg/max = 0/0/0
ms
host1:boston#configure terminal
host1:boston(config)#ntp server 172.16.5.1
host1:boston(config)#ntp enable
Example 2
NTP communications are established on the virtual router boston.
The system is specified as an NTP server.
host1#virtual-router boston
host1:boston#configure terminal
host1:boston(config)#ntp server
Example 3
NTP communications are established on the virtual router boston.
The router is specified as an NTP broadcast server and synchronizes
with NTP server 172.16.5.1. The specified interface enabled for NTP
broadcasting is configured with version 4 and poll interval 5 for
broadcasting NTP messages.
host1#virtual-router boston
host1:boston#configure terminal
host1:boston#ntp enable
host1:boston(config)#ntp server 172.16.5.1
host1:boston(config)#interface fastethernet
9/3
host1:boston(config-if)#ntp broadcast 4 5
Note:
In Example 3, the router that acts as the NTP broadcast server
must either synchronize to another server or master (specified by
the ntp server command) or act as master
(ntp master command).