关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

云服务器Chrony:配置 NTP 服务器

发布时间:2024/5/22 14:14:57
香港云服务器

chronyc命令来自英文词组chrony command-line的缩写,其功能是设置时间与时间服务器同步。chrony是一个用于保持系统时间与NTP时间服务器同步的服务,其守护进程chronyd更为常见,而chronyc命令则是用户的配置工具。

 

1、安装与配置

yum -y install chrony

 

systemctl enable chronyd

systemctl start chronyd

 

vim /etc/chrony.conf

# 第 3 行:更改同步

服务器 #服务器 0.centos.pool.ntp.org iburst

#服务器 1.centos.pool.ntp.org iburst

#服务器 2.centos.pool.ntp.org iburst

#服务器 3.centos.pool.ntp.org iburst

服务器 ntp1.jst.mfeed.ad.jp iburst

服务器 ntp2.jst.mfeed.ad.jp iburst

服务器 ntp3.jst.mfeed.ad.jp iburst

 

# 第 25 行:添加允许接收请求

的网络范围 allow 10.0.0.0/24

 

2、如果 Firewalld 正在运行,请允许 NTP 服务。NTP 使用 123/UDP。

[root@dlp ~]# firewall-cmd --add-service=ntp --永久

成功

[root@dlp ~]# firewall-cmd --重新加载

成功

 

3、验证其正常工作,如下所示。

[root@dlp ~]# chronyc 源

210 Number of sources = 3

MS Name/IP address         Stratum Poll Reach LastRx Last sample

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

^+ ntp1.jst.mfeed.ad.jp          2   6    17     8  -1028us[-1261us] +/-   14ms

^* ntp2.jst.mfeed.ad.jp          2   6    17     8  -1241us[-1474us] +/-   15ms

^? ntp3.jst.mfeed.ad.jp          0   6     0   10y     +0ns[   +0ns] +/-    0ns