当前位置: 首页 > Linux

centos8使用chrony作为NTP服务器

时间:2023-04-06 22:22:30 Linux

Centos8不直接使用ntp,而是使用chrony作为时间同步,chrony可以作为服务器端广播时间,也可以作为客户端来同步时间centos8使用chrony作为NTP服务器centos8使用chrony作为NTP服务器安装sudodnfinstallchrony-ysudoyuminstallchrony-yCentos8使用firewalld服务来管理防火墙。释放ntp服务(123/udp)firewall-cmd--add-service=ntp--permanent&&firewall-cmd--reloadastheserverside配置chronyserversudovim/etc/chrony.conf删除NTP服务器自带配置。替换为国内阿里云的NTP服务器地址。添加上游NTP服务器servertime1.aliyun.comiburstservertime2.aliyun.comiburstservertime3.aliyun.comiburst允许192.168.1.0/24内的客户端通过此服务器获取时间allow192.168.1.0/24配置正确后,重新启动chrony服务并配置开机自启动:systemctlrestartchronyd.servicesystemctlenablechronyd.servicegrepchrony或lsof-i:123命令查看chrony服务使用的123/udp端口是否已经成功启动并安装为客户端,然后修改客户端chrony配置文件sudovim/etc/chrony.conf使用publicservers来自pool.ntp.org项目。请考虑加入池(http://www.pool.ntp.org/join....pool2.centos.pool.ntp.orgiburstaddNTPserverservertime1.aliyun.comiburstservertime2.aliyun.comiburstservertime3.aliyun.com如果iburst有自建chrony客户端,也可以配置server192.168.1.30iburst重启chrony客户端服务,重启chrony服务,配置自启动在boot:systemctlrestartchronyd.service&&systemctlenablechronyd.service--now查看同步状态chronycsources-v