centos7 配置ntp内网时间同步

服务端配置

安装ntp服务  

yum  -y  install  ntp

修改配置文件

vim /etc/ntp.conf

#添加可访问网段
restrict  10.9.103.0 mask 255.255.255.0 nomodify notrap
#添加本地作为时间服务器供其他服务器同步
server 127.127.1.0
fudge 127.127.1.0 stratum 10

 启动服务

systemctl start ntpd
#开机启动
systemctl enable ntpd

 客户端配置

 添加定时任务

crontab  -e
#加入
*/5 * * * *  /usr/bin/ntpdate -u  <服务端IP>
posted @ 2021-12-23 13:28  记忆抹不去  阅读(280)  评论(0编辑  收藏  举报