无外网集群内部做NTP时钟同步

环境说明
NTP服务端:Rich63.cn IP:192.168.1.63
NTP客户端:Rich64.cn IP:192.168.1.64
操作系统版本:CentOS Linux release 7.5.1804 (Core)

服务端安装配置NTP

yum install ntp ntpdate -y

修改配置文件,使该NTP服务器在不联网的情况下,使用本服务器的时间作为同步时间

vim /etc/ntp.conf # 编辑配置文件,注释掉以下4行

#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

server 127.127.1.0 iburst # 配置文件内添加此行

wq保存退出!

启动ntp服务

systemctl start ntpd

验证状态

systemctl status ntpd

设置开机自启动

systemctl enable ntpd

验证ntp

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

配置客户端

安装与服务端一致,只是配置文件修改不一样

#注释掉其他上游时间服务器

#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

#配置上游时间服务器为本地的ntpd Server服务器
server 192.168.1.63

#配置允许上游时间服务器主动修改本机的时间
restrict 192.168.1.63 nomodify notrap noquery

然后初次同步需要手动同步
ntpdate -u 192.168.1.63

然后设置客户端ntp服务开机自启动即可
systemctl enable ntpd

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值