NTP设置

NTP服务器配置

服务器的配置文件/etc/ntp.conf

注释server域名配置
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

设置本机为ntp服务端
server 127.127.1.0
fudge 127.127.1.0 stratum 10

NTP客户端配置

客户端的配置文件/etc/ntp.conf设置服务器信息

server 服务端主机名 

NTP服务自动停止

systemctl status ntpd

Apr 28 11:50:08 jianghuihui02 ntpd[6145]: 0.0.0.0 c617 07 panic_stop -2510 s; set clock manually within 1000 s.
Apr 28 11:50:08 jianghuihui02 systemd[1]: ntpd.service: main process exited, code=exited, status=255/n/a
Apr 28 11:50:08 jianghuihui02 systemd[1]: Unit ntpd.service entered failed state.
Apr 28 11:50:08 jianghuihui02 systemd[1]: ntpd.service failed.
客户端的时间与服务端的时间超过1000s,那么ntp进程就会退出并在系统日志文件中记录。

解决方法:
在配置文件/etc/ntp.conf中增加一行:

tinker  panic  0
使ntp在时间差较大时依然工作

查看ntp同步情况

命令: ntpq -p
在这里插入图片描述

查看主机硬件时间

查看硬件时间:hwclock

将硬件时间同步到系统时间:hwclock -s

将系统时间同步到硬件时间:hwclock -w

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值