IDC--------NTP時(shí)間服務(wù)器實(shí)施文檔_第1頁(yè)
IDC--------NTP時(shí)間服務(wù)器實(shí)施文檔_第2頁(yè)
IDC--------NTP時(shí)間服務(wù)器實(shí)施文檔_第3頁(yè)
IDC--------NTP時(shí)間服務(wù)器實(shí)施文檔_第4頁(yè)
IDC--------NTP時(shí)間服務(wù)器實(shí)施文檔_第5頁(yè)
已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、idc數(shù)據(jù)中心ntp時(shí)間服務(wù)器實(shí)施文檔第一章ntp server 配置:31.1查看安裝包31.2配置服務(wù)器31.3關(guān)閉防火墻,清除默認(rèn)策略41.4關(guān)閉 selinux41.5設(shè)置服務(wù)開(kāi)機(jī)啟動(dòng)41.6查看同步情況41.7查看服務(wù)器進(jìn)程和監(jiān)聽(tīng)端口 5第二章ntp redhat client 測(cè)試: 62.1查看ntp server是否可用62.2進(jìn)行時(shí)間同步72.3編寫腳本使客戶端自動(dòng)同步72.4編寫客戶端自動(dòng)化部署腳木7第三章ntp windows client 測(cè)試: 8第四章排錯(cuò)84.1錯(cuò)誤 1.server dropped: strata too high84.1錯(cuò)誤 2.server

2、dropped: no data94.1服務(wù)端ntpq -p命令詳細(xì)參數(shù)介紹10第一章ntp服務(wù)器需求1.1內(nèi)網(wǎng)服務(wù)器時(shí)間問(wèn)題idc數(shù)據(jù)中心內(nèi)網(wǎng)服務(wù)器由于bios時(shí)間和時(shí)區(qū)跟internet時(shí)間存在很大差距,造 成內(nèi)網(wǎng)的服務(wù)器時(shí)間各不相同,為了時(shí)間內(nèi)網(wǎng)時(shí)間統(tǒng)一同時(shí)也為了方便后期日志 排錯(cuò)特搭建ntpi3寸間服務(wù)器。1.2 ntp時(shí)間同步實(shí)現(xiàn)方式ntp時(shí)間服務(wù)器連接公網(wǎng)internet時(shí)間服務(wù)器進(jìn)行時(shí)間同步,端口 udp 123,同 步完成后時(shí)間寫入本地bios,每間隔一段時(shí)間就會(huì)跟公網(wǎng)時(shí)間服務(wù)器進(jìn)行同步, 保證時(shí)間的最精確性。ntp吋間服務(wù)器連接內(nèi)網(wǎng),跟內(nèi)網(wǎng)所有網(wǎng)段可達(dá),同吋只允許客戶端訪問(wèn)本

3、地 ntp的123端口,其他全部拒絕。充分服務(wù)器安全,客戶端同步采用計(jì)劃任務(wù)進(jìn) 行同步,每隔一小時(shí)進(jìn)行同步一次。第二章ntp sewer配置2.1查看安裝包redhat5.5默認(rèn)系統(tǒng)安裝時(shí)已經(jīng)安裝ntp包,不用重新安裝,如果發(fā)現(xiàn)系統(tǒng)沒(méi)有 安裝可以到光盤下sewer目錄進(jìn)行安裝:rootntp-server01 # rpm -qa |grep ntpntp-4.2.2pl-9.el5_4.1chkfontpath-1.10.1-1.1rootntp-server01 #2.2配置服務(wù)器rootntp-serverol # vim /etc/ntp.confrestrict default no

4、mod ify no traprestrict #由于內(nèi)網(wǎng)很多網(wǎng)段所以修改為允許所有同步 #下面每條server都需要配置restrict這里表示允 許127回環(huán)地址可以同步時(shí)間server server tw.pool. server server 4 server #指定上級(jí)同步的時(shí)間服務(wù)器#此處可以指定多個(gè)#同時(shí)可以加參數(shù)prefer,優(yōu)先級(jí)最高#國(guó)家授吋中心ip#以本地回環(huán)地址作為ntp server,以防時(shí)間服 務(wù)器對(duì)外同步時(shí)間發(fā)生錯(cuò)誤仍然可以給內(nèi)網(wǎng)服 務(wù)器進(jìn)行時(shí)間同步,只

5、是以服務(wù)器本地時(shí)間作為 同步標(biāo)準(zhǔn)fudge stratum 10restrict none mask 55 no modify no trap#此處的none代表著上而的server后面指定的公網(wǎng)時(shí)間服務(wù)器,此處我們寫在 另外的一個(gè)配置文件中/etc/ntp/step-tickers中,這樣毎次重啟服務(wù)器時(shí)都會(huì)按照 此文件中縮寫的上級(jí)時(shí)間服務(wù)器進(jìn)行一次時(shí)間同步rootntp-serverol # cd /etc/ntp rootntp-server01 ntp# pwd /etc/ntprootntp-server01 ntp# iskeys

6、n tpserve rs ste p-tickersrootntp-server01 ntp# more step-tickers 42.3關(guān)閉防火墻,清除默認(rèn)策略iptables -fiptables-xservice iptables saveservice iptables stopchkconfig iptables off2.4 關(guān)閉 selinuxrootntp-server01 ntp# more /etc/sysconfig/seiinux# this file controls the st

7、ate of selinux on the system.# selinux= can take one of these three values:# enforcing - selinux security policy is enforced# permissive seli nux prints war nings in stead of en forcing.# disabled - selinux is fully disabled.selinux=disabled# selinuxtype= type of policy in use. possible values are:#

8、 targeted - only targeted network daemons are protected.# strict - full selinux protection.selinuxtype=targeted確定已經(jīng)關(guān)閉:rootntp-serverol ntp# getenforcedisabled2.5設(shè)置服務(wù)開(kāi)機(jī)啟動(dòng)chkconfig ntpd onservice ntpd restartrootntp-server01 ntp# service ntpd restartshutting down ntpd: ok ntpd: synchronizing with time

9、 server: ok syncing hardware clock to system time ok starting ntpd: ok 2.6查看同步情況st t when poll reach delay offsetrootntp-serverol # ntpq -p . 222.4642 u56641791.9409.1760303 u57641781.742-0.1504.386w w wco 1 test 15. m i 92

10、u576417222.28941.2514.1204.acts 1 u55161546.2594.83311.529*local(0)locl10 15764170.0000.0000.001注意:服務(wù)端剛同步完成后客戶端是無(wú)法同步時(shí)間的需要大概3-5分鐘即可重新同步。 此時(shí)同步會(huì)報(bào)如下錯(cuò)誤:rootclient-04 cron.hourly# ntpdate 25 nov 10:39:45 ntpdate4192: no server suitable for synchronization found2.7查看服務(wù)器進(jìn)程和監(jiān)聽(tīng)端口ntp 是 ud

11、p 123 端口:rootntp-server01 # netstat -ntulp|grep 123udp00:123o.o.o.o:*31292/ntpdudp00:123o.o.o.o:*31292/ntpdudp0020:123o.o.o.o:*31292/ntpdudp00:123o.o.o.o:*31292/ntpdudp00 :123o.o.o.o:*31292/ntpd udp 31292/ntpd00fe80:e61f:13ff:feb:123 * udp31292/ntpd

12、00fe80:e41f:13ff:fea:123* udp31292/ntpd00fe80:200:ff:fe00:0:123 * udp31292/ntpd00:1:123 * udp00:123* 31292/ntpdrootntp-server01 #第三章 ntp redhat client 測(cè)試:3.1查看ntp server是否可用rootntp-server01 # ntpstatsynchronised to ntp server (4) at stratum 11time correct to within 954 mspolling server e

13、very 64 srootclient-04 # ntpdate -d 25 nov 10:11:13 ntpdate3941: ntpdate 4.2.2pl1.1570-o thu nov 26 11:34:35 utc 2009 (1)looking for host and service ntphost found : transmit()receive() transmit()receive() transmit()rec

14、eive() transmit()receive()transmit()server , port 123stratum 2, precision -20, leap 00, trust 000refid , delay 0.02570, dispersion 0.00000transmitted 4, in filter 4reference time:d45bf608.1933bf74 sun, nov 25 20129:42:32.098originate timest

15、amp: d45bfccl.lcl5aceb sun, nov 25 2012 10:11:13.109 transmit timestamp: d45bfccl.lc3e963d sun, nov 25 2012 10:11:13.110 filter delay: 0.025740.025700.025700.025700.00000 0.00000 0.00000 0.00000filter offset: 0.00067 -0.00067 -0.00067 -0.000670.000000 0.000000 0.000000 0.000000delay 0.02570, dispers

16、ion 0.00000offset -0.00067625 nov 10:11:13 ntpdate3941: adjust time server offset -0.000676 sec rootclient-04 #3.2進(jìn)行時(shí)間同步client端不用開(kāi)啟時(shí)間服務(wù)rootclient04 # chkconfig ntpd off;service ntpd stop rootclient-04 # ntpdate 25 nov 10:10:57 ntpdate3940: adjust time server offset 0.

17、001457 sec 建議第一次時(shí)間差很大的情況下多運(yùn)行兒次命令以確保同步的時(shí)間差到達(dá)最小3.3編寫腳本使客戶端自動(dòng)同步rootclie nt04 cron .hourly# pwd /etc/cr on .hourlyrootclient-04 cron .hourly# ismcelog.cr on n tp.cr onrootclient-04 cron .hourly# more n tp.cr on#!/bin/bash/usr/sbin/ntpdate ;/sbi n/hwclock -w rootclient-04 cron .hourly#3.4編寫客戶端自

18、動(dòng)化部署腳本#!/bin/bashchkconfig ntpd onservice ntpd stopntpdate 172. 31.4.2echo "/usr/sbin/ntpdate 172.314.2> /etc/cron< hourly/ntp> cron echo /sbin/hwclock -w> /etc/cron. hourly/ntp. cronchmod u+x /otc/cron. hourly/ntp. cron/sbin/hwclock -w第四章 ntp windows client 測(cè)試:時(shí)間和日期|時(shí)區(qū) inmrn.t時(shí)間|&a

19、mp;自動(dòng)與internet時(shí)間服務(wù)器同步(£)服務(wù)器:|17231.4.2i 15100與同步時(shí)間成功,在2012-11-25在10:45.下次同步:2012-12-2在10:41貯鐮缺鶴沁嚴(yán)噸有關(guān)更多信第五章排錯(cuò)5.1 錯(cuò)誤 l.server dropped: strata too high在 ntp 客戶玄揣運(yùn)彳亍 ntpdate serverip, 出現(xiàn) no server suitable for synchronization found的錯(cuò)誤。在 ntp 客戶端用 ntpdate - d serverip 查看,發(fā)現(xiàn)有"server dro

20、pped: strata too high” 的錯(cuò)誤,并口顯示"stratum 16”。而正常情況下stratum這個(gè)值得范圍是這是因?yàn)閚tp server還沒(méi)有和其白身或者它的server同步上。以下的定義是讓ntp server和其自身保持同步,如果在/ntp.conf中定義的server 都不可用時(shí),將使用local時(shí)間作為ntp服務(wù)提供給ntp客戶端。server fudge stratum 8在ntp server ±重新啟動(dòng)ntp服務(wù)后,ntp server白身或者與其server的同步的需 要一個(gè)時(shí)色段,這個(gè)過(guò)程可

21、能是5分鐘,在這個(gè)時(shí)間之內(nèi)在客戶端運(yùn)行ntpdate 命令日寸會(huì)產(chǎn)生 no server suitable for synchronization found 的錯(cuò)誤。那么如何知道何時(shí)ntp server完成了和自身同步的過(guò)程呢?在ntp server上使用命令:# watch ntpq -p出現(xiàn)畫面:every2.0s:thu jul 10 02:28:32 2008ntpq-premoterefidst t when poll reach delay offset jitter2 local(o)0.001226412.113 179133.local(o)loca

22、l(o)10 1216410.000 0.0000.001注意local的這個(gè)就是與自身同步的ntp servero注意reach這個(gè)值,在啟動(dòng)ntp server服務(wù)后,這個(gè)值就從0開(kāi)始不斷增加,當(dāng) 增加到17的時(shí)候,從0到17是5次的變更,每一次是poll的值的秒數(shù),是64 秒*5=320秒的時(shí)間。如果z后從ntp客戶端同步ntp server還失敗的話,用ntpdate - d來(lái)查詢?cè)敿?xì) 錯(cuò)誤信息,再做判斷。5.2 錯(cuò)誤 2.server dropped: no data從客戶端執(zhí)行netdate - d時(shí)有錯(cuò)誤信息如下:transmit(2)transmit(1

23、2)transmit(2)transmit(2)transmit(2)2: server dropped: no dataserver 2, port 12328 jul 17:42:24 ntpdate14148: no server suitable for synchronization found 岀現(xiàn)這個(gè)問(wèn)題的原因可能有2:lo檢查ntp的版本,如果你使用的是ntp4.2 (包括4.2)之后的版本,在restrict 的定義中使用了 notru

24、st的話,會(huì)導(dǎo)致以上錯(cuò)誤。使用以下命令檢查ntp的版木:# ntpq c version下面是來(lái)自ntp官方網(wǎng)站的說(shuō)明:the behavior of no trust cha nged betwee n versi ons 4.1 and 4.2.in 4.1 (and earlier) no trust mean t "d on*t trust this host/sub net for time".in 4.2 (and later) no trust means "ig nore all ntp packets that are not cryptographically authenticated." this forces remote time servers to authenticate themselves to your (dient)ntpd解決:把notrust去掉。2o檢查ntp server的防火墻。可能是server的防火墻屏蔽了 upd

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論