linux 下ntp 服务的配置

ntp服务分server跟client,现场四台服务器,选择一台作为server端,其他三台做client端,例如18.2.4.4为ntpServer,其他服务器为ntpClient


ntpServer端
1.ssh登录服务器,进入/etc目录下,建议先将ntp.conf文件备份,再修改ntp.conf文件,只保留以下内容
server  127.127.1.0
fudge 127.127.1.0 stratum 8
restrict 18.2.4.0 mask 255.255.254.0 nomodify notrap   #允许的网段


2.执行service ntpd restart重启ntp服务


3.执行chkconfig --level 345 ntpd on,让ntp服务可以随系统启动


ntpClient端
1.待ntpServer端重启完,大约5-10分钟后,执行ntpdate ntpServerIp(这里写ntpServer的ip地址),出现类似下面的情况说明同步成功
----------------------
[root@hscbu-tx39 ~]# ntpdate 18.2.4.4
31 Dec 11:14:50 ntpdate[16457]: step time server 18.2.4.4 offset 1622240.103462 sec
----------------------
2.在ntpClient端加入系统定时任务
[root@hscbu-tx39 ~]# crontab -e
1 * * * * /usr/sbin/ntpdate 18.2.4.4


3.其他ntpClient同样的操作
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值