加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux配置ntp时间同步

发布时间:2020-12-13 23:48:32 所属栏目:Linux 来源:网络整理
导读:一、安装ntf yum –y ×××tall ntp 二、配置ntp服务 1)修改所有节点的/etc/ntp.conf vi /etc/ntp.conf restrict 172.18.74.59 nomodify notrap nopeer noquery //当前节点IP地址 restrict 172.18.74.253 mask 255.255.255.0 nomodify notrap //集群所在网
一、安装ntf

yum –y ×××tall ntp

二、配置ntp服务
1)修改所有节点的/etc/ntp.conf

vi /etc/ntp.conf
restrict 172.18.74.59 nomodify notrap nopeer noquery //当前节点IP地址
restrict 172.18.74.253 mask 255.255.255.0 nomodify notrap //集群所在网段的网关(Gateway),子网掩码(Genmask)

2)修改主节点/etc/ntp.conf

vi /etc/ntp.conf

在server部分添加一下部分,并注释掉server 0 ~ n

server 127.127.1.0
fudge 127.127.1.0 stratum 10

3)主节点以外,继续修改/etc/ntp.conf

vi /etc/ntp.conf

在server部分添加如下语句,将server指向主节点。

server 172.18.74.39
Fudge 172.18.74.39 stratum 10

三、启动ntp服务、查看状态
1)启动ntp服务

service ntpd start

2)查看ntp服务器有无和上层ntp连通

ntpstat

3)查看ntp服务器与上层ntp的状态

ntpq -p

四、设置开机启动

chkconfig ntpd on

查看从ntp服务状态可能会有如下错误inappropriate address 172.18.74.119 for the fudge command,line ignored经测试改了fudge的首字母为F就可以修复上述错误,看网上也都是小写的,很奇怪。几分钟后查看主从ntp主机的时间就同步了,同步较慢稍等即可。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读