
我檢查了配置,甚至安裝了 ntp 伺服器,似乎沒有什麼可以解決這個問題,
sudo dpkg-reconfigure tzdata
Current default time zone: 'Asia/Tehran'
Local time is now: Thu May 9 00:49:38 IRDT 2013.
Universal Time is now: Wed May 8 20:19:38 UTC 2013.
/etc/ntp.conf
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server ir.pool.ntp.org
server in.pool.ntp.org
server tr.pool.ntp.org
server ntp.ubuntu.com
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1
以下是目前的情況
$ date
Sun May 12 17:15:39 IRDT 2013
$ date --utc
Sun May 12 12:45:40 UTC 2013
according to Google my local time is
11:45 AM Sunday, May 12, 2013 (IRDT)
答案1
-g
使用NTP 守護程序中的標誌強制進行初始同步。對於 Debian 及其衍生版本,這是在以下位置配置的/etc/default/ntp
:
# cat /etc/default/ntp
NTPD_OPTS='-g'
檢查ntpd(8)
手冊頁以取得詳細說明:
-g
通常,
ntpd
如果偏移量超過緊急閾值(預設為 1000 秒),則會退出並向系統日誌發送訊息。此選項允許時間不受限制地設定為任意值;然而,這種情況只能發生一次。如果此後超過閾值,ntpd
將退出並向系統日誌發送一條訊息。該選項可以與-q
和-x
選項一起使用。
檢查您的日誌以查看是否屬於這種情況。
使用該ntpq(1)
實用程式檢查遠端伺服器:
# ntpq
ntpq> pe
remote refid st t when poll reach delay offset jitter
==============================================================================
+213.194.159.3 81.19.96.148 3 u 798 1024 337 81.503 0.178 37.213
-mx.tjma.es 150.214.94.5 2 u 474 1024 375 54.353 -116.72 88.993
+m91-187-92-138. 78.46.108.116 3 u 830 1024 317 89.527 15.581 34.467
*www.clip.dia.fi 150.214.94.5 2 u 901 1024 377 45.648 -0.994 23.004
LOCAL(0) .LOCL. 10 l 207m 64 0 0.000 0.000 0.000
ntpq> as
ind assid status conf reach auth condition last_event cnt
===========================================================
1 18026 9424 yes yes none candidate reachable 2
2 18027 931a yes yes none outlyer sys_peer 1
3 18028 9424 yes yes none candidate reachable 2
4 18029 961a yes yes none sys.peer sys_peer 1
5 18030 8043 yes no none reject unreachable 4
另一個檢查是比較系統時鐘和硬體時鐘,看看它們是否同步。hwclock(8)
為此請閱讀。