Use this command if you want to allow the system to synchronize the system software clock with the specified NTP server.
When you use the hostname argument, the router performs a DNS lookup on that name and stores the IPv4 or IPv6 address in the configuration. For example, if you enter the ntp server hostname command and then check the running configuration, the output shows �ntp server a.b.c.d,� where a.b.c.d is the IP address of the host, assuming that the router is correctly configured as a DNS client.
Use the prefer keyword if you need to use this command multiple times and you want to set a preferred server. Using the prefer keyword reduces switching between servers.
If you are using the default NTP version 3 and NTP synchronization does not occur, try Network TimeProtocol version 2 (NTPv2). Some NTP servers on the Internet run version 2. For IPv6, use NTP version 4 (NTPv4).
If you are using NTPv4, the NTP synchronization takes more time to complete when compared to NTPv3, which synchronizes in seconds or within of 1 to 2 minutes. The acceptable time for synchronization in NTPv4 is 15 to 20 minutes. The exact time span required for the NTP synchronization while using NTPv4 cannot be derived accurately. It depends on the network topology and complexity. To achieve faster NTP synchronization, enable the burst or iburst mode by using the burst or iburst keyword, respectively. With the burst or iburst mode configured, NTP synchronization takes about 1 to 2 minutes.
Effective with Cisco IOS Release 15.2(1)S1, the burst and iburst modes are enabled by default. However, the burst and iburst keywords are retained in the command.
The NTP service can be activated by entering any ntp command. When you use the ntp server command, the NTP service is activated (if it has not already been activated) and software clock synchronization is configured simultaneously.
When you enter the no ntp server command, only the server synchronization capability is removed from the NTP service. The NTP service itself remains active, along with any other previously configured NTP functions.
If you had issued the ntp server command and you now want to remove not only server synchronization capability, but also all NTP functions from the device, use the no ntp command without any keywords or arguments.
If you use the no ntp command without keywords or arguments in global configuration mode, all NTP configurations are removed and the NTP service on the device is disabled.
If you want to disable an NTP server or a peer configured with a particular source interface, you must specify the interface type and number in the no form of the command.
The following example shows how to configure a router to allow its software clock to be synchronized with the software clock of an NTP server by using the device at the IPv4 address 172.16.22.44 using NTPv2:
Router(config)# ntp server 172.16.22.44 version 2
The following example shows how to configure a router to allow its software clock to be synchronized with the software clock of an NTP server by using the device at the IPv6 address 2001:0DB8:0:0:8:800:200C:417A using NTPv4:
Router(config)# ntp server 2001:0DB8:0:0:8:800:200C:417A version 4
The following example shows how to configure software clock synchronization with an NTP server with a particular source interface:
Router(config)# ntp server 18.104.22.168 source ethernet 0/1