多centos7系统时间同步配置

博客介绍了NTPD服务的配置及时间同步设置。先下载并关闭ntpd服务及开机自启,修改ntp和ntpd配置文件,采用本地系统时间同步;之后启动ntpd服务并开启开机自启;最后设置其他系统定时任务,每分钟从目标机器同步时间。

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
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值