NTP

简介

NTP 是网络时间协议 (Network Time Protocol),它是用来同步网络中各个计算机的时间的协议。

配置方法

Linux 服务器上快速配置阿里巴巴 OPSX NTP服务

编辑文件 "/etc/ntp.conf",根据情况修改文件内容为:

  • 互联网上的服务器:
driftfile  /var/lib/ntp/drift
pidfile   /var/run/ntpd.pid
logfile /var/log/ntp.log
restrict    default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
server 127.127.1.0
fudge  127.127.1.0 stratum 10
server ntp.aliyun.com iburst minpoll 4 maxpoll 10
restrict ntp.aliyun.com nomodify notrap nopeer noquery


  • 阿里云 ECS 服务器:
driftfile  /var/lib/ntp/drift
pidfile   /var/run/ntpd.pid
logfile /var/log/ntp.log
restrict    default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
server 127.127.1.0
fudge  127.127.1.0 stratum 10
server ntp.aliyun.com iburst minpoll 4 maxpoll 10
restrict ntp.aliyun.com nomodify notrap nopeer noquery

server ntp1.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
restrict ntp1.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp2.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
restrict ntp2.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp3.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
restrict ntp3.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp4.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
restrict ntp4.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp5.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
restrict ntp5.cloud.aliyuncs.com nomodify notrap nopeer noquery
server ntp6.cloud.aliyuncs.com iburst minpoll 4 maxpoll 10
restrict ntp6.cloud.aliyuncs.com nomodify notrap nopeer noquery
  • 对于使用 chrony 客户端的 linux 主机

配置 '/etc/chrony.conf' 文件的内容为:

server ntp.aliyun.com iburst
stratumweight 0
driftfile /var/lib/chrony/drift
rtcsync
makestep 10 3
bindcmdaddress 127.0.0.1
bindcmdaddress ::1
keyfile /etc/chrony.keys
commandkey 1
generatecommandkey
logchange 0.5
logdir /var/log/chrony

特别声明:本镜像站内容来自第三方网站,阿里云会尽力审核镜像内容安全,但无法保证其完全合规,请您在下载前慎重考虑。具体请查看《阿里云开发者社区用户服务协议》、《阿里云镜像站特别条款》等。 如您发现镜像站有任何问题,可以填写镜像站投诉表单举报,我们将按照法律规定尽快进行处理。

推荐关注:
· 手慢无!云服务器免费领取,实时计算净省3258元 · 每周二看直播,学最新阿里开源技术

评论

登录后可评论
头像
南海浪涛
2023-05-29发布于 重庆
一直有个疑问,ntp.aliyun.com和time1.aliyun.com那7组NTP地址有什么不同?
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
ntp.aliyun.com. 597 IN A 203.107.6.88 ntp2.aliyun.com. 600 IN CNAME ntp.aliyun.com. ntp.aliyun.com. 600 IN A 203.107.6.88 ntp1.aliyun.com. 600 IN A 120.25.115.20 也就是说只有两个server可以用? ntp的文档要求是 至少4个啊。。。能否多加两个啊?
Shape Created with Sketch. Combined Shape Created with Sketch. 1
2022-09-05
还有ntp1.aliyun.com,ntp2.aliyun.com,ntp2.aliyun.com,……
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
ntpdate ntp.aliyun.com
游客zhno4rs6i6mj2、游客hynjia4onklv2、zctmdc、游客z2xkwwbnlcqyw、1711740308832385觉得很赞
Shape Created with Sketch. 9 Combined Shape Created with Sketch.
头像
大黄蜂coder
2020-04-13
ntpdate[3546]: no server suitable for synchronization found
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
windows 服务器能配这个时间源吗?
Shape Created with Sketch. Combined Shape Created with Sketch. 1
2020-04-21
可以,正在用着
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
小樱
2019-12-10
设置好后怎么用啊?用什么命令自动化同步? ntp2这些服务器没用了吗? https://help.aliyun.com/document_detail/92704.html
Shape Created with Sketch. Combined Shape Created with Sketch.
头像
斯东仁
2019-12-09
132
Shape Created with Sketch. Combined Shape Created with Sketch.
镜像站 + 订阅

阿里巴巴镜像站技术社区

域名使用规则
  • 公网访问地址:

    https://mirrors.aliyun.com/

  • ECS VPC网络访问地址:

    http://mirrors.cloud.aliyuncs.com/

  • ECS 经典网络访问地址:

    http://mirrors.aliyuncs.com/

对于镜像有任何问题,欢迎给我们提问题!
立即提问
热门体验场景
AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等