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

无外网集群内部做NTP时钟同步,第1张

无外网集群内部做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

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5706341.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-18

发表评论

登录后才能评论

评论列表(0条)

保存