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 29 2006
Router>

If your router returns an error message when you issue this command then it does not contain a calendar:

Router#show calendar
 ^
% Invalid input detected at '^' marker.

Router#

Note, however, that the "clock" time and the "calendar" time are kept on different clocks that may differ at any given moment. After router initialization, these two clocks may drift apart or they may be set independent of one another. Fortunately, Cisco's IOS does provide methods of synchronizing the two time sources after initial power up.

To set the calendar to the internal clock time, use the following command in Enable mode:

Router#clock update-calendar
Router#

You can also set the internal clock to the calendar time using the command:

Router#clock read-calendar
Router#

Both the internal system clock and calendar use 24-hour time notation rather than 12-hour AM/PM notation.

See Also

Recipe 14.5

Router Configuration and File Management

Router Management

User Access and Privilege Levels

TACACS+

IP Routing

RIP

EIGRP

OSPF

BGP

Frame Relay

Handling Queuing and Congestion

Tunnels and VPNs

Dial Backup

NTP and Time

DLSw

Router Interfaces and Media

Simple Network Management Protocol

Logging

Access-Lists

DHCP

NAT

First Hop Redundancy Protocols

IP Multicast

IP Mobility

IPv6

MPLS

Security

Appendix 1. External Software Packages

Appendix 2. IP Precedence, TOS, and DSCP Classifications

Index



Cisco IOS Cookbook
Cisco IOS Cookbook (Cookbooks (OReilly))
ISBN: 0596527225
EAN: 2147483647
Year: 2004
Pages: 505

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net