码迷,mamicode.com
首页 > 其他好文 > 详细

NTP服务器配置

时间:2018-04-06 20:25:56      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:NTP   服务器   配置   

一、常用的NTP服务器IP

210.72.145.44 (国家授时中心服务器IP地址)
202.112.10.36 # 1.cn.pool.ntp.org
59.124.196.83 # 0.asia.pool.ntp.org
s2m.time.edu.cn 北京大学
s2c.time.edu.cn 北京邮电大学

二、搭建NTP服务器
NTP服务端配置步骤如下
1、安装ntp
yum -y install ntp
2、开机启动
chkconfig ntpd on
chkconfig --list ntpd
3、先手工同步下时间
ntpdate -u 210.112.145.44
4、配置ntpd主配置文件ntp.conf
vim /etc/ntp.conf 增加如下内容

 # 允许内网其他机器同步时间
 restrict 192.168.239.0 mask 255.255.255.0 nomodify notrap

 # 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cn
 server 210.72.145.44 perfer   # 中国国家受时中心
 server 202.112.10.36             # 1.cn.pool.ntp.org
 server 59.124.196.83             # 0.asia.pool.ntp.org

 # allow update time by the upper server 
 # 允许上层时间服务器主动修改本机时间
 restrict 210.72.145.44 nomodify notrap noquery
 restrict 202.112.10.36 nomodify notrap noquery
 restrict 59.124.196.83 nomodify notrap noquery

 # 外部时间服务器不可用时,以本地时间作为时间服务
 server  127.127.1.0     # local clock
 fudge   127.127.1.0 stratum 10

5、开启ntp服务,并查看商品
/etc/init.d/ntpd start
netstat -atunlp | grep ntp
6、查看时间同步状态 ntpstat (表示本地时间服务器已经和外网的NTP服务同步上了)
[root@localhost ~]# ntpstat
synchronised to NTP server (202.112.10.36) at stratum 6
time correct to within 1171 ms
polling server every 64 s

三、NTP客户端配置步骤
只需要建立一条计划任务就OK
crontab -e 加入如下两条内容。 (每分钟同步一次)

#client ntp sync to ntp server 192.168.239.133

          • /usr/sbin/ntpdate -u 192.168.239.133 >/dev/null 2>&1

NTP服务器配置

标签:NTP   服务器   配置   

原文地址:http://blog.51cto.com/2179600/2095255

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!