日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

系統(tǒng)時(shí)間同步及ntp服務(wù)的提供

電腦的時(shí)間放置不理的話過(guò)不久就會(huì)出現(xiàn)誤差 。
這個(gè)誤差會(huì)反映在email送信時(shí)刻的time stamp上,會(huì)反映在你的論壇帖子發(fā)表時(shí)刻上 。至少我遇到過(guò)這個(gè)問(wèn)題 。
網(wǎng)絡(luò)上有ntp(network time protocol)服務(wù)器,提供當(dāng)前的時(shí)刻 。我們可以將本地的時(shí)刻與ntp服務(wù)器的時(shí)刻進(jìn)行同步 。

目的如下:
1,啟動(dòng)時(shí)用ntpdate進(jìn)行時(shí)刻修正 。
2,啟動(dòng)中,通過(guò)ntpd進(jìn)行時(shí)刻校正的同時(shí),將各個(gè)客戶端電腦的時(shí)刻也進(jìn)行同期校正 。
3,如果不能找到ntp服務(wù)器,那么就使用local time,同時(shí)同步客戶 。

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

FreeBSD中有兩個(gè)標(biāo)準(zhǔn)的ntp程序,其一為ntpdate 。
ntpdate通過(guò)從ntp服務(wù)器獲取時(shí)刻,調(diào)整本地時(shí)刻 。
# ntpdate clock.nc.fukuoka-u.ac.jp
9 Oct 18:12:23 ntpdate: step time server 133.100.9.2 offset -19.112674 大約有19秒鐘的誤差

自動(dòng)設(shè)定
# 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). 重新啟動(dòng)以后就運(yùn)行了,當(dāng)然設(shè)定沒(méi)有完,不必急著啟動(dòng)
FreeBSD的另一個(gè)標(biāo)準(zhǔn)ntp程序,ntp
ntp程序使的獲取ntp時(shí)刻的同時(shí),向其他pc提供時(shí)刻 。

添加文件ntp.conf:

用來(lái)作為標(biāo)準(zhǔn)時(shí)刻的ntp服務(wù)器我選擇了兩個(gè)
clock.nc.fukuoka-u.ac.jp 133.100.9.2
clock.tl.fukuoka-u.ac.jp 133.100.11.8
同時(shí)指定復(fù)數(shù)個(gè)服務(wù)器也沒(méi)有問(wèn)題,系統(tǒng)會(huì)自動(dòng)選擇一個(gè)可以信賴的 。
這里,為避免多余的DNS數(shù)據(jù)包傳遞,我們直接指定IP地址 。
server行 server 127.127.1.0 為參考本地時(shí)刻時(shí)用的地址 。然后用fudge指定階層編號(hào)為5,降低其優(yōu)先度 。

接著用restrict對(duì)每一個(gè)IP地址指定相應(yīng)的規(guī)則 。
最后,指定波長(zhǎng)校正用的drift文檔保存地址 。關(guān)于這個(gè)命令行,具體的含義不太清楚 。不過(guò)如果沒(méi)有的話,時(shí)間校正起來(lái)就會(huì)比較慢
# 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 啟動(dòng)測(cè)試
# 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 看到類似的結(jié)果就可以了 。

運(yùn)行測(cè)試
ntpd的運(yùn)行用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 啟動(dòng)后到時(shí)刻校正完成需要一點(diǎn)時(shí)間 。*是第一候補(bǔ),是第二 。
本地時(shí)刻校正完成以后就可以為其他PC提供時(shí)刻校正服務(wù)了 。

自動(dòng)啟動(dòng)的設(shè)定
完成以上設(shè)定,確認(rèn)運(yùn)行無(wú)誤以后:
# 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).

推薦閱讀