Setting the Clock of a Cisco Device with NTP
The final task to prepare the network infrastructure to support a Cisco VoIP network is to set the time. Having an accurate time on Cisco devices is important for many reasons. Here is a quick list of just some of the reasons why you want an accurate clock on your network devices:
- It allows Cisco IP Phones to display the correct date and time to your users.
- It assigns the correct date and time to voicemail tags.
- It gives accurate times on Call Detail Records (CDR), which are used to track calls on the network.
- It plays an integral part in multiple security features on all Cisco devices.
- It tags logged messages on routers and switches with accurate time information.
When Cisco devices boot, many of them default their date and time to noon on March 1, 1993. You have two options in setting the clock: manually, using the clock set command from the privileged EXEC mode, or automatically, using the Network Time Protocol (NTP).
Devices setting the clock using NTP always have a more accurate time clock than a manually set clock. Likewise, all the NTP devices on your network will have the exact same time. These advantages make NTP the preferred clock-setting method. The accuracy of the clock on your device depends on the stratum number of the NTP server. A stratum 1 time server is one that has a radio or atomic clock directly attached. The device that receives its time from this server via NTP is considered a stratum 2 device. The device that receives its time from this stratum 2 device via NTP is considered a stratum 3 device, and so on. There are many publicly accessible stratum 2 and 3 (and even some stratum 1) devices on the Internet.
After you obtain one or more NTP servers to use, you can configure NTP support on your Cisco devices by using the syntax in Example 3-4.
Example 3-4. Configuring a Cisco Router to Receive Time via NTP
WAN_RTR(config)#ntp server 126.96.36.199
WAN_RTR(config)#clock timezone ARIZONA -7
The first command, ntp server <ip address>, configures your Cisco device to use the specified NTP server; 188.8.131.52 is one of many publicly accessible NTP servers. If this is the only command you enter, your clock on your device will set itself to the Universal Time Coordinated (UTC) time zone. To accurately adjust the time zone for your device, use the clock timezone <name> <hours> command. The previous syntax example set the time zone for Arizona to –7 hours from UTC.
Now that we configured the router to synchronize with an NTP server, we can verify the NTP associations and the current time and date using the commands shown in Example 3-5.
Example 3-5. Verifying NTP Configurations
WAN_RTR#show ntp associations address ref clock st when poll reach delay offset disp *~184.108.40.206 220.127.116.11 3 14 64 377 65.5 2.84 7.6 * master (synced), # master (unsynced), + selected, - candidate, ~ configured WAN_RTR#show clock 11:25:48.542 CA1_DST Mon Dec 13 2010
The key information from the show ntp associations command is just to the left of the configured NTP server address. The asterisk indicates that your Cisco device has synchronized with this server. You can configure multiple NTP sources for redundancy, but the Cisco device will only choose one master NTP server to use at a time.
After you configure the Cisco router to synchronize with an NTP server, you can configure it to provide date and time information to a CUCM server, which can then provide that date and time information to the Cisco IP Phones in your network. To allow other devices (such as a CUCM server) to pull date and time information from a Cisco router using NTP, use the ntp master < stratum number> command from global configuration mode. For example, entering ntp master 4 instructs the Cisco router to deliver date and time information to requesting clients, marking it with a stratum number of 4.