参考
ntp官网下载:http://www.ntp.org/downloads.html
安装配置NTP时间服务器:http://blog.sina.com.cn/s/blog_5369bee10100aysx.html
 
安装
下载软件:wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.6p5.tar.gz
tar zxvf ntp-4.2.6p5.tar.gz
cd ntp-4.2.6p5
./configure && make -j32 && make install
 
服务器配置(de79)
修改配置文件:vi /etc/ntp.conf
#权限设置
#restrict default nomodify notrap noquery                    #默认拒绝所有来源的任何访问
#restrict -6 default kod nomodify notrap nopeer noquery 
restrict 127.0.0.1      mask 255.0.0.0                      #开放本机的任何访问
restrict 192.168.0.0    mask 255.255.255.0 nomodify         #开放本网段的可查询访问
 
#上级时间服务器设置
server cn.pool.ntp.org prefer  #优先使用cn.pool.ntp.org和上级时间服务器同步.  cn.pool.ntp.org中国国家授时中心服务器地址.
 
#客户端认证
#keys /etc/ntp/keys
 
运行ntp
service ntpd start/stop/restart
chkconfig ntpd on
 
客户端配置
修改配置文件:vi /etc/ntp.conf
step1:/etc/ntpd.conf 写入 server [IP_Address] , 这里是192.168.2.79
step2:chkconfig ntpd on
step3:service ntpd start
 
 
注:
查看ntp的端口,应该看到123端口
netstat -unlnp
 
查看ntp服务器有无和上层连通
[root@S5 ~]# ntpstat
synchronised to NTP server () at stratum 2
time correct to within 74 ms
polling server every 128 s
注意:此命令出现上述synchronised结果比较慢,我的用了大概5分钟。
 
查看ntp服务器与上层间的联系
[root@S5 ~]# ntptrace -n 127.0.0.1
127.0.0.1: stratum 2, offset 0.064524, synch distance 0.121167
210.72.145.44: timed out, nothing received***Request timed out
 
查看ntp服务器与上层ntp服务器的状态
[root@S5 ~]# ntpq -p
其中,
remote - 本机和上层ntp的ip或主机名,“+”表示优先,“*”表示次优先
refid - 参考上一层ntp主机地址
st - stratum阶层
when - 多少秒前曾经同步过时间
poll - 下次更新在多少秒后
reach - 已经向上层ntp服务器要求更新的次数
delay - 网络延迟
offset - 时间补偿
jitter - 系统时间与bios时间差
 


来自为知笔记(Wiz)


posted on 2013-05-19 22:46  hustlijian  阅读(15944)  评论(0编辑  收藏  举报

无觅相关文章插件,快速提升流量