Chinaunix首页 | 论坛 | 博客
  • 博客访问: 240847
  • 博文数量: 115
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 930
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-30 05:27
文章分类

全部博文(115)

文章存档

2011年(10)

2010年(21)

2009年(19)

2008年(65)

我的朋友

分类:

2008-03-05 18:08:13

1、为稳定起见,配置成C/S结构。无论服务器和客户端,都只需要建立配置文件/etc/inet/ntp.conf即可。
2、服务器端配置
2.1 创建/etc/inet/ntp.conf
2.2 修改/etc/inet/ntp.conf文件如下格式:
server 127.127.1.0 prefer
fudge 127.127.1.0 stratum 0

driftfile /var/ntp/ntp.drift
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable
2.3 修改S74xntpd
在/etc/rc2.d/S74xntpd文件中,修改有/usr/lib/inet/xntpd的两行,在/usr/lib/linet/xntpd后添加 -l /var/ntp/ntp.log
两行变为:
(/usr/sbin/ntpdate $ARGS; sleep 2; /usr/lib/inet/xntpd -l /var/ntp/ntp.log) &

/usr/lib/inet/xntpd -l /var/ntp/ntp.log
2.4 重起xntp进程,方法如下:
#/etc/rc2.d/S74xntpd  stop
#/etc/rc2.d/S74xntpd  start
3、客户端配置
3.1 创建/etc/inet/ntp.conf
3.2 了解服务器的IP地址
3.3 修改/etc/inet/ntp.conf为如下格式:
#请将SERVER-IP替换成真正的ntp的Server
peer SERVER-IP
server  SERVER-IP
fudge SERVER-IP stratum 0
driftfile /var/ntp/ntp.drift
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable
3.4 修改S74xntpd
在/etc/rc2.d/S74xntpd文件中,修改有/usr/lib/inet/xntpd的两行,在/usr/lib/linet/xntpd后添加 -l /var/ntp/ntp.log
两行变为:
(/usr/sbin/ntpdate $ARGS; sleep 2; /usr/lib/inet/xntpd -l /var/ntp/ntp.log) &

/usr/lib/inet/xntpd -l /var/ntp/ntp.log &
3.5 重起ntp进程
#/etc/rc2.d/S74xntpd  stop
#/etc/rc2.d/S74xntpd  start
4、验证方法
4.1 服务器验证
Ntp进程重起以后等十分钟,运行ntpq –p,显示类似如下:
#ntpq  -p
remote     refid      st t  when poll reach   delay   offset    disp
=====================================================
*LOCAL(0)  .LCL.    0 l   51   64  377     0.00    .000   10.03
在LOCAL前看到*号即成功。
4.2 客户端验证
Ntp进程重起以后等待十分钟,运行ntpa –p,显示类似如下:
#ntpq  -p
remote         refid          st t when poll  reach  delay  offset  disp
====================================================
*SERVER-IP   .LCL.         1 u  591 1024  377  0.66    0.086    0.14
在SERVER-IP前面显示*为客户端同步正常
无论服务器端还是客户端的ntp -q显示结果,reach值代表是否与服务器端有连接,这个数值一直增大,则基本可以判定连接正常,同时,disp值也会逐渐变小。
先起服务器端服务,待服务器端确认正常后,再起客户端服务。服务器启动和时间同步都需要比较长的一段时间,请耐心等待。
5 FAQ
修改系统时间的命令
#date mmddHHMM
如date 03311651表示修改事件到3月31号16点51分 
阅读(3666) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~