2012 年 7 月 26 日 查看思科2960交换机报警日志(#show logging),发现我登录的时间记录和交换机的系统时间不匹配:
Jul 26 02:32:52.825: %SYS-5-CONFIG_I: Configured from console by vty1 (192.168.17.10)
dabaicai10#sh clock
11:07:13.730 bj Thu Jul 26 2012 //系统时间与日志时间相差近9个小时
dabaicai10#conf t
Enter configuration commands, one per line. End with CNTL/Z.
cmredian(config)#service timestamps log datetime msec localtime show-timezone //配置系统日志记录时间
cmredian(config)#service timestamps debug datetime msec localtime show-timezone //配置系统debug记录时间
cmredian(config)#end
dabaicai10#sh log //查看日志时间是否已改变
Syslog logging: enabled (0 messages dropped, 0 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)
No Active Message Discriminator.
No Inactive Message Discriminator.
Console logging: level debugging, 625 messages logged, xml disabled,
filtering disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 625 messages logged, xml disabled,
filtering disabled
Exception Logging: size (4096 bytes)
Count and timestamp logging messages: disabled
File logging: disabled
Persistent logging: disabled
No active filter modules.
Trap logging: level informational, 629 message lines logged
Log Buffer (4096 bytes):
*Apr 18 15:19:25.585: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down
…
Jul 26 14:20:32.633 bj: %SYS-5-CONFIG_I: Configured from console by vty0 (192.168.17.10)
Jul 26 14:24:15.669 bj: %SYS-5-CONFIG_I: Configured from console by vty0 (192.168.17.10)
dabaicai10#
日志时间已改变。
华为S8016交换机上只要设置了正确的时间,日志时间即可同步。
<DABAICAI-S8016-1>disp log
Logging Buffer Configuration and contents:
enabled
allowed max buffer size : 1024
actual buffer size : 256
channel number : 4 , channel name : logbuffer
dropped messages : 0
overwrote messages : 1685
current messages : 256
…
%Jul 26 14:52:17 2012 DABAICAI-S8016-1 SHELL/5/LOGIN: VTY login from 192.168.104.201
%Jul 26 15:01:12 2012 DABAICAI-S8016-1 SHELL/5/LOGIN: VTY login from 192.168.17.10
<DABAICAI-S8016-1>
华为S2300修改系统时间命令如下,具体型号可以使用display clock命令查看其时间格式稍做变化。
<MLK-S2300-1>clock timezone beijing add 8
<MLK-S2300-1>clock datetime 9:35:30 2012-7-22