cisco交换机时间设置时间
Cisco并不难,主要有些人没有接触的机会,如果你经常管理cisco设备,你会发现其实就那几步,不过也有不少网友不知道cisco交换机时间设置时间怎么设置。其实步骤并不难,下面学习啦小编给大家介绍一下具体操作办法,供大家参考!
cisco交换机时间设置时间具体操作
将CISCO6509配置为标准时间服务器
ntp server 192.168.0.101
查询当前的时间
Cisco6509#show clock
00:09:13.643 PDT Tue Jun 30 2009
配置一个北京时区,随意取名
clock timezone Beijing 8
再查询一下,已经同步过来了
CISCO6509#show clock
15:10:00.239 Beijing Tue Jun 30 2009
设定硬件时钟为权威NTPserver
(config)#clock calendar-valid
调整时间
#clock set 15:00:00 30 jun 2009
当前时钟为
#show clock
15:15:10.705 Beijing Tue Jun 30 2009
当前硬件时钟为
#show calendar
14:37:59 Beijing Tue Jun 30 2009
NTP源为vlan2
(config)#ntp source vlan 2
将同步其他时间去除
no ntp server 10.20.0.103
将硬件时钟与当前clock同步
#clock update-calendar
查看当前clock时间
#show clock
.15:47:57.558 Beijing Tue Jun 30 2009
查看当前硬件时钟
#show calendar
15:48:00 Beijing Tue Jun 30 2009
配置系统debug记录的时间格式
(config)#service timestamps debug datetime localtime
配置系统日志记录时间格式
(config)#service timestamps log datetime localtime
设置与其他时间服务器同步
(config)#ntp server 192.168.0.102
设置为第一级ntp服务器
(config)#ntp master 1
允许更新硬件时钟(不必须)
(config)#ntp update-calendar
查看的ntp设置的命令
sh clock detail
sh ntp sta
sh ntp ass
sh ntp ass detail
----配置命令
ntp authentication-key 1 md5 xx
ntp source Loopback0
ntp server 10.10.10.1 key 1
配置方法:
// router 7206
conf t
ntp source FastEthernet0/1 //指定更新源地址,覆盖ntp server中的配置
ntp update-calendar //设备如带有硬件时钟,同时更新硬件时钟
ntp server 202.155.248.218 source FastEthernet0/1 //指定更新目的地址,香港,并指定更新源接口为f0/1.
int f0/1
ntp enable
这时你应该已经获得了时间,但是注意,时区是否正确,默认为格林威治时间,如想改为北京时间,下面这步是必不可少的。
Core-Switch-1#show clock
Core-Switch-1#show ntp status
Core-Switch-1#conf t
Core-Switch-1(config)# clock timezone GMT +8
Core-Switch-1(config)#service timestamps debug datetime msec localtime show-timezone
Core-Switch-1(config)#service timestamps log datetime msec localtime show-timezone
Core-Switch-1(config)#exit
Core-Switch-1# clock set 13:51:00 Sep 7 2011
或通过NTP服务器时间同步:
Core-Switch-1#ntp server 192.168.0.254 key 8888 注:8888是指ntp服务器的Key值
Core-Switch-1#wr
Core-Switch-1#sh log
默认情况下日志消息不包括日期和时间戳。
service timestamps {debug | log } uptime
service timestamps {debug | log } datetime [mesc] [localtime] [show-timezone] [year]
debug 参数 在调试输出时包括时间戳
log 参数 在每种日志消息中添加一个时间戳
uptime 在消息中包括路由器开机以来的时间
0w2d: #SYS-5-CONFIG_I : Configured from console by console
0w2d 开机后0周2天
datetime 显示准确的日期和时间 UTC 格式 标准格式 MM DD HH:MM:SS
datetime后面可以跟一些参数
mesc 消息中包括毫秒信息
localtime 显示基于本地配置的时区时间
show-timezone 输出包括时区名称
year 输出包括年份信息
未设置时间前:
#sh log
4w0d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/6, changed state to up
4w0d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/6, changed state to down
4w0d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/6, changed state to up
4w1d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down
4w1d: %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to down
4w1d: %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to up
4w1d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to up
4w1d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
4w1d: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to down
4w1d: %LINK-3-UPDOWN: Interface FastEthernet0/3, changed state to up
4w1d: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up
设置后
#sh log
.Sep 7 05:59:22: %SYS-6-CLOCKUPDATE: System clock has been updated from 13:59:22 BJ Wed Sep 7 2011 to 05:59:22 UTC Wed Sep 7 2011, configured from console by wht on vty2 (172.16.100.10).
.Sep 7 13:59:23: %SYS-6-CLOCKUPDATE: System clock has been updated from 05:59:23 UTC Wed Sep 7 2011 to 13:59:23 GMT Wed Sep 7 2011, configured from console by wht on vty2 (172.16.100.10).
.Sep 7 13:59:24: %SYS-5-CONFIG_I: Configured from console by wht on vty2 (172.16.100.10)
.Sep 7 13:58:00: %SYS-6-CLOCKUPDATE: System clock has been updated from 14:00:05 GMT Wed Sep 7 2011 to 13:58:00 GMT Wed Sep 7 2011, configured from console by wht on vty2 (172.16.100.10).
学习啦小编分享了cisco交换机时间设置时间的解决方法。希望大家喜欢。