1、下载ntpd服务,且关闭该服务和开机自启动
yum install -y ntp
systemctl stop ntpd
systemctl disable ntpd
2、修改ntp配置文件 ( vim /etc/ntp.conf )
2、1注释这下四行 #server 0.centos.pool.ntp.org iburst 不使用其他网络时间
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
2.2 打开下列注释的行,允许192.168.233.xx全网段机器使用同步时间
restrict 192.168.233.0 mask 255.255.255.0 nomodify notrap
3、添加下列两行,采用本地系统时间作为同步时间
server 127.127.1.0
fudge 127.127.1.0 stratum 10
4、修改ntpd文件 ( vim /etc/sysconfig/ntpd ) 添加以下内容,
#硬件时间与系统时间统一
SYNC_HWCLOCK=yes
5、启动ntpd服务,且开启开机自启
systemctl start ntpd
systemctl enable ntpd
6.其他系统设置定时任务 每一分钟从目标机器(192.168.233.111) 同步时间
crontab -e
*/1 * * * * /usr/sbin/ntpdate 192.168.233.111
博客介绍了NTPD服务的配置及时间同步设置。先下载并关闭ntpd服务及开机自启,修改ntp和ntpd配置文件,采用本地系统时间同步;之后启动ntpd服务并开启开机自启;最后设置其他系统定时任务,每分钟从目标机器同步时间。
1511

被折叠的 条评论
为什么被折叠?



