NTP Configuration Tasks
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 enableUse the no version to disable NTP polling and clock correction and to remove the association between NTP services and the virtual router. NTP Client Configuration
To configure the system as an NTP client:
- Ping the selected NTP servers to ensure that the system can reach them.
- Configure the system to acquire NTP data by completing one or both of the following actions:
- If you enable the system to receive broadcasts on an interface, set the estimated round-trip delay between the system and an NTP broadcast server.
- Disable NTP on interfaces that you do not want to receive NTP communications for security or other reasons.
ntp broadcast-client
host1(config-if)#ntp broadcast-clientUse the no version to prevent the system from receiving NTP broadcasts. ntp broadcast-delay
- Use to set the estimated round-trip delay in the range 0 to 999,999 microseconds between the system and an NTP broadcast server.
- Example
host1(config)#ntp broadcast-delay 2000Use the no version to set the estimated round-trip delay to the default, 3000 microseconds. ntp disable
host1(config-if)#ntp disableUse the no version to reenable NTP on an interface. ntp server
- Use to assign an NTP server to the system and to customize the way the server communicates with the system.
- Specify the source option to direct responses from the NTP server to a specific interface on the system and override the ntp source command.
- Example
host1(config)#ntp server 192.35.42.1 version 3 prefer source atm 3/0.1Use the no version to terminate communications between the system and an NTP server. ping
host1(config)#ping 192.35.42.1There is no no version. Directing Responses from NTP Servers
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/1Use the no version to direct all servers to reply to the interface from which the NTP request was sent (the default setting). Refusing Broadcasts from NTP Servers
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:
access-list
host1(config)#access-list europe permit anyUse the no version to remove the access list. ntp access-group
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
host1(config-line)#ntp access-group peer europeUse the no version to enable the system to receive all NTP broadcasts on interfaces configured to receive broadcasts. NTP Server Configuration
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.
- (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).
- ExampleIn 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 5Use the no version to prevent the interface from sending NTP broadcast messages. ntp master
- 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.
- 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 masterUse the no version to restore the default stratum number. ntp server enable
host1:boston(config)#ntp server enableUse the no version to prevent a virtual router from acting as an NTP server. Configuration Examples
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 bostonhost1:boston#ping 172.16.5.1Sending 5 ICMP echos to 172.16.5.1, timeout = 2 sec......Success rate = 100% (0/5), round-trip min/avg/max = 0/0/0 mshost1:boston#configure terminalhost1:boston(config)#ntp server 172.16.5.1host1:boston(config)#ntp enableExample 2
NTP communications are established on the virtual router boston. The system is specified as an NTP server.
host1#virtual-router bostonhost1:boston#configure terminalhost1:boston(config)#ntp serverExample 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 bostonhost1:boston#configure terminalhost1:boston#ntp enablehost1:boston(config)#ntp server 172.16.5.1host1:boston(config)#interface fastethernet 9/3host1: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).