首页 > 其他 > 详细

CentOS之NTP服务器配置

时间:2017-07-20 16:55:24      阅读:289      评论:0      收藏:0      [点我收藏+]

一、服务器端配置
1.安装所需软件包
yum -y install ntp ntpdate
-------------------------------------------
2.编辑NTP主配置文件,修改如下:
vim /etc/ntp.conf
#允许192.168.244.0网段同步
restrict 192.168.244.0 mask 255.255.255.0 nomodify notrap
#注释如下几行
#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 s2m.time.edu.cn iburst
server 127.127.1.0 iburst    # local clock
--------------------------------------------
3.重启ntp服务
service ntpd restart
验证:
查看端口是否存在
netstat -tulnp | grep ntp
--------------------------------------------
4.设置开机自启动
chkconfig ntpd on
----------------------------------------------
5.查看现有连接客户端
watch ntpq -p
       remote           refid     st t when poll reach   delay   offset  jitter
==============================================================================
*LOCAL(0)        .LOCL.           5 l   46   64  377    0.000    0.000   0.000

------------------------------------------------
二、客户端配置:
1、命令行手动执行一次验证是否可用:
#ntpdate 192.168.244.20
   4 Dec 13:57:13 ntpdate[32277]: step time server 192.168.244.20 offset -24.396496 sec
2.配置自动同步
crontab -e
15 1 * * *        /usr/sbin/ntpdate 192.168.244.20; /sbin/hwclock -w
IP以自己服务端IP为准

CentOS之NTP服务器配置

原文:http://www.cnblogs.com/Oliver.net/p/7212009.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!