by lunarg on June 18th 2014, at 13:49

From a logging point of view, it's interesting to have your clock set up correctly on your Cisco switches. Your switch should have these capabilities, but network admins usually "forget" to set these up.

To configure these, you need to have privileged access to your switch using SSH/telnet/console. The following works on any device running iOS (i.e. switches and routers).

Configure time zone

Time zones are expressed as a name, followed by an offset. The offset indicates the number of hours from UTC, expressed as -hour or +hour. To know the offset for your time zone, you could look at the World Time Zone map.

In my case, for Central European Time, I would set it to this:

SW(config)# clock timezone CET +1

For Central Standard Time:

SW(config)# clock timezone CST -6

Note that "CET" and "CST" are arbitrary names, although it's recommended to stick to the standards.

Configure Daylight Saving Time (DST)

Your switch is also capable of automatically updating its clock for DST. This can be done manually, or recurringly (using US rules for enabling and disabling in April, resp. October).

For Central European Time, this becomes like so:

SW(config)# clock summer-time CEST recurring

For Central Daylight Time:

SW(config)# clock summer-time CDT recurring

Setting this to recurring automatically enables/disables DST, depending on the current date (of your switch). DST follows US rules for enabling/disabling DST (April and October).

Manually set the clock

First of, I strongly recommend using an NTP server as a time source, as it's more reliable and it keeps the internal clock from drifting. Moreover, if your switch gets power cycled, it will resync with the NTP server, so you don't have to set the clock again.

If you really want to, you can manually set the clock like so:

SW# clock set hh:mm:ss MMM DD YYYY

There are some rules to follow:

  • You have to use 24h format for the time, and specify the seconds (i.e. "military" notation);
  • Months are expressed using its English three-letter abbreviation (MMM);
  • The date is expressed in US format (so first month, then day, then year).

Synchronize with an NTP server

Setting up clock and timezone is one thing, but it's even better to have your switches sync to an NTP server so the date and time is always right.

Setting up your switch to use an NTP server is very easy:

SW(config)# ntp server ip-address

This enables the internal NTP client and starts synchronization with the NTP server as a time source.

To check the status of the clock and NTP sync, you can use these commands:

SW# show clock detail

This shows the current clock and whether it's set up manually or set up using an NTP server.

SW# show ntp status

This reveals the current NTP peer status, which stratum the NTP server is, what the clock offset is, and so on.

« May 2024»
« I needed a password with eight characters so I picked Snow White and the Seven Dwarves. »