NTP安装配置

(一)确认ntp的安装

1)查询各Linux服务器上是否安装了NTP

rpm -qa | grep ntp

说明:若只有ntpdate而未见ntp,则需删除原有ntpdate。如:
ntpdate-4.2.6p5-22.el7_0.x86_64
fontpackages-filesystem-1.44-8.el7.noarch
python-ntplib-0.3.2-1.el7.noarch
ntp-4.2.6p5-28.el7.centos.x86_64

2)卸载NTP:

sudo rpm -e --nodeps ntpdate-4.2.6p5-22.el7_0.x86_64
sudo rpm -e --nodeps ntp-4.2.6p5-28.el7.centos.x86_64

3)重新安装NTP

sudo yum –y install ntp

(二)配置ntp服务

sudo vim /etc/ntp.conf

1)主节点内容

内容1:
restrict 192.168.6.3 nomodify notrap nopeer noquery #当前节点IP地址

内容2:
restrict 192.168.6.2 mask 255.255.255.0 nomodify notrap #集群所在网段的网关(Gateway),子网掩码(Genmask)

内容3:注释掉server 0 ~ n,在server部分添加以下部分内容:
server 127.127.1.0
Fudge 127.127.1.0 stratum 10

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

内容1:
restrict 192.168.6.3 nomodify notrap nopeer noquery #当前节点IP地址

内容2:
restrict 192.168.6.2 mask 255.255.255.0 nomodify notrap #集群所在网段的网关(Gateway),子网掩码(Genmask)

内容3:注释掉server 0 ~ n,在server部分添加以下部分内容:
server 192.168.6.3 ##这是主机的ip地址
Fudge 192.168.6.3 stratum 10

(三)ntp服务的开启、查看及授时

1)启动ntp服务,每个节点机器上都启动

service ntpd start

或使用

systemctl start ntpd.service

2)查看ntp服务器有无和上层ntp连通,启动可能会很慢,需要等一会,才能看到正确的状态

ntpstat

3)授时,服务器时间同步

待续

具体参看:

Linux配置ntp时间服务器(全)
https://blog.youkuaiyun.com/With__Sunshine/article/details/91358874

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值