安装系统:redhat linux as 4
服务器配置:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

1、  创建/etc/ntp.conf文件,添加如下内容:
server          clepsydra.dec.com    # 外部时间服务器
driftfile       /etc/ntp.drift
2、  创建/etc/ntp.drift,建立一个空文件就成
3、  启动时间服务器:
#/etc/rc.d/init.d/ntpd start

 

客户端配置:

1、  同步时间
ntpdate 时间服务器地址
2、  加入crontab, 每天同步一次.
0       1       *       *       *       /usr/sbin/ntpdate 时间服务器地址
客户端启动时间同步要在服务器启动完后5-10分在启动客户端的时间同步。不然会报错。

 

时间更改
Date 月日时分年
注意这都是改 linux local clock,最后注意要执行 hwclock -w 把时间更新写入 bios/cmos 内硬体时钟

 

3.防火墙问题的话,送一句配置
iptables -t filter -A INPUT -p udp --destination-port 123 -j ACCEPT
也就是123 udp in 全部接受

服务器配置完成后启动

1种:可以在/etc/rc.d/init.d/ntpd 启动

2种:#/sbin/service ntpd start //启动ntpd 参数可为 restart start stop
#/sbin/chkconfig --add ntpd 
#/sbin/chkconfig --level 234 ntpd on //
配置在开机时运行 

检查:
netstat -an | grep 123
# 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