centos8内网环境下搭本地时间服务器

CentOS7时,使用的是ntpdate命令来同步时间,所以需要配合定时任务,来定时执行命令,CentOS8则不需要。

centos7+ 支持chrony时间同步配置,ntpdate在centos8上已经不再支持了
chrony相比ntp时间同步配置更简单,更高效
timedatectl 是 centos7+上的一个时间客户端工具
服务器上没有chrony的可以使用 yum -y install chrony 进行安装

 

服务端

可连接外网

vim /etc/chrony.conf

 

 然后对防火墙进行设置策略,允许服务的通行

firewall-cmd --permanent --add-service=ntp

firewall-cmd --reload

firewall-cmd --permanent --remove-service=chrony

 

重启

systemctl restart chronyd.service

 

客户端

(不可联网 需要做代理  yum下载chrony)

vim /etc/chrony.conf

 

 server 192.168.0.123 iburst

 

重启

systemctl restart chronyd.service

 

date显示成功

posted @ 2022-05-30 17:14  奋斗!奋斗!  阅读(243)  评论(0编辑  收藏  举报