Time related stuff in cisco IOS Filed Under: Networks
Introduction
This small tutorial will deal with time related configuration in the Cisco IOS. The tutorial will first deal with configuration of NTP so the switch/router gets the information from an ntp server. After we have a source of time will deal with setting a timezone to the switch and making the switch/router to automatically update the clock for the daytime light changes.
Once we have all the time well configured will configure the logs and console to records each line with the appropriate time so when we are going to look at the logs we have the right time.
NTP configuration
To setup the switch/router to connect to a ntp server will execute this command under global configuration.
ntp server <server ip>
e.g.ntp server 10.1.1.10
To verify that the switch/router is connecting properly will execute the following show commands:
show ntp status
show ntp associations
Timezone and automatic adjust of clock
To configure the timezone use the following command:
clock timezone <timezone name> <hour offset from UTC>
For example to configure in the GMT timezone with a 0 hours offset.
clock timezone GMT 0
Now to configure the autoupdate of the clock for daytime light change will need the following command.
clock summer-time <summer timezone> recurring last <day> <month> <hh:mm>
last <day> <month> <hh:mm>
For example:
clock summer-time BST recurring last Sun Mar 3:00 last Sun Oct 3:00
Timestamps on logs and debug messages
To configure the messages to show the time will execute the following commands. Is important that you put localtime as if you forget to put it the messages will show the time with the right format but the hour will be different if you are during the daytime save changes (eg. one hour behind)
service timestamps debug datetime msec localtime
service timestamps log datetime msec localtime
The format of the time this command will be similar to this:
Apr 3 09:14:01.670: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/7,
changed state to down
- Permalink
- Alberto Diaz
- 6 Apr 2007 4:00 PM
- Comments (0)