NTP服务器配置

1、经常使用的NTP服务器IPvim

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 北京邮电大学服务器

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

# 容许内网其余机器同步时间
 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

五、开启ntp服务,并查看商品
/etc/init.d/ntpd start
netstat -atunlp | grep ntp
六、查看时间同步状态 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 srest

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

#client ntp sync to ntp server 192.168.239.133server

          • /usr/sbin/ntpdate -u 192.168.239.133 >/dev/null 2>&1
相关文章
相关标签/搜索