首页 > 技术文章 > centos7.x配置时间服务器(chrony)

jonnyan 2020-12-28 15:49 原文

1.服务端配置

[root@centos-151 ~]# yum install chrony
[root@centos-151 ~]# vim /etc/chrony.conf
# 添加如下1行
server s1b.time.edu.cn       iburst
# 解注释并修改如下2行
allow 192.168.46.0/24
local stratum 10
[root@centos-151 ~]# systemctl restart chronyd
[root@centos-151 ~]# netstat -tunlp |grep ch
udp        0      0 0.0.0.0:123             0.0.0.0:*                           21886/chronyd
udp        0      0 127.0.0.1:323           0.0.0.0:*                           21886/chronyd
udp6       0      0 ::1:323                 :::*                                21886/chronyd

2.客户端配置

[root@centos-158 ~]# yum install chrony
[root@centos-158 ~]# vim /etc/chrony.conf
# 添加行
server 192.168.46.151 iburst
# 删除其它server 行

[root@centos-158 ~]# systemctl restart chronyd

3.客户端测试

[root@centos-158 ~]# chronyc  sources  -V
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^? 192.168.46.151                0   8     0     -     +0ns[   +0ns] +/-    0ns
[root@centos-158 ~]# date
Mon Mar  5 09:59:02 CST 2018

4.window客户端配置

在 Windows 上,您可以在 PowerShell 或命令提示符下运行以下命令:

net stop w32time
w32tm /config /syncfromflags:manual /manualpeerlist:"192.168.46.151"
w32tm /config /reliable:yes
net start w32time

致谢

时间服务器
利用 Amazon Time Sync Service 保持时间同步

推荐阅读