Last year, I wrote an article about why Cisco devices should
use Network Time Protocol (NTP) for their time synchronization needs, in which
I explained how to configure NTP on your Cisco devices (“Synchronize
a Cisco router’s clock with Network Time Protocol (NTP)”). Using NTP
is the ideal method for medium to large-scale networks.
However, if you have only a handful of routers, manually
setting the clock may be the easiest way to properly configure your devices’
times. Let’s walk through the process.
If a Cisco router boots up before you’ve configured a local
time or network time source, it will display the date as March 1, 1993. Here’s
an example:
Router> show clock *00:01:10.415 UTC Mon Mar 1 1993 Router>
This date’s appearance on log files is a good indication
that no one has set the router’s time source or local time. This is much more
likely than the router’s log entries actually dating back to 1993.
Does setting the correct time on a router really matter? While proper time
configuration isn’t necessary for a router to fully operate, that doesn’t mean
you shouldn’t set the right time. Here are some of the benefits of setting the
correct time on a router:
- Log
files display the proper time stamp, which can help when troubleshooting a
problem. - The
correct time allows you to make connections between two different times. - You
can schedule
commands using the router’s kron
scheduler.
Configure the time zone
When setting a router’s (or switch’s) correct time, the
first step is configuring the proper time zone. This is the first step for a
reason: If you set the time first and then try to set to the time zone, you’ll
have to reset the time again.
The key point to remember is that it’s not enough to know that
you’re in the Eastern or Pacific time zone. You need to know how many hours you
are from Greenwich Mean Time (GMT).
For example, if you’re in the Eastern Standard Time zone in
the United States, you’re five hours behind GMT. You would indicate this to the
router with -5. If you’re unsure how many hours you are from GMT, the U.S.
Navy’s Web site offers a great resource—the World Time Zone Map.
After you’ve determined your time zone value, you can set
the time zone. For example, I live in the Central Standard Time (CST) zone, so
here’s how I would configure the router:
Router(config)# clock timezone CST -6
Configure Daylight Saving Time
After setting the appropriate time zone, you need to
configure the router to adjust for Daylight Saving
Time. You can use the summer-time
command to accomplish this. Using our CST zone example, here’s how to configure
the router to use Daylight Saving Time:
Router(config)# clock summer-time CDT recurring
The summer-time
command tells the router to refer to Daylight Saving Time as Central Daylight Time
(CDT), which will automatically occur according to predefined dates and times on
the router. (You can use the same command to manually set the date and time for
Daylight Saving Time.) The recurring
option tells the router to use the accepted U.S. Daylight Saving Time rules for
the annual time changes in April and October.
Configure the clock
After configuring the time zone and Daylight Saving Time, the
last step is to configure the router’s clock. You must do this while in Privileged
Mode—not Global Configuration Mode.
If you’ve never done this before, the format can be a bit
tricky. Here are some things to keep in mind:
- Use
the clock set command. - Use
military time. - Include
seconds when setting the time. - Specify
the month using its three-letter abbreviation. - Add
the date and the year.
Here’s an example:
Router# clock set 10:50:00 Oct 26 2006
View the time
After configuring the time zone, Daylight Saving Time, and
the clock, you can view the clock using the show
clock command. Here’s an example:
Router# show clock 10:51:33.208 CDT Thu Oct 19 2006 Router#
Keep in mind that most Cisco routers and switches don’t have
internal clocks that store the time when you power them off. That means rebooting
a device will lose the set local time. However, the time zone will remain set because
the router stores it in its configuration.
For more information on Cisco IOS time configuration, check
out Cisco’s
documentation for the various clock
commands. How do you set the time on routers or switches? Do you set it
manually or use NTP? What other router and switch topics would you like to see covered?
Share your comments in this article’s discussion.
Miss a column?
Check out the Cisco Routers and Switches
Archive, and catch up on David Davis’ most recent columns.
Want to learn more
about router and switch management? Automatically
sign up for our free Cisco Routers and Switches newsletter, delivered each
Friday!
David Davis has worked
in the IT industry for 12 years and holds several certifications, including
CCIE, MCSE+I, CISSP, CCNA, CCDA, and CCNP. He currently manages a group of
systems/network administrators for a privately owned retail company and
performs networking/systems consulting on a part-time basis.