• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 系統時間同步及ntp服務的提供

    發表于:2007-05-26來源:作者:點擊數: 標簽:
    電腦的時間放置不理的話過不久就會出現誤差。 這個誤差會反映在email送信時刻的time stamp上,會反映在你的論壇帖子發表時刻上。至少我遇到過這個問題。 網絡 上有ntp .net work time protocol) 服務器 ,提供當前的時刻。我們可以將本地的時刻與ntp服務器的
    電腦的時間放置不理的話過不久就會出現誤差。
    這個誤差會反映在email送信時刻的time stamp上,會反映在你的論壇帖子發表時刻上。至少我遇到過這個問題。
    網絡上有ntp.network time protocol)服務器,提供當前的時刻。我們可以將本地的時刻與ntp服務器的時刻進行同步。

    目的如下:
    1,啟動時用ntpdate進行時刻修正。
    2,啟動中,通過ntpd進行時刻校正的同時,將各個客戶端電腦的時刻也進行同期校正。
    3,如果不能找到ntp服務器,那么就使用local time,同時同步客戶。

    全世界約有100多個ntp服務器,從下面地址找一個離你最近的
    http://www.eecis.udel.edu/~mills/ntp/clock1a.html
    我選擇了兩個
    clock.nc.fukuoka-u.ac.jp 133.100.9.2
    clock.tl.fukuoka-u.ac.jp 133.100.11.8
    步驟:

    FreeBSD中有兩個標準的ntp程序,其一為ntpdate。
    ntpdate通過從ntp服務器獲取時刻,調整本地時刻。
    # ntpdate clock.nc.fukuoka-u.ac.jp
    9 Oct 18:12:23 ntpdate: step time server 133.100.9.2 offset -19.112674
    大約有19秒鐘的誤差

    自動設定
    # grep ntpdate /etc/defaults/rc.conf >>/etc/rc.conf
    # vi /etc/rc.conf
    ntpdate_enable="YES" # Run ntpdate to sync time on boot (or NO).
    ntpdate_program="ntpdate" # path to ntpdate, if you want a different one.
    ntpdate_flags="clock.nc.fukuoka-u.ac.jp" # Flags to ntpdate (if enabled).
    重新啟動以后就運行了,當然設定沒有完,不必急著啟動
    FreeBSD的另一個標準ntp程序,ntp
    ntp程序使的獲取ntp時刻的同時,向其他pc提供時刻。

    添加文件ntp.conf:

    用來作為標準時刻的ntp服務器我選擇了兩個
    clock.nc.fukuoka-u.ac.jp 133.100.9.2
    clock.tl.fukuoka-u.ac.jp 133.100.11.8
    同時指定復數個服務器也沒有問題,系統會自動選擇一個可以信賴的。
    這里,為避免多余的DNS數據包傳遞,我們直接指定IP地址。
    server行 server 127.127.1.0 為參考本地時刻時用的地址。然后用fudge指定階層編號為5,降低其優先度。

    接著用restrict對每一個IP地址指定相應的規則。
    最后,指定波長校正用的drift文檔保存地址。關于這個命令行,具體的含義不太清楚。不過如果沒有的話,時間校正起來就會比較慢
    # vi /etc/ntp.conf
    server 133.100.9.2 #clock.nc.fukuoka-u.ac.jp
    server 133.100.11.8 #clock.tl.fukuoka-u.ac.jp
    server 127.127.1.0
    fudge 127.127.0.1 stratum 5
    restrict default ignore
    restrict 127.0.0.0 mask 255.0.0.0
    restrict 192.168.1.0 mask 255.255.255.0 noquery nopeer notrust
    restrict 133.100.9.2 noquery
    restrict 133.100.11.8 noquery
    driftfile /etc/ntpd.drift
    啟動測試
    # ntpd -p /var/run/ntpd.pid
    # tail /var/log/messages
    Oct 9 16:46:56 chiwawa ntpd[89409]: ntpd 4.1.0-a Thu Apr 3 08:26:24 GMT 2003 (1)
    Oct 9 16:46:56 chiwawa ntpd[89409]: kernel time discipline status 2040
    ......
    Oct 9 16:50:10 chiwawa ntpd[89409]: time set -0.189546 s
    看到類似的結果就可以了。

    運行測試
    ntpd的運行用ntpq命令
    # ntpq -p
    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
    啟動后到時刻校正完成需要一點時間。*是第一候補,+是第二。
    本地時刻校正完成以后就可以為其他PC提供時刻校正服務了。

    自動啟動的設定
    完成以上設定,確認運行無誤以后:
    # grep ntpd /etc/defaults/rc.conf >>/etc/rc.conf
    # vi /etc/rc.conf
    xntpd_enable="YES" # Run ntpd Network Time Protocol (or NO).
    xntpd_program="ntpd" # path to ntpd, if you want a different one.
    xntpd_flags="-p /var/run/ntpd.pid" # Flags to ntpd (if enabled).

    往rc.conf追加上面3行內容,并修改。
    客戶端PC設定:
    UNIX OS
    # vi /etc/ntp.conf
    server [local ntp server IP] prefer
    driftfile /etc/ntpd.drift
    或者追加下面內容到crontab,這樣,每過一個小時0分的時候就自動更新。
    # vi /etc/crontab
    0 * * * * root ntpdate [ntp server IP] >/dev/null 2>&1
    當然,你的主機其實也是一個客戶機,這些內容也可以用上。
    Windows
    精工的網站上有下載軟件,不過是日語的
    http://www.seiko-p.co.jp/systems/down/time.html
    windows2000自帶了sntp機能,請自己研究吧。
    BBSURL:

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>