Ubuntu Forums和ubuntu下不能用ntp服务网络校时的讨论(links for 2007-09-30)

  • Ubuntu Forums

    Ubuntu is a complete Linux-based operating system, freely available with both community and professional support. By JOINING US today you can participate in our active and growing community.

    (tags: linux ubuntu forums 网站收藏)

  • Can't synchronize time with Internet servers - Ubuntu Forums

    I've read a few threads here about trying to get the system clock to sync with Internet servers, and they all seem to go into "nightmare territory" (by my definition). I don't know why this is... if it's not ready, maybe it shouldn't be an option ...

    (tags: linux ubuntu ntp)

Ubuntu下ADSL拨号成功后启动ntpdate网络校时和77个网络相关linux应用小技巧(links for 2007-09-29)

Ubuntu的网络校时怎么不起作用?

我在ubuntu下使用的是ADSL拨号上网,系统启动自动拨号连接。

昨天,我在ubuntu6.0.6下修改系统时间的时候发现可以使用网络校时(即ntp)。点击设置界面上的“立即同步”,系统时间就自动修正了。这个选项上面有一项“定期与internet服务器同步时钟”的选项,我勾选了,默认的服务器有”ntp.ubuntu.comt和127.127.1.0“,我又添加设置了另外两个ntp服务器为“cn.pool.ntp.org和hk.pool.ntp.org”,时区选的是“Asia/Chongqing”。在勾选的时候,系统要求安一个ntp的包,也按照提示安上了。确认后退出。

但是,我发现这个“定期与internet服务器同步时钟”没有起作用!我把时间故意修改成多一个小时,然后重新启动系统。时间还是我修改过的,没有被更正过来!那这个有什么作用呢?!我搜索有关ntp的网页(Linux架设网络校时服务器、Linux和windows操作系统网络校时(links for 2007-09-28)),查看了一下相关的文件。在ntp服务的日志里(/var/log/ntpstats),查看当天的记录,确实每隔一分钟就记录了一次,部分日志记录如下:

54372 35619.638 202.130.120.114 9014 -3596.757066134 0.112971837 0.001455873 3597.447984995
54372 35621.527 127.127.1.0 9014 0.000000000 0.000000000 0.000945000 0.000001907
54372 35622.606 218.75.4.130 9414 0.619085926 0.076016308 0.002438134 1359.704375162
54372 35625.011 91.189.94.145 9614 0.661968500 0.462467000 0.004347983 1359.715265621
54372 35683.702 202.130.120.114 9014 -3596.757066134 0.112971837 0.002246536 3330.589801081
54372 35685.672 218.75.4.130 9414 0.619085926 0.076016308 0.003047042 1922.914781665
54372 35687.585 127.127.1.0 9614 0.000000000 0.000000000 0.000990000 0.000001907
54372 35690.059 91.189.94.145 9014 0.661968500 0.462467000 0.005074957 1922.927712896

其中202.130.120.114(hk.pool.ntp.org)中反映出了一个小时的差异,127.127.1.0是本地的错误的时间中反映的是没有差异,而另外两个服务器却是不到1秒的差异(我猜测数据的第5列是时间差),明显是错的。不知是否这两台服务器当时不能连接?

从日志中看到,ntp系统发现了错误,却没有自动把系统的时间给纠正过来,不知是怎么一回事?是不是我在什么地方没做对?

根据我在前面搜索的资料和这篇文章Bug #48506 in ntp (Ubuntu): “Run ntpdate after ppp interface comes up”,我把原本是在/etc/network/if-up.d下的ntpdate和ntp-server两个文件拷贝到/etc/ppp/ip-up.d目录下,当系统启动后,错误的时间就自动纠正了。我估计前一个目录下的内容是网卡启动执行,后一个目录下的内容才是ADSL连接成功后执行。

根据我的理解,这个纠正是ntpdate 命令的功劳,并不是启动了ntp server的ntpd的功劳。而据文章Time Synchronisation with NTP的内容,ntp server的ntpd可以有规律的根据远程ntp服务器校正本地时间。而我的实验这个ntpd却是不起作用的。前面只拷贝那个ntpdate文件应该就行了。或者,自己写一个包含类似“ntpdate hk.pool.ntp.org”内容的文件放在里面也应该行。

这是怎么一回事?

Linux架设网络校时服务器、Linux和windows操作系统网络校时(links for 2007-09-28)