如何配置Brocade和Cisco光纤交换机的NTP服务器
转载请在文首保留原文出处:EMC中文支持论坛
介绍
在大型的企业网络,给所有的网络设备设置一个标准的时间是很有必要的。当需要生成管理报表,或者从多台设备的日志中寻找关联的事件时,这会带来很大的便利。有些企业客户甚至会为他们的关键业务配备一级时间服务器(Stratum-1 NTP)。
互联网中有许多免费的NTP时间服务器,如poo.ntp.org。通常NTP默认是不开启的,本文将介绍如何给Brocade或Cisco的光纤交换机配置NTP服务器。
更多信息
Brocade基本命令:
tsclockserver[ipaddr [; ipaddr ...]]
例如:
设置NTP服务器为指定IP:
switch:admin> tsclockserver 123.123.123.123
设置多个NTP服务器:
switch:admin> tsclockserver "12.134.125.24; 12.234.87.01"
注:Principle switch会将NTP设定分发到整个光纤网络(fabric)。
交互方式设置时区(time zone):
tstimezone--interactive
关闭NTP (设为本地时间):
tsclockserverLOCL
Cisco基本命令:
ntpenable
ntpserver {ip-address | ipv6-address | dns-name}
ntppeer {ip-address | ipv6-address | dns-name}
ntpdistribute
ntpcommit
开启NTP协议:
switch# configure terminal
switch(config)# ntp enable
switch(config)# copy running-config startup-config
配置NTP服务器或服务器对(peer):
switch# configure terminal
switch(config)# ntp server 192.0.2.10
或switch(config)# ntp peer 2001:0db8::4101
showntp peers
copyrunning-config startup-config
显示或清除NTP统计数据:
switch# show ntp statistics all-peers
switch# clear ntp statistics all-peers
启用NTP分发(NTP distribution),将NTP配置分发到整个光纤网络。此功能需要开启Cisco Fabric Services (CFS):
switch# configure terminal
swtich(config)# ntp distribute
swtich(config)# show ntp status
swtich(config)# copy running-config startup-config
提交NTP配置的更改:
switch# configure terminal
swtich(config)# ntp commit
swtich(config)# show ntp session status
swtich(config)# copy running-config startup-configfabric
撤销NTP配置的更改:
switch# configure terminal
swtich(config)# ntp abort
swtich(config)# show ntp session status
注:如果已经执行了NTP相关操作但忘记提交或撤销更改的设置,NTP session可能会被锁住。管理员可以在光纤网络中任意一台交换机上执行clearntp session以解除NTP设置锁。
使用以下命令确认NTP配置:
showntp peer-status
showntp peers
showntp pending peers
showntp pending-diff
showntp session status
showntp statistics { io | local | memory | peer {ipv4-address | ipv6-address | dns-name}
showntp status
showntp timestamp status
CicsoMDS交换机为何无法从NTP服务器更新时间?
有时管理员可能会发现自己已经在Fabric中设置了NTP服务器,但交换机始终不更新正确的时间。使用ntpsync-retry命令无效,show ntp peer-status的local那一栏也没有mgmt0的IP地址:
switch#sh ntp peer-status
Total peers : 1
* - selected for sync, + -peer mode(active),
- - peer mode(passive), = - polled in client mode
remotelocalstpollreachdelay
-----------------------------------------------------------
=10.168.45.500.0.0.0166400.00000
这是因为交换机本地时间与NTP服务器的时间相差太大(超过1000秒),交换机会假定如此大的间隔可能是由于网络或NTP服务器存在问题。为了防止潜在的破坏,交换机将不会自动更新时间。要修复该问题,需要先手动设置一下交换机本地时间:
clockset {HH:MM:SS DD Month-in-words YYYY}
例如:clock set 15:58:09 23 September 2012
和时区:
clocktimezone <0 to 50 minutes offset from UTC>
例如&#xff1a;clock timezone PST -8 0
然后再等待一段时间或执行ntp sync-retry手动执行一次同步即可。
参考
EMC知识库文档&#xff1a;emc238283 "Cisco: NTP fails to sync due to clock time set too far ahead or behind NTP server clock"
Brocade硬件参考手册
Cisco MDS 9000 Family配置手册
应用于
Brocade光纤交换机、Cisco MDS光纤交换机