RS6000
作者RS6000·2020-06-26 16:55
售前技术支持·浪潮商用机器有限公司

AIX NTP对时问题解决

字数 4306阅读 6024评论 1赞 0

最近遇到一个 NTP 对时的问题,跟大家分享下。

客户环境:

一般来说,客户环境中都会规划 NTP Server ,专门用来进行 NTP 的对时,但是这个客户没有专门的 NTP 服务器,而是让服务器系统直接和北斗 GPS 进行对时。

Ø 4 台 Power9 服务器, AIX 系统的 IP 分别以 201 , 202 , 203 , 204

Ø 1 台 x86 服务器, Linux 系统 IP 为 114

Ø 北斗 GPS 的 IP 为 200, 但是它于其他服务器的 IP 不是同一网段。

客户反馈:

Linux 服务器对时正常, AIX 服务器对时不正常,但是 AIX 手工通过 ntpdate 的命令是可以手工同步的。因为客户应用版本的问题,客户用的操作系统是 AIX 6.1 ,而 AIX6.1 是无法通过我们经常的操作系统问题进行报修。

去现场之前准备:


  1. 准备好 AIX6.1 的最新补丁包。
  2. 准备好 NTP 的相关文档。
  3. 做好 Plan A 和 Plan B , Plan A 尽量解决问题(可能解决问题的几种方法), Plan B 是通过 crontab 的脚本,定时执行 ntpdate 命令对时。

客户现场沟通及测试:

  1. 查看客户环境如下:

AIX 系统版本: AIX 6100-09-05

NTP 版本: v3

  1. 查看 NTP 配置,配置正常。查看相关命令输出:

ntpq –p

remote refid st t when poll reach delay offset disp

==============================================================================

192.1.3.200 .GPS. 1 u 3 128 377 0.61 0.510 1.59

注:这个#符号就是客户一直说的 AIX 系统 NTP 对时有问题的地方。 Linux 系统里面是 * 号。

我就去查阅这个 # 是什么意思,查到的资料如下:

space Discarded due to high stratum and/or failed sanity checks.

x Designated falseticker by the intersection algorithm.

. Culled from the end of the candidate list.

  • Discarded by the clustering algorithm.
  • Included in the final selection set.

Selected for synchronization but distance exceeds maximum.

  • Selected for synchronization.

o Selected for synchronization, pps signal in use.

我们配置过 ntp 的童鞋都知道正常的状态应该是 * (选择同步),而 # (选择距离超过最大值的同步)。

尝试解决问题:

  1. 打上 AIX6.1 系统最新补丁,问题依旧。
  2. 激活 slewing 慢速调整:

1). 在 /etc/ntp.conf 配置文件里添加一行:

slewalways yes

2). 修改 xntpd 服务属性:

chssys -s xntpd -a "-x"

stopsrc -s xntpd

startsrc -s xntpd

调整完,问题依旧。

  1. 修改 NTP 配置为最简,问题依旧。
  2. 按照售后建议的架构, Linux 能够正常对时,我就将 AIX 机器向 Linux 机器对时, Linux 直接向北斗 GPS 对时。问题依旧。

-bash-4.4# ntpq -p

remote refid st t when poll reach delay offset disp

==============================================================================

192.1.1.114 192.1.3.200 2 u 18 64 377 0.26 -0.172 0.05

  1. 201 和 202 直连 GPS 对时,手动修改时间误差为 4 秒,(暂时不管 # 号的问题),居然发现 AIX 系统是会自行同步的,但是这个不正常的 # 号显示,还是让人不能确保 AIX 的 NTP 一直正常。

因为客户应用几天后就要上线了,我们建议客户启用我们的 Plan B (通过 ntpdate 定时对时),客户也认可,三下五去二,配置号 crontab 脚本,测试脚本,完美解决。准备让客户确认的时候,这时候客户说了一句,我们 201 和 202 作为其他几十台机器的 NTP 服务器,而且 201 和 202 还是作为 NTP 服务的主备服务器(客户事先没有提过这茬)。那我事先准备好的 plan B 也不能用呀,毕竟那么多脚本,维护也是问题。

解决问题最终篇

经过上面的测试和与客户的沟通,我们只能回到 Plan A ,彻底解决这个 # 号显示问题,才能根本上解决这个 NTP 的问题。

继续查阅相关 NTP 的资料,同事(康大师)找到一篇文档,查到 ntp v4 版本里是加入了新参数可以调整 max distance

https://www.nwtime.org/wp-content/uploads/2016/04/NTP-Handbook.pdf

page 46

Several new options have been added for the ntpd command line. For the inveterate knob twiddlers several

of the more important performance variables can be changed to fit actual or perceived special conditions. In

particular, the tinker and toscommands can be used to adjust thresholds, throw switches and change limits.

page 57

A source is considered selectable only if its root distance is less than the select threshold, by default 1.5 s, but can

be changed according to client preference using the maxdist option of the tos command. When an upstream server

loses all sources, its root distance apparent to dependent clients continues to increase. The clients are not aware of this

condition and continue to accept synchronization as long as the root distance is less than the select threshold.

page 77

tos [beacon | ceiling | cohort {0 | 1} | floor | maxclock | maxdist | minclock | mindist | minsane | orphan | orphanwait ]

This command alters certain system variables used by the the clock selection and clustering algorithms. The

default values of these variables have been carefully optimized for a wide range of network speeds and reliability

expectations. Very rarely is it necessary to change the default values; but, some folks can’t resist twisting the

knobs. It can be used to select the quality and quantity of peers used to synchronize the system clock and is

most useful in dynamic server discovery schemes. The options are as follows:

maxdist

Specify the synchronization distance threshold used by the clock selection algorithm. The default is 1.5 s.

This determines both the minimum number of packets to set the system clock and the maximum roundtrip

delay. It can be decreased to improve reliability or increased to synchronize clocks on the Moon or planets.


看完这篇文档,我就感觉这个参数可能就是解决这个问题的关键所在。

最终解决方法:

  1. 升级到 NTPv4 版本, 参考如下链接

https://www.ibm.com/support/pages/ibm-aix-howto-step-step-instructions-switching-between-ntp-v3-and-ntp-v4

  1. 在 /etc/ntp.conf 配置文件里面添加如下命令:

tos maxdist 16

执行 ntpq –p 的命令, IP 前面为我们所熟悉的正常 * 号,测试 NTP 功能,功能正常。至此 NTP 问题完美解决。

如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!

0

添加新评论1 条评论

zwz99999zwz99999系统工程师dcits
2020-06-28 10:02
不错的案例

NEW_UFO@RS6000 你好,可不可以请教一下ntp的问题,15285036681

2022-01-11 10:46

RS6000@zwz99999 共同学习。

2020-08-30 16:00
Ctrl+Enter 发表

作者其他文章

相关文章

相关问题

相关资料

X社区推广