主:
# yum install -y ntp ntpdate # cat /etc/ntp.conf driftfile /var/lib/ntp/drift restrict default nomodify notrap nopeer noquery restrict 127.0.0.1 restrict ::1 server ntp1.aliyun.com iburst includefile /etc/ntp/crypto/pw keys /etc/ntp/keys disable monitor # systemctl start ntpd # ntpq -p
# timedatectl
从:
# yum install -y ntp ntpdate # cat /etc/ntp.conf driftfile /var/lib/ntp/drift restrict default nomodify notrap nopeer noquery restrict 127.0.0.1 restrict ::1 server 主IP iburst includefile /etc/ntp/crypto/pw keys /etc/ntp/keys disable monitor # systemctl start ntpd # ntpq -p # timedatectl
同步没成功:
# timedatectl status
Local time: Tue 2022-04-26 21:46:24 CST
Universal time: Tue 2022-04-26 13:46:24 UTC
RTC time: Tue 2022-04-26 13:45:13
Time zone: Asia/Shanghai (CST, +0800)
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
解决:
# systemctl stop ntpd # ntpd -gq ntpd: time slew +0.000041s # systemctl start ntpd 等待一会儿后,NTP synchronized恢复成yes: # timedatectl
作者:陈耿聪 —— 夕狱
出处:https://www.cnblogs.com/CGCong/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。