内网ntp时间同步
时间服务器下载ntp
yum -y install ntp
修改配置文件
/etc/ntp.conf
#restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
restrict default nomodify
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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 10.170.130.79
server 127.127.1.0
fudge 127.127.1.0 stratum 10
启动ntp服务
systemctl start ntpd
systemctl enable ntpd
在其他服务器上安装ntpdate
yum -y install ntpdate
修改配置文件
/etc/ntp.conf
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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 10.170.130.79
命令行同步一下
ntpdate 10.170.130.79
设置定时任务
crontab -e
*/30 * * * * /usr/sbin/ntpdate 10.170.130.79
如果开启防火墙
firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload