Networking

Properly set a Cisco router's clock and time zone

Does setting the correct time on a router <i>really</i> matter? Actually, it does. In this edition of Cisco Routers and Switches, David Davis reviews the benefits of setting the correct time on your router, and he walks you through the three-step process to configure the correct time.

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:

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.

14 comments
Daniel.Honzik
Daniel.Honzik

One thing Dave missed in his article above to actually set the time zone and configure for summer-time you have to do a configure Terminal command first.

ciscoman84
ciscoman84

is the daylight saving time a necessary step to be configured. bcus i don't really understand it.

ericbalan
ericbalan

its good info. how to troubleshoot what happen when time is reset to default (1st jan 2000). what could be the possible reason.

zmedlock
zmedlock

This is a great help. Thanks

joseagon
joseagon

What negative effects if any, could having the time zone set to CST instead of GMT on a PIX or router cause? thanks

JetConSys
JetConSys

In 2007 the dates to change to DST are changing. While there is reference to some products changing, I haven't seen any reference to any IOS upgrade to take this into consideration. Am I missing something? If not you will have to go to every router to change the config.

chuckmba@adelphia.net
chuckmba@adelphia.net

Setting the time to the local time eliminates confusion. People know what EST is, a lot don't know what GMT or UTC is or how many hours different it is from local time. In addition, GMT does not change like DST does: right now GMT is five hours different but last week it was four hours different.

davidlsharpe
davidlsharpe

You might want to avail yourself of this opportunity to cut your networking gear over to Universal Time. Thanks for pointing this issue out. IT professionals worldwide need to be cognizant of the DST2007 problem, especially if your organization, your organizations customers, or your partners have a physical or electronic presence in the United States or Canada. There is a small but growing body of information available online to help address the DST2007 problem. For example, there is a tool available at sharpebusinesssolutions.com/dst2007.htm to help with one of the toughest parts of the problem - unsupported versions of Microsoft Windows.

ChrisSwin
ChrisSwin

There may be no need for you to upgrade! Check out the command reference for clock summer-time: http://www.cisco.com/en/US/products/sw/iosswrel/ps5187/products_command_reference_chapter09186a008017d030.html#wp1033365 You can manually specify the start and end days or dates of DST in the configuration. From Cisco's examples on that page: The following example specifies that summer time starts on the first Sunday in April at 2 a.m. and ends on the last Sunday in October at 2 a.m.: Router(config)# clock summer-time PDT recurring 1 Sunday April 2:00 last Sunday October 2:00 If you live in a place where summer time does not follow the pattern in the first example, you can specify the exact date and times. In the following example, daylight saving time (summer time) is configured to start on October 12, 1997 at 2 a.m., and end on April 26, 1998 at 2 a.m.: Router(config)# clock summer-time date 12 October 1997 2:00 26 April 1998 2:00

mjlas01
mjlas01

With the new change in DST coming up, modifying the IOS is certainly in the works. I received a memo from our corporate IT department a few weeks back that advised that the dates are changing next year and that Microsoft and Cisco were mentioned that upgrades were pending, so am sure they will no doubt have something come out at the last minute!

EEnglish34
EEnglish34

If you are trying to catch a hacker you might want to know what time they were attacking. So if your time settings aren't right you won't know when the intrusion happened.

DHouchin
DHouchin

In case anyone else is waiting until the last minute, Chris' solution is perfect, but the second router config statement is missing the timezone, which annoyed IOS 12.4. Router(config)#clock summer-time date 11 March 2007 2:00 4 November 2007 2:00 The above statement will take care of 2007.

tnunetworksupport
tnunetworksupport

Just use the "clock summer-time" command with parameters to manually set this on your switches/routers. I'll be using Kiwi CatTools to do this for me! :)

ddavis
ddavis

Thanks to everyone's posts on this discussion! -David Davis

Editor's Picks