今天檢查機器時發現 /var/log/messages 裡面有一大堆 ntpd 的 "Invalid argument" 訊息,才想到前兩天把這兩台機器的 IP address 變更網段後,只有重啟 network 的 service,忘了把 ntpd 也重啟,幾天沒連線倒是在 log 檔多了一大票的錯誤訊息,以前這種訊息多半是在 ADSL 撥接 Dynamic IP 的 interface 上發生,因為有時撥接斷線後重新撥接,然後這個 interface 上的 IP address 通常就變動了,然後這個錯誤訊息就會發生囉,最簡單的解決方法就是把 ntpd 重啟一下吧~
首先看一下,這就是一直重複出現的訊息:
首先看一下,這就是一直重複出現的訊息:
[root@KHCBKPS01 ~]# tail -3 /var/log/messagesOK,現在將 ntpd 重啟吧:
Mar 18 10:18:47 KHCBKPS01 ntpd[5137]: sendto(10.15.25.13) (fd=21): Invalid argument
Mar 18 10:35:53 KHCBKPS01 ntpd[5137]: sendto(10.15.25.13) (fd=21): Invalid argument
Mar 18 10:52:58 KHCBKPS01 ntpd[5137]: sendto(10.15.25.13) (fd=21): Invalid argument
[root@KHCBKPS01 ~]# service ntpd restart在 restart ntpd 時順便看一下 log 檔:
Shutting down ntpd: [ OK ]
ntpd: Synchronizing with time server: [ OK ]
Starting ntpd: [ OK ]
[root@KHCBKPS01 ~]# tail -f /var/log/messages觀察一段時間,已經和 NTP server 同步了,發現 /var/log/messages 檔也不再出現 "Invalid argument" 訊息囉,既然講到 NTP,那就順便把跟 NTP 相關幾個有用的指令也列一下好了:
Mar 18 11:02:35 KHCBKPS01 ntpd[5137]: ntpd exiting on signal 15
Mar 18 11:02:35 KHCBKPS01 ntpdate[9708]: step time server 10.15.25.13 offset 0.039707 sec
Mar 18 11:02:35 KHCBKPS01 ntpd[9710]: ntpd 4.2.2p1@1.1570-o Thu Jan 17 18:14:09 UTC 2008 (1)
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: precision = 1.000 usec
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: Listening on interface wildcard, 0.0.0.0#123 Disabled
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: Listening on interface wildcard, ::#123 Disabled
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: Listening on interface lo, ::1#123 Enabled
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: Listening on interface eth1, xxxx::xxx:xxxx:xxxx:xxxx#123 Enabled
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: Listening on interface lo, 127.0.0.1#123 Enabled
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: Listening on interface eth1, aaa.bb.ccc.dd#123 Enabled
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: kernel time sync status 0040
Mar 18 11:02:35 KHCBKPS01 ntpd[9711]: frequency initialized 52.117 PPM from /var/lib/ntp/drift
Mar 18 11:05:48 KHCBKPS01 ntpd[9711]: synchronized to 10.15.25.13, stratum 5
Mar 18 11:05:48 KHCBKPS01 ntpd[9711]: kernel time sync disabled 0001
[root@KHCBKPS01 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
=========================================
*KHCDNSS01 LOCAL(0) 5 u 25 64 17 0.212 -0.532 0.347
[root@KHCBKPS01 ~]# ntpq
ntpq> association
ind assID status conf reach auth condition last_event cnt
=========================================
1 38739 9624 yes yes none sys.peer reachable 2
ntpq> quit
[root@KHCBKPS01 ~]# ntpstat
synchronised to NTP server (10.15.25.13) at stratum 6
time correct to within 951 ms
polling server every 64 s
[root@KHCBKPS01 ~]# ntpdc -c kerninfo
pll offset: -0.00049 s
pll frequency: 52.583 ppm
maximum error: 0.013646 s
estimated error: 0.000188 s
status: 0001 pll
pll time constant: 2
precision: 1e-06 s
frequency tolerance: 512 ppm
[root@KHCBKPS01 ~]# ntpdc -c sysinfo(詳全文...)
system peer: KHCDNSS01
system peer mode: client
leap indicator: 00
stratum: 6
precision: -20
root distance: 0.00017 s
root dispersion: 0.20419 s
reference ID: [10.15.25.13]
reference time: cd6b4bfa.65ce0142 Wed, Mar 18 2009 18:31:22.397
system flags: auth monitor ntp kernel stats
jitter: 0.000214 s
stability: 0.000 ppm
broadcastdelay: 0.003998 s
authdelay: 0.000000 s