Chinaunix首页 | 论坛 | 博客
  • 博客访问: 397915
  • 博文数量: 100
  • 博客积分: 3893
  • 博客等级: 中校
  • 技术积分: 1040
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-11 13:50
文章分类

全部博文(100)

文章存档

2013年(2)

2012年(3)

2011年(8)

2010年(38)

2009年(40)

2008年(9)

我的朋友

分类: LINUX

2011-04-29 12:25:57

服务器:
编辑 /etc/ntp.conf

首先你可以去ntp.org上找到哪些ntp服务器离你较近



ntp.conf

#############################################################################################

server clock.tl.fukuoka-u.ac.jp #校对服务器1

server clock.uregina.ca

server swisstime.ethz.ch

server ntp0.fau.de # 比较多的服务器可以防止因为网络故障导致无法校对时间

server 127.127.1.1 #这行可删除

fudge 127.127.1.1 stratum 10 #同上

driftfile /etc/ntp/drift #/etc/ntp/drift 可能是ntp.drift 这无所谓,看你的版本号



restrict clock.tl.fukuoka-u.ac.jp

restrict clock.cuhk.edu.hk

restrict swisstime.ethz.ch

restrict ntp0.fau.de

restrict 127.0.0.1

restrict 192.168.x.y #x.y为自己的IP

restrict 192.168.x.x mask 255.255.255.0 nomodify #让x网段的机器都能访问自己,进行时间校对

#restrict default ignore #这行删除或注释都可以

#############################################################################################



#/sbin/service ntpd start //启动ntpd 参数可为restart start stop

#/sbin/chkconfig --add ntpd

#/sbin/chkconfig --level 234 ntpd on //配置在开机时运行

客户端:
编辑 /etc/ntp.conf



ntp.conf

#############################################################################################



server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10



server stdtime.gov.hk # A stratum 1 server at server.org

server 192.168.x.y #x.y为你前面所装机器在局域网里的IP

driftfile /etc/ntp/drift

broadcastdelay 0.008

authenticate no

keys /etc/ntp/keys



restrict 192.168.x.0 mask 255.255.255.0 notrust nomodify notrap//x.0为你所在局域网段

restrict 127.0.0.1

restrict 192.168.x.y #x.y为你前面所装机器在局域网里的IP

#restrict default ignore

#############################################################################################



同时配置

#/sbin/service ntpd start //启动ntpd 参数可为restart start stop

#/sbin/chkconfig --add ntpd

#/sbin/chkconfig --level 234 ntpd on //配置在开机时运行



如何检查?



#netstat -unl | grep 123 //查看123端口



#ndptrace 192.168.x.y //看校对时间过程,出现offset即为正常 否则为time out



# ntpq -p



如果出现 jitter的值 为4000则是防火墙或者网络问题



正常为

remote refid st t when poll reach delay offset jitter

==============================================================================

*clock.nc.fukuok .GPS. 1 u 43 64 37 19.067 -6.884 10.339

+clock.tl.fukuok .GPS. 1 u 36 64 35 19.670 -3.259 2.341

LOCAL(0) LOCAL(0) 5 l 45 64 37 0.000 0.000 0.001
阅读(814) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~