cisco交换机设置同步日志本地时间的方法
cisco交换机设置同步日志本地时间的方法
学习啦在线学习网 你还在为不知道cisco交换机设置同步日志本地时间的方法而烦恼么?接下来是小编为大家收集的cisco交换机设置同步日志本地时间的方法教程,希望能帮到大家。
cisco交换机设置同步日志本地时间的方法
分类: 系统运维
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交换机设置同步日志本地时间的方法”还想看: