Linux部署ntp时间服务器

安装ntp服务

yum -y install ntp

服务端配置

vim /etc/ntp.conf
 
restrict 172.16.1.61 nomodify notrap nopeer noquery          //当前节点IP地址
restrict 172.16.1.1 mask 255.255.255.0 nomodify notrap      //集群所在网段的网关,子网掩码
# 在server部分添加以下部分,并注释掉server
server 127.127.1.0
fudge 127.127.1.0 stratum 10

客户端配置

vim /etc/ntp.conf
 
restrict 172.16.1.7 nomodify notrap nopeer noquery          //当前节点IP地址
restrict 172.16.1.1 mask 255.255.255.0 nomodify notrap      //集群所在网段的网关,子网掩码
 
在server部分添加如下语句,将server指向主节点。
server 172.16.1.61
fudge 172.16.1.61 stratum 10

启用服务

service ntpd start
chkconfig ntpd on

客户端运行如下命令,与服务端实现同步

ntpdate -u 192.168.0.101

配置定时任务

crontab -e
* * * * * 	ntpdate -u 192.168.0.101  (星代表,分时日月周)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值