通信電纜 網(wǎng)絡(luò)設(shè)備 無線通信 云計算|大數(shù)據(jù) 顯示設(shè)備 存儲設(shè)備 網(wǎng)絡(luò)輔助設(shè)備 信號傳輸處理 多媒體設(shè)備 廣播系統(tǒng) 智慧城市管理系統(tǒng) 其它智慧基建產(chǎn)品
行業(yè)產(chǎn)品
北京中新創(chuàng)科技有限公司
閱讀:2657發(fā)布時間:2011-10-21
現(xiàn)在的網(wǎng)絡(luò)由于各種原因 對于時間同步要求很高——如電力、金融、通信、交通、廣電、安防、石化、冶金、水利、國防、醫(yī)療、教育、政府機關(guān)、IT等領(lǐng)域的網(wǎng)絡(luò)系統(tǒng)需要在大范圍保持計算機的時間同步和時間準確。
配置ntp協(xié)議就是他們要面對的一個問題,在NTP中有Ntp,xntp等各種軟件。我們選用Rad Hat中標配的NTP協(xié)議。
首先讓大家了解下NTP協(xié)議:
使用端口123
協(xié)議 UDP
用處 同步網(wǎng)絡(luò)時鐘源
首先到下載ntp-4.1.1-1.i386.rpm
(ftp://rpmfind.net/linux/redhat/7.3/en/....1.1-1.i386.rpm)
不下載的,因為高版本可能你的linux版本(AS 3.1)不支持,并且不要選4.0.9版本(有溢出漏洞)
如果鏈接失效推薦一個不錯的搜索引擎(http://rpmfind.net/linux/rpm2html/search.php)
#wget ftp://rpmfind.net/linux/redhat/7.3/en/....1.1-1.i386.rpm
#rpm -ivh ntp-4.1.1-1.i386.rpm //默認安裝即可
接下來編輯 /etc/ntp.conf
首先你可以去ntp.org上找到哪些ntp服務(wù)器離你較近
ntp.conf
#############################################################################################
server clock.tl.fukuoka-u.ac.jp #校對服務(wù)器1
server clock.uregina.ca
server swisstime.ethz.ch
server ntp0.fau.de # 比較多的服務(wù)器可以防止因為網(wǎng)絡(luò)故障導(dǎo)致無法校對時間
server 127.127.1.1 #這行可刪除
fudge 127.127.1.1 stratum 10 #同上
driftfile /etc/ntp/drift #/etc/ntp/drift 可能是ntp.drift 這無所謂,看你的版本號
restrict clock.tl.fukuoka-u.ac.jp
restrict clock.cuhk.edu.hk
restrict swisstime.ethz.ch
restrict ntp0.fau.de
restrict 127.0.0.1
restrict 192.168.x.y #x.y為自己的IP
restrict 192.168.x.x mask 255.255.255.0 nomodify #讓x網(wǎng)段的機器都能訪問自己,進行時間校對
#restrict default ignore #這行刪除或注釋都可以
#############################################################################################
#/sbin/service ntpd start //啟動ntpd 參數(shù)可為restart start stop
#/sbin/chkconfig --add ntpd
#/sbin/chkconfig --level 234 ntpd on //配置在開機時運行
接下來在客戶端安裝NTP
安裝過程同上
接下來編輯 /etc/ntp.conf
ntp.conf
#############################################################################################
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
server stdtime.gov.hk # A stratum 1 server at server.org
server 192.168.x.y #x.y為你前面所裝機器在局域網(wǎng)里的IP
driftfile /etc/ntp/drift
broadcastdelay 0.008
authenticate no
keys /etc/ntp/keys
restrict 192.168.x.0 mask 255.255.255.0 notrust nomodify notrap//x.0為你所在局域網(wǎng)段
restrict 127.0.0.1
restrict 192.168.x.y #x.y為你前面所裝機器在局域網(wǎng)里的IP
#restrict default ignore
#############################################################################################
同時配置
#/sbin/service ntpd start //啟動ntpd 參數(shù)可為restart start stop
#/sbin/chkconfig --add ntpd
#/sbin/chkconfig --level 234 ntpd on //配置在開機時運行
如何檢查?
#netstat -unl | grep 123 //查看123端口
#ndptrace 192.168.x.y //看校對時間過程,出現(xiàn)offset即為正常 否則為time out
# ntpq -p
如果出現(xiàn) jitter的值 為4000則是防火墻或者網(wǎng)絡(luò)問題
正常為
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
幾點注意:
1.雖然ntp溢出問題較少 ,但建議配置大型網(wǎng)羅的時候,不要裝在重要數(shù)據(jù)庫服務(wù)器或者Web主機上(Ntp是root權(quán)限)
2.在遇到問題之前,先看看ntp協(xié)議自帶的文檔
3.防火墻問題的話,送一句配置
$TMP -t filter -A INPUT -p udp --destination-port 123 -j ACCEPT
也就是123 udp in 全部接受
:王
北京中新創(chuàng)科技有限公司
商鋪:http://m.aiynx.com/st44165/
主營產(chǎn)品:ptp時鐘模塊,1588時鐘模塊,網(wǎng)絡(luò)時間服務(wù)器,北斗衛(wèi)星對時服務(wù)器,GPS授時儀
智慧城市網(wǎng) 設(shè)計制作,未經(jīng)允許翻錄必究 .? ? ?
請輸入賬號
請輸入密碼
請輸驗證碼
請輸入你感興趣的產(chǎn)品
請簡單描述您的需求
請選擇省份