Nov 21

[原]解决ntpd的Invalid argument问题 晴

linuxing , 13:02 , 基础知识 » 故障处理 , 评论(0) , 引用(0) , 阅读(23595) , Via 本站原创 | |
   这又是一个从php-syslog-ng找出来的报错信息。如果没有它,估计我不会发现使用了这么久的ntp有报错。信息如下:
引用
ntpd[3775]: sendto(61.153.197.226): Invalid argument

一、原因
从这里可以找到原因:点击
描述:
引用
6.11. How dynamic IP addresses affect ntpd
Currently, ntpd does not rescan the network interfaces after it has started. If you are have a dynamic IP (use DHCP), this means ntpd will no longer be able to communicate with "outside" sources after your IP changes.

也就是说,若我搭建的ntpd服务器基于动态IP(例如ADSL)。当地址改变的时候,ntpd并不能通过该新地址和外部的时间服务器同步,而出现上面的错误。

二、解决
在每次IP发生变化的时候,重启ntpd服务即可:
# service ntpd restart

确认没问题后,可把命令加入/etc/ppp/ip-up.local中,让每次ADSL拨号后都自动运行:
# vi /etc/ppp/ip-up.local

内容是:
引用
#!/bin/bash
service ntpd status && service ntpd restart

结果:
点击在新窗口中浏览此图片

◎另一个方法就是,把ntpd服务器放在内网中,使用固定的IP地址,这样即使ADSL端的IP发生变化,也不会产生问题。

三、参考资料
Bug 51
http://lists.ntp.isc.org/pipermail/questions/2005-August/006333.html
http://www.redhat.com/archives/fedora-test-list/2006-November/msg00380.html
http://www.webservertalk.com/archive212-2005-8-1165413.html
Tags:
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]