2021/3/27-时间同步

1作为server端:表明给哪个段的提供时间同步服务

vim /etc/chrony.conf 

# Allow NTP client access from local network.
allow 10.16.81.0/25

# Serve time even if not synchronized to a time source.
local stratum 10

2作为客户端: 指明master

2.1 可以是用chronyd

[root@sck8swork01 system]# grep -v ^$ /etc/chrony.conf |grep -v ^#
server sck8smaster01 iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
logdir /var/log/chrony

客户端使用chronyc sources -v命令完成同步即可 

2.2 可以使用ntp服务 reference:  https://www.cnblogs.com/linypwb/p/5532535.html 

[root@linl_S ~]# vi /etc/ntp.conf 
2 # Use public servers from the pool.ntp.org project.
3 # Please consider joining the pool (http://www.pool.ntp.org/join.html).
4 server 0.rhel.pool.ntp.org iburst       #找一个可以使用的NTP时间服务器
5 server 1.rhel.pool.ntp.org iburst
1 [root@linl_C ~]# ntpdate 0.rhel.pool.ntp.org
另外: https://www.cnblogs.com/sky-heaven/p/5220873.html
hwclock –r         显示硬件时钟与日期

hwclock –s         将系统时钟调整为与目前的硬件时钟一致。

hwclock –w        将硬件时钟调整为与目前的系统时钟一致。

3flatcar 写在配置写在最初的user文件里面

cat /etc/systemd/timesyncd.conf
[Time]
NTP=172.16.72.21 172.16.72.22 172.16.72.23

systemd-timesyncd.service  


posted @ 2021-03-27 14:54  FengR  阅读(129)  评论(0编辑  收藏  举报