????2?????NTP?????????????/etc/ntp.conf

????????????趨????

?????????趨????? restrict ??????????趨????????£?

????restrict IP??? mask ???????? ????

???????? IP ??????IP???????????? default ??default ??????е?IP

???????????????????

????ignore??????????е? NTP ????????

????nomodify????????????????????????????????????????????????????У???

????notrust ???????????????????????????????????????????????

????noquery ?????????????????

??????????????????趨???????? IP (??????)????κ??????

??????server????????趨???????????????????£?

????server IP????????? [prefer]

????IP???????????????????????????????????? Server ????????? prefer?????????? NTP ???????????ò???????????У???

????driftfile???????:

????driftfile ?????

??????????????????????????????????????driftfile???????????????

???????: driftfile ?????????????????????·????????????????????????????????????????趨?? ntpd??????????д??

????3.ntp.conf??????????

????1)???????????????????????????????

?????????????time.nist.gov ?????????????ntp.conf???????????????

restrict default ignore??# ??????е? NTP ?????
restrict 192.168.1.0 mask 255.255.255.0 notrap nomodify
server time.nist.gov  #????????????
server 127.127.1.1              #???????????????? lo
fudge  127.127.1.1 stratum 10 refid NIST   # LCL ?????
driftfile /etc/ntp.drift
logfile   /var/log/ntp.log
Broadcastdelay  0.008 #????????#

????2)?????ntp???????????????????

??????????????? Internet ????????????????? 192.168.0.0/24 ?????????????????????????NTP????????????????

??????ntp.conf???????????????

restrict default ignore??# ??????е? NTP ?????
restrict 127.0.0.1???? # ???????????????? lo
restrict 192.168.0.0 mask 255.255.255.0 nomodify #????????????????????? ????????У????????????NTP????????????????
server 198.123.30.132   #198.123.30.132???????????????ο?
restrict 198.123.30.132 #????server ????????ntp????????
driftfile /var/lib/ntp/drift
broadcastdelay  0.008 #????????#

????4.???????ù?????

???? ?????????

???????NTP????service ntpd start

???? ???????????????NTP??????????????????????????

????chkconfig -level 35 ntpd on

???? ??iptables?????123???

????NTP?????????123????????udpЭ?飬????NTP?????????????????????udp 123??????????????£???????1???

????#/sbin/iptables -A INPUT -p UDP -i eth0 -s 192.168.0.0/24  /

????> --dport 123 -j ACCEPT

???????Ntpd?????????????????????????????????????ntpd??????????????????????????????????5?????????????????????????????????????????

????5.??ntp?????????????

???????????????????123????ntp???????ж?ntp?????????????????

???????????£?

????netstat -unl | grep 123 #??123???
????ps -ef|grep ntp #??ntp??????????

????6.???ntp??????

????ntpq????????ntpd?????????????NTP??6???????????????NTP??????????

????ntpq -p????????е?NTP??????????????????????????????????

???????磺 ??????? ntpq –p???????????

ntpq -p
remote           refid      st t when poll reach   delay   offset  jitter
=================================
*time-A.timefreq .ACTS.           1 u  152 1024  377   43.527  -11.093   3.982
+clock.isc.org   204.123.2.5      2 u  230 1024  377   67.958   -7.729   0.071
time-a.nist.gov .ACTS.           1 u  323 1024  377   58.705  994.866 999.084

????“* ”???????NTP??????????????????? “+”????????????????NTP????????    “blank?????”??????????NTP???????? “remote” ?????????????NTP?????????????  “refid ”??NTP????????????????????????????? “st”??????????????NTP??????????? “when”??????γ???????????????????? “poll”???????????????????????? “offset”?????????NTP???????????????????????????????λ?????ms????