阅读目录
# yum install chrony -y# systemctl enable chronyd.service # systemctl restart chronyd.service # systemctl status chronyd.service
新增AI编程课程,引领技术教育新趋势
阅读目录
# yum install chrony -y# systemctl enable chronyd.service # systemctl restart chronyd.service # systemctl status chronyd.service
在防火墙内放行,因NTP使用123/UDP端口协议,所以允许NTP服务即可。(如果已关闭防火墙请无视)
# firewall-cmd --add-service=ntp --permanent # firewall-cmd --reload
# timedatectl Local time: Fri 2018-2-29 13:31:04 CST Universal time: Fri 2018-2-29 05:31:04 UTC RTC time: Fri 2018-2-29 08:17:20 Time zone: Asia/Shanghai (CST, +0800) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a #如果你当前的时区不正确,请按照以下操作设置。#查看所有可用的时区:# timedatectl list-timezones#筛选式查看在亚洲S开的上海可用时区:# timedatectl list-timezones | grep -E "Asia/S.*" Asia/Sakhalin Asia/Samarkand Asia/Seoul Asia/Shanghai Asia/Singapore Asia/Srednekolymsk #设置当前系统为Asia/Shanghai上海时区:# timedatectl set-timezone Asia/Shanghai#设置完时区后,强制同步下系统时钟:# chronyc -a makestep200 OK
此处选用的是阿里云的ntp服务server,地址为
ntp1.aliyun.com
当前是Master,ip地址为192.168.26.135,网段是192.168.26.0/24,配置详情如下,红色为更改部分
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). # server 0.centos.pool.ntp.org iburst