1、使用场景:最少有一台服务器可以上外网,其他服务器不可以上外网。
2、服务端安装
yum -y install ntp ntpdate ntpdate 0.asia.pool.ntp.org hwclock --systohc systemctl enable ntpd systemctl start ntpd 配置ntp文件 vim /etc/ntp.conf driftfile /var/lib/ntp/drift restrict default nomodify notrap nopeer noquery restrict 127.0.0.1 restrict ::1允许内网其他机器同步时间 restrict 192.168.206.0 mask 255.255.255.0 nomodify notr 定义使用的上游 ntp服务器,将原来的注释server 0.asia.pool.ntp.org 定义使用的上游 ntp服务器,将原来的注释 restrict 0.asia.pool.ntp.org nomodify notrap noquery 定义使用的上游 ntp服务器,将原来的注释server 127.127.1.0fudge 127.127.1.0 stratum 10includefile /etc/ntp/crypto/pwkeys /etc/ntp/keys
ntpq -p 显示节点列表
3、客户端部署
将服务端/usr/sbin/ntpdate文件复制到客户端/usr/sbin/目录下
编写同步文件vim /usr/local/sbin/ntpdate.sh
ntpdate -u 172.16.90.37hwclock --systohc
crontab -e 编写定时任务
Copyright © 2017-2021 All Rights Reserved. 那片云 深圳市那片云网络科技有限公司 粤ICP备17068046号
《中华人民共和国增值电信业务经营许可证》