NTP遇到的一些问题

  1. ntpd & ntpdate 
我的两台虚拟机,使用135作为ntp服务器,138以135为准同步时间。
version:4.2.6p5
ntpd 服务是按照一定时间来同步,而ntpdate是立即同步,但是二者都要使用udp端口123,所以,不能同时运行,也就是在ntpd服务起动的时候,如果运行ntpdate,会有如下提示:
 the NTP socket is in use, exiting
 
所以,为了使用ntpdate立刻同步时间,需要关闭ntpd服务,之后再使用ntpdate命令同步时间就可以了,执行命令:
#systemctl stop ntpd
#ntpdate your-ntp-server

2. ntpdate同步失败
2.1 no servers can be used, exiting
ntpdate在同步时间的时候,需要指定你要同步时间的时间服务器,也就是ntpdate不会使用ntpd的配置文件/etc/ntpd.conf,这就是为什么虽然在配置文件中指定了ntp服务器,但是只执行ntpdate命令的时候,会提示


no servers can be used, exiting。
稍作修改,在关闭ntpd服务后,再次更新时间即可。
2.2 no server suitable for synchronization found

这个问题的出现和你指定的ntp服务器的版本有关,我的版本是4.2。

下面是来自ntp官方网站的说明:

The behavior of notrust changed between versions 4.1 and 4.2.

In 4.1 (and earlier) notrust meant "Don't trust this host/subnet for time".

In 4.2 (and later) notrust means "Ignore all NTP packets that are not cryptographically authenticated." This forces remote time servers to authenticate themselves to your (client) ntpd

远程ntp是必须加密的,这一点有待研究,但是本地测试,先将这个关闭掉即可。

解决:

将你在ntp服务器配置文件指定访问客户ip的限制条件notrust去掉。


修改为:



  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值