Setting the Time

Problem

You want to set the clock on the router.

Solution

You can set the internal system clock, using the clock set in Enable mode:

Router#clock set 14:27:22 January 29 2006
Router#

Some high-end routers, such as 4500 series, 7000 series, 7200 series, and 7500 series, have a battery protected calendar function that continues to keep time even if the router is temporarily powered off. You can set this calendar function by using the calendar set command in Enable mode:

Router#calendar set 14:34:39 January 29 2006
Router#

In both cases the router will accept either “hh:mm:ss day month year” or “hh:mm:ss month day year” notation.

Discussion

Every Cisco router has an internal system clock. When the router boots, the internal system clock starts to maintain the current date and time. If there is no battery-protected calendar in the router, the clock starts with a default initial value of Monday, March 1, 1993 at midnight. If you want accurate time, either you need to set it manually as shown above, or you need an automated method for setting it as in Recipe 14.5.

Most high-end routers have an internal battery-powered clock called a calendar. Router calendars are able to maintain accurate time and date information even during power interruptions. When the router initializes, it automatically synchronizes the internal system clock with the date stored with the calendar.

You can view the current calendar time by using the following command:

Router>show calendar 14:34:39 UTC Sun Jan ...

Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.