• m Linux pЉ|
    osGAзR firefox s
    | cD | ̔D | g | A | ~R | ୱR | w޲z | QAO | Ŏ | y`~ | m | Xs |
    @ @ @
    @
    ̪sG2011/07/29
    qҰOOO BIOS (CMOS) ApGAqWqSqFAΪ̬OYǯS]fP BIOS ƳQMA ɹqɶN|ǡCPɡAYǧ@~t{DA]ifPڭ̬ݨ쪺ɶP{|ۦPpC ҥHڭ̳|վ@UɶAnqtɶiH@OTAC bڥͬAڭ̥iHzLqxBsqxBq܆ΆΨӽվڭ̪rApGObWOH Mpڭ̪DEHɫOTɶTHoNݭn NTP oӦAoC


    jADϥ15.1 }ɰϻPծɪqTw

    ɶ{NHӻOܭnA]y Time is money zCJMɶpnAںӻRM]OܭnaH OHROoڭ̦b߽gĤTĤQEءBnɤRaH pGA[]F@ӵnɦAܡA`onRCӥDEҶǨӪnɸTaHpGC@DEɶۦPA pP_DoͪɶIHҥHoAyC@DEɶPBzNܭnFC

    C@DEɶPBƪnSMupA]Aeͨ쪺 DHCP Τ/AݩһݭnɶB ɩһݭn`NɶIBͨ쪺nɤR\B㦳}ʪDEh~Be@ؽͨ쪺OqsΆΡA ݭn㦳ۦPɶ~^XDOCnFAU̴NӃԤ@ԡApQκӶiDEɶPBƧaI


    pADϥ15.1.1 OɰϡHyh֮ɰϡHGMT bӮɰϡH

    ]ayOꪺAҥHP@ӮɨAbay@OդѡA@O©]CӦ]HϥΤ@ 24 pɪסAҥHAbay﨤NRMtF 12 Ӥpɤ~CѩP@ӮɶIWA ӦayɶRM@ˡAFMoӰDAҥHiHQAayNQ 24 ӮɰϤFI

    o 24 ӮɰϬO̾ڤُOHѩayQHHygnסzyAӶiwA Ӹg׬saIb^yLªvzoӫҦba孱WA (Gҿתa孱NOѫn_uAӽNOPD檺u)ApUϩҥܡG

    aylȽuBgn׻PɰϪjy
    15.1-1BaylȽuBgn׻PɰϪjy

    ]¶ay@O 360 רAo 360 ר@ 24 ӮɰϡASM@ӮɰϴNO 15 רTI SѩOHLªvɶAǮɶ (Greenwich Mean Time, GMT ɶ)A[Way茪}YA]AbLªvHFkɶO֪(+p)AӥH誺aSMNOCoI

    HxWҡA]xWҦbaFg 120 ץ_n 25 ץkAS]xWbLªvF (oܡI]OFgI ^_^)A]xWaɶ (local time) | GMT ɶ 8 p (GMT + 8)CSLªvɶsIAxWNwgOWKIFIUCXUӮɰϪWٻPҦbgסAHλP GMT ɶɮtG

    AǮɰ g ɮt
    GMT , Greenwich Mean Time 0   W/E AǮɶ
    CET , Central European 15  E +1  F@
    EET , Eastern European 30  E +2  FG
    BT  , Baghdad 45  E +3  FT
    USSR, Zone 3  60  E +4  F|
    USSR, Zone 4 75  E +5  F
    Indian, First 82.3E +5.5Fb
    USSR, Zone 5 90  E +6  F
    SST , South Sumatra 105 E +7  FC
    JT  , Java 112 E +7.5FCb
    CCT , China Coast (xWҦba) 120 E +8  FK
    JST , Japan 135 E +9  FE
    SAST, South Australia 142 E +9.5FEb
    GST , Guam 150 E +10 FQ
    NZT , New Zealand 180 E +12 FQG
    Int'l Date Line 180 E/W ڂu
    BST , Bering 165 W -11 Q@
    SHST, Alaska/Hawaiian 150 W -10 Q
    YST , Yukon 135 W -9  E
    PST , Pacific 120 W -8  K
    MST , Mountain 105 W -7  C
    CST , Central 90  W -6  褻
    EST , Eastern 75  W -5  褭
    AST , Atlantic 60  W -4  |
    Brazil, Zone 2 45  W -3  T
    AT  , Azores 30  W -2  G
    WAT , West Africa 15  W -1  @

    ҥHoAxWɶO GMT + 8 NܮeXӤFaInSOdNOAܦhBͦbwU Linux ɭԡA `O|o{ثeɶCΪ̧֤F 8 pɡAnháAʎPɰϦ}I Ԓ򵹥Ld@UpվɰϧaI ^_^C

    t~AbWӤêɰϡANObӥvWڂuFIڭ̭軡AbLªvFɶ|֡A Ӧbɶ|CAOUF 180 פN|IY[INntF 24 pɶܡHShTI ҥH~qwyڂuz[IڂunbӥvWA]ApGAEꪺgRM|o{AxI XoɶOPUȡAF 13 ӤpɪEFROPI]nqLFڂuA ֤F@ѳIpGϹLӡAѬxWAN|h[@ѳI ^_^


    pADϥ15.1.2 OLu`ɶ (daylight savings)H

    ɰϪyإ߰_ӤA{bAӽͤ@͡A򤰻OyLu`ɶ (κ٤`ɶ)zHJMOyLu`ɶzSMDnOPLѦ}TI ]aybB檺ɭԬOe{@Ӷɱרb¶VB茪AҥH~KLV (oӤjaRMDT)AbLѪɭԡAդѪɶ|AҥHF`ιqA ]bLѪɭԬYǦaϷ|NL̪ɶw@pɡA]NOA쥻ɰϬO 8 InFA O]LѤVX{A]ɶVeAb쥻 8 IɭԡAqwMѪ 9 I (ɶ@p)p@ӡA ڭ̴NiHQVөA٥hFOqOɶA]~|٤Lu`ɶI

    ]xWbOӤpFAèSwӮɰϡA]ALu`ɶڭ̨ӻAMRODUTI LAGSSO檺ˤl


    pADϥ15.1.3 Coordinated Universal Time (UTC)Ptɶ~t

    AF@ǮɰϪyAo̭nͪOyOTɶzC b 1880 ~NɶAǬOH GMT ɶDAO GMT ɶOHVqLLªv@ӧ@pɪAǡC Mӧڭ̳D[Aay茪yDHΤ茪yDëDA[Way茳tצn^v~DA ҥHo GMT ɶPڭ̥ثepɪɶNI@ˤFC(1)

    bpɶɭԡA̷ǽTpRMOϥΡyl_vgzҭp⪺zF (Atomic Clock, ]Q٬l)Ao]QwqAǮɶ (International Atomic Time)Cӧڭ̱``ݨ UTC ]NO Coordinated Universal Time (MAǮɶ)NOQγoR Atomic Clock ǩҩwqXӪTɶCҦp 1999 ~bťΪl NIST F-1A LҲͪɶ~tCd~~t@IuOܷǧoIo UTC AǮɶMP GMT ɶbP@ӮɰϬǡA Lѩpɪ覡PAUTC ɶP GMT ɶth 16 ~tOI(2)

    WAbڭ̪NܦhlAҦpۭ^ARqDEW BIOS Nt@ӭlbPpɶioILѩlDnOQέpⴹ (crystal) l_vghpɪAoO]CRۤvWS_vgGC MӦ]oR_vgbPhhֳ֤|ItʡAƦܦP@崹]i|ΦhΤ֦dz\t (Nsūפ]iyo˪~tO)A]]NyF BIOS ɶ|TɪL֤FXΪ̺CFXC

    γ\A|{ABIOS pɾCѧ֭Ӥ]SF_ALpGAAJN@A|o{A@ѧ֤A@Ӥ 2.5 A@~N֤F 75 FIҥHAIɶtOu|sbIpGAquo˪pA nӭsեɶOHNݭnyծɡz(Network Time Protocol, NTP) \FIUڭ̴Nͤ@ͨ NTP daemon aI


    pADϥ15.1.4 NTP qTw

    A Linux @~tpɤ覡DnO 1970/01/01 }lp`ӋA]ApGAROo date oӫOܡA |o{ +%s ӋAiHo`ӋAoӴNOnCApPeAqwDnOH BIOS ɶDnɶ̾ (w)AӰoӮɶi] BIOS DAfP BIOS ɶPAǮɶ (UTC) @IItsbIҥHFקKDEɶ]B@UfPɶtAiɶPB (synchronize) u@N㪺ܭnFI

    • nG Linux @~tھ 1970/01/01 }lp⪺`ӋF
    • wGDEwtWAҦp BIOS OɶF

    ɶPBƩOHQ@QApGڭܴ̿XDnDE (Primary server) ծծɶAo Primary Servers ɶPBAA}AȨ Client ݳsuAåB Client ݽվۤvɶANiHFqɶPBƪB@FܡI򤰻wiHFo˪\OHNO Network Time Protocol At~R Digital Time Synchronization Protocol (DTSS) ]iHFۦP\I LA쩳 NTP o daemon Op Server P Client PBL̪ɶOH

    1. ADESMݭnŰʳo daemon AA
    2. Client |V NTP Server oeXծծɶ message A
    3. M NTP Server |eXثeAǮɶ Client A
    4. Client ^FӦ Server ɶA|ڥHվۤvɶANFFծɫI

    bWBJASQ@Ɣ[ANOpG Client Server TǰeɶLH|ҨӻAڦbxWH ADSL PC DEAsuꪺ NTP Server DEiɶPBƭnDAӬ NTP Server ڪnDANoeSɪTɶڡALA ѬNƶǰe^ڪ PC ɡAɶiwgF 10 hFIoˤ@ӡAڪ PC եɶO 10 eAǮɶI~ApG꨺ NTP DEӦhHwWhiծɤFAҥH loading (t) ӭTIfPT^ǤS𪺧YIH

    Foǩ𪺰DA@ program wg}oF۰ʭpɶǰeL{~tAHǽTշǦۤvɶISMTAb daemon A]PɥH server/client master/slave [cӴѨϥΪ̶iծɪʧ@Iҿת master/slave NI DNS tI|ҨӻAxWAǮɶDEhڊAǮɶDEծɡA MUjM|զAxWAǮɶծɡAMڭ̦AUjM|ժAǮɶծɡIoˤ@ӡAXڊAǮɶDE (Time server) loading NܩӤjAӧڭ̤]iHܧֳtF쥿TծɪتOIxW` Time Server (3)G

    • tick.stdtime.gov.tw
    • tock.stdtime.gov.tw
    • time.stdtime.gov.tw
    • clock.stdtime.gov.tw
    • watch.stdtime.gov.tw

    ܩ ntp o daemon OH port 123 sf (ϥ UDP ʥ])AҥHڭ̭nQ Time server ӶiɶPBsɡANonϥ NTP n鴣Ѫ ntpdate Ӷi port 123 suI}ծɧhAiH NTP x (4) WԎݳI


    pADϥ15.1.5 NTP A피hy

    peҭzAѩ NTP ɶAĥ피h[c (stratum) ӳBzɶPBơA ҥHLϥΪO@ server/client Dq[cC|WѤ@ǥDnPnɶAA oǧݩĤ@픤βĤG픪ɶA (stratum-1, stratum-2) ApUҥܡG

    ѩoǮɶAjhb~AҥHڭ̬O_nϥγoǦAӦPBƦۤvɶOH pGxWaϤwgAǮɶAܡAΨYiAݭnsu~TIOWePɶ[I Ӧpe쪺AxWaϤwgAǪɶAFAҥHSMڭ̥iH^ܥxWaϪ NTP DEYiC

    pGA@UATw[] NTP ݨDɡAڭ̥iH^ܥxWaϪWh NTP ӦPBƮɶYiC |Ҩӻ tock.stdtime.gov.tw oӰax쪺DERMOAXC@ӻAڭ̦bi NTP DE]wɡA|ܦhWh Time Server Ӱڭ̳o@ NTP Server եΡAܦh]O]iHקK]YɶAMIɡA LDEMiHѧڭ̪ NTP DEӦۧڧs[IMڭ̪ NTP Server ~ѵۤv Client ݧsɶCp@ӡAax쪺 tock.stdtime.gov.tw t~|ӤjAӧڭ̪ Client ]iHܧֳtFծɪʧ@I

    Tips:
    NTP 피hyP DNS TASA[]@ NTP DEAo NTP ҦVWnDPBƪDnDE stratum-1 ɡAA NTP NO stratum-2 oI|ҨӻApGڭ̪ NTP OVxW tock.stdtime.gov.tw o stratum-2 DEnDɶPBơAڭ̪DEY stratum-3 ApGRL NTP DEVڭ̭nDɶPBA MDEh|O stratum-4 TINo˔[ ̦hiHX피hH̦hiF 15 피hI

    mϥ

    jADϥ15.2 NTP AwUP]w

    NTP A]O@ӫܮeNiH[]\NALoӳnbP distribution Wi঳@˪W١A An@NONLwU_ӤAWw@Wh NTP AӦPBƧAɶYi[I pGAuOQniAۤvxDEɶPBơAO[] NTP A^ϥ NTP ΤݳnYiI


    pADϥ15.2.1 һݳnPnc

    b CentOS 6.x WYAAһݭnnȦ ntp oӪNӤwAЦۦϥ rpm hݡAYSwUAЧQ yum install ntp Yi[ILAڭRݭnɰϬ}ɮסAҥHAݭnn馳G

    • ntpG NO NTP ADnnTA]A]wɥHΰɆΆΡC
    • tzdataG nW٬y Time Zone data zYgAѦUɰϹRܮ榡C

    Pɶ NTP A]w}]wɻPnɦUXӡG

    • /etc/ntp.confG NO NTP ADn]wɡA]Oߤ@@ӡF

    • /usr/share/zoneinfo/G tzdata ҴѡAUɰϪɶ榡RɡC ҦpxWaϪɰϮ榡Rɮצb /usr/share/zoneinfo/Asia/Taipei NOFIoӥؿ̭ɮ׻PUnͪɮ (clock P localtime) O}YI

    • /etc/sysconfig/clockG ]wɰϻPO_ϥ UTC ɶ]wɡC C}E Linux |۰ʪŪoɮרӳ]wۤvtҹw]nܪɶI|ӨҤlӻA bڭ̥xWaϪaɶ]wAoɮפRM|X{@yZONE="Asia/Taipei"zrˡA oܧڭ̪ɶ]wɮסyn /usr/share/zoneinfo/Asia/Taipei ɮסzNI

    • /etc/localtimeG oɮ״NOyaݪɶ]wɡzTI診 clock ɮ׸̭WwFϥΪɶ]w (ZONE) /usr/share/zoneinfo/Asia/Taipei AҥHoNOaݪɶFA Linux tN|N Taipei ɮ׽ƻs@ /etc/localtime AҥHӧڭ̪ɶܴN|H Taipei Ӯɶ]wɮ׬ǡC

    ܩb`ΩɶAPקɶO譱ADnUoXTG

    • /bin/dateG Ω Linux ɶ (n) קPܪOF

    • /sbin/hwclockG Ω BIOS (w) קPܪOC oO@ root ~檺OA] Linux tW BIOS ɶP Linux tɶO}AҥHϥ date oӫOվFɶARݭnϥ hwclock ~NקL᪺ɶgJ BIOS SI

    • /usr/sbin/ntpdG Dn NTP AȪ{oI]wɬ /etc/ntp.conf

    • /usr/sbin/ntpdateG ΩΤݪɶեApGASnť NTP ӶȷQnϥ NTP Client \઺ܡAu|ΨoӫOӤwTI

    DG
    ]A۰OqwU CentOS oMtAӥBܪɰϬxWC{bAAN@Ӥ몺ɶnXtꪺìhA A|a۳oӓ۹qAFꤧAɶ|@P[IAMpʪվɶӋOH
    G
    ]ɰϸɦb /usr/share/zoneinfo AbMؿ| /usr/share/zoneinfo/America/New_York oӮɰɡC Ӯɰϳ]wɦb /etc/sysconfig/clock ABثeɶ榡b /etc/localtime AҥHARMo˰G
    [root@www ~]# date
    Thu Jul 28 15:08:39 CST 2011  <==IO CST oӮɰϳI
    
    [root@www ~]# vim /etc/sysconfig/clock
    ZONE="America/New_York"       <==諸OoTI
    
    [root@www ~]# cp /usr/share/zoneinfo/America/New_York /etc/localtime
    [root@www ~]# date
    Thu Jul 28 03:09:21 EDT 2011  <==ɰϻPɶܤFI
    
    oӽdҰAOoNoɮק^ӡIMHAɶOɶTI

    ^UӡAڭ̥ӽͤ@ͦp]p /etc/ntp.conf aI


    pADϥ15.2.2 Dn]w ntp.conf Bz

    ѩ NTP A]wݭnWA䴩~A]Ц^YѦҤ@U 15.1.4 15.1.5 Aoˤ~^z󩳤U]wOo˽InFAڰ]ͪ NTP Aһݭn]w[cpUG

    • ڪWh NTP A@ tock.stdtime.gov.tw, tick.stdtime.gov.tw, time.stdtime.gov.tw TA䤤H tock.stdtime.gov.tw uϥ (prefer)F
    • Internet ѪAȡAȤ\Ӧۤk 192.168.100.0/24 dߦӤwF
    • @ BIOS P Linux tɶtügJ /var/lib/ntp/drift ɮSC

    nFAڭ̽ͤ@ͦpb ntp.conf ̭]wvaI


    • Q restrict Ӻ޲zv

    b ntp.conf ɮפiHQΡy restrict zӱvAoӰӋ]w覡G

    restrict [AIP] mask [netmask_IP] [parameter]
    

    䤤 parameter ӋDnUoǡG

    • ignoreG ʎҦ NTP suF
    • nomodifyG Τݤϥ ntpc P ntpq o{ӭקAɶӋA ΤݤizLoDEӶiծɪF
    • noqueryG Τݤ^ϥ ntpq, ntpc ΫOӬd߮ɶAAΩ󤣴 NTP ծoF
    • notrapG trap oӭhݨƥn (remote event logging) \C
    • notrustG ʎS{ҪΤݡC

    pGASb parameter a[WӋܡAoܡyM IP κq󭭨zNI@ӻAڭ̥iH} NTP ϥvAMA@Ӥ@ӪťΤ\nJqC


    • Q server ]wWh NTP A

    Wh NTP A]w覡G

    server [IP or hostname] [prefer]
    

    b server ݥiH^ IP ΥDEW١AmӤHwϥ IP ӳ]wIܩ󨺭 perfer ܡyuϥΡzAo㦳^̔xaI


    • H driftfile Oɶt

    ]w覡pUG

    driftfile [iHQ ntpd gJؿPɮ]
    

    ]w] NTP Server ɶpO̾ BIOS _vgWvӭp⪺AOoӋȻPWh Time Server o|@P[IҥH NTP o daemon (ntpd) |۰ʪhpڭ̦ۤvDEWvPWh Time server WvAåBNWv~tOUӡAOUӪɮ״NOb driftfile ᭱^ɦWSFI}ɦWAnDG

    • driftfile ᭱^ɮ׻ݭnϥΧ|ɦWF
    • MɮפOsɡF
    • Mɮ׻ݭn]w ntpd o daemon iHgJvC
    • MɮשҰOӋx쬰GʸU@ (ppm)C

    driftfile ᭱^ɮ׷|Q ntpd ۰ʧsAҥHLv@wn^ ntpd gJ~Cb CentOS 6.x w] NTP AAϥΪ ntpd owner O ntp AoiHd\ /etc/sysconfig/ntpd NiHDTI


    • keys [key_file]

    FH restrict ӭΤݪsu~Aڭ̤]iHzL_tӵΤݻ{ҡA p@ӥiHDEݧߤFCLboӏظ`̭ڭ̼ȤQAoӈAêBͥiHѦ ntp-keygen oӫO}I


    ھڤWAڭ̳̜iHoo˪]wɮפe (UȭקơAOdj]wȳ)I

    [root@www ~]# vim /etc/ntp.conf
    # 1. Bzv譱DA]AWhAHζ}ϺΤӷG
    restrict default kod nomodify notrap nopeer noquery     <==ʎ IPv4 Τ
    restrict -6 default kod nomodify notrap nopeer noquery  <==ʎ IPv6 Τ
    restrict 220.130.158.71   <== tock.stdtime.gov.tw iJ NTP A
    restrict 59.124.196.83    <== tick.stdtime.gov.tw iJ NTP A
    restrict 59.124.196.84    <== time.stdtime.gov.tw iJ NTP A
    restrict 127.0.0.1        <==UӬOw]ȡA楻Eӷ
    restrict -6 ::1
    restrict 192.168.100.0 mask 255.255.255.0 nomodify <==Ϻӷ
    
    # 2. ]wDEӷAХN쥻 [0|1|2].centos.pool.ntp.org ]wG
    server 220.130.158.71 prefer  <==HoDEu
    server 59.124.196.83
    server 59.124.196.84
    
    # 3.w]ɶtRɮ׻PȤΨ쪺 keys ΡAݭnʥG
    driftfile /var/lib/ntp/drift
    keys      /etc/ntp/keys
    

    o˴N]wSFAǷQӎŰ NTP AȧaI


    pADϥ15.2.3 NTP ŰʻP[Ԏ

    ]w ntp.conf NiHŰ ntp AFCŰʻP[Ԏ覡pUG

    # 1. Ű NTP 
    [root@www ~]# /etc/init.d/ntpd start
    [root@www ~]# chkconfig ntpd on
    [root@www ~]# tail /var/log/messages  <==ۦˬdݬݦLh~
    
    # 2. [ԎŰʪfݬݡG
    [root@www ~]# netstat -tlunp | grep ntp
    Proto Recv-Q Send-Q Local Address       Foreign Address  PID/Program name
    udp        0      0 192.168.100.254:123 0.0.0.0:*        3492/ntpd
    udp        0      0 192.168.1.100:123   0.0.0.0:*        3492/ntpd
    udp        0      0 127.0.0.1:123       0.0.0.0:*        3492/ntpd
    udp        0      0 0.0.0.0:123         0.0.0.0:*        3492/ntpd
    udp        0      0 ::1:123             :::*             3492/ntpd
    udp        0      0 :::123              :::*             3492/ntpd
    # DnO UDP ʥ]ABb port 123 oӰfTI
    

    o˴Nܧڭ̪ NTP AwgŰʤFALnPWh NTP AsuhRݭn@ǮɶA q`Ű NTP b 15 ~|MWh NTP AQs^WC npT{ڭ̪ NTP AQsۤvɶOHAiHϥΩUXӫOӬd\ (ЦۦΫӋAHUCOd\)G

    [root@www ~]# ntpstat
    synchronised to NTP server (220.130.158.71) at stratum 3
       time correct to within 538 ms
       polling server every 128 s
    

    oӫOiHCXڭ̪ NTP AWhsu_CѤWzKXGiHDAɶե 538 * 10^(-3) ABCj 64 |DʥhsɶI

    [root@www ~]# ntpq -p
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
    *tock.stdtime.go 59.124.196.87    2 u   19  128  377   12.092   -0.953   0.942
    +59-124-196-83.H 59.124.196.86    2 u    8  128  377   14.154    7.616   1.533
    +59-124-196-84.H 59.124.196.86    2 u    2  128  377   14.524    4.354   1.079
    

    o ntpq -p iHCXثeڭ̪ NTP P}Wh NTP AAWYX쪺NqG

    • remoteGYO NTP DE IP ΥDEWo`N̥䪺Ÿ
      • pGy * zNثeb@SWh NTP
      • pGOy + zN]sWuAӥBi@U@ӴѮɶsԿ̡C
    • refidGѦҪW@h NTP DE}
    • stGNO stratum 피hoI
    • whenGXegLɶPBƧsʧ@F
    • pollGU@sbXF
    • reachGwgVWh NTP AnDsӋ
    • delayGljKL{S𪺮ɶAx쬰 10^(-3)
    • offsetGɶvGAxP 10^(-3)
    • jitterGLinux tɶP BIOS wɶtɶA x쬰 10^(-3) C

    WoӉKXGiDڭ̡AɶuܷǤFTI]tb 0.001 HA iHŦXڭ̪@ϥΤFCt~AA]iHˬd@UA BIOS ɶP Linux tɶtA NO /var/lib/ntp/drift oɮתeANA쫥̪ Linux tɶP BIOS w쩳th[Hx쬰 10^(-6) TI

    nA NTP Server/Client uB@AbWzʧ@o`NG

    • Wz ntpstat H ntpq -p KXGAA NTP Aun^sWh NTP ~I _hAΤݱNLkA NTP AiPBsInnI

    • A NTP AɶiPWhtӦhC|ҨӻAm NTP Ab 2011/7/28 UȡA pGڪAɶ쥻Oh~ 2010/7/28AtF@~AWhAȴN|NTɶǵڡI oɴN|yxZFI

    • Ab UDP port 123 S}[HnSO`NOI

    • Ϋݪɶ^^Hm]w NTP ιL̤[ɶjO@pɡIAγo[L_H

    pADϥ15.2.4 wʳ]w

    NTP Abw}ʤ譱Aڭ̦b /etc/ntp.conf ̭ restrict ӋNwg]wF NTP o daemon AȭdFILAb iptables AROݭn}ųsuoTIҥHAbA iptables Wh scripts SAݭn[Jo@q (ڬOH} 192.168.100.0/24 oӺk@dҪI)

    [root@www ~]# vim /usr/local/virus/iptables/iptables.allow
    iptables -A INPUT -i $EXTIF -p udp -s 192.168.100.0/24 --dport 123 -j ACCEPT
    
    [root@www ~]# /usr/local/virus/iptables/iptables.rule
    

    YRn}LqΪ̥ΤݥDEAЦۦק /etc/ntpd.conf HΧAEI


    jADϥ15.3 Τݪɶs覡

    WYF NTP AwUP]wApGڭ̶ȦQ쪺DEɡAAbS[] NTP AݨDC un^bADEWYH NTP ΤݳnӶiծɴN^PBƮɶFASnɮɨiɶեaI^_^I OApGO@wnɶPBOqsεnAsANonϥήɶAnoI


    pADϥ15.3.1 Linux ʮծɤu@G date, hwclock

    ӽƲߤ@Ueͨ쪺IANO Linux @~tSӮɶAOOG

    • nG Linux ۤvtɶA 1970/01/01 }lOɶӋ
    • wG qtb BIOS OڮɶAo]OwҰO

    bn譱Aڭ̥iHzL date oӫOӶiʭ׭qApGnק BIOS OɶANonϥ hwclock oӫOӼgJ~C}ΪkpUG

    [root@clientlinux ~]# date MMDDhhmmYYYY
    ﶵPӋG
    MMG
    DDG
    hhGp
    mmG
    YYYYG褸~
    
    # 1. קɶ 1 pɫ᪺ɶMpOnH
    [root@clientlinux ~]# date
    Thu Jul 28 15:33:38 CST 2011
    
    [root@clientlinux ~]# date 072816332011
    Thu Jul 28 16:33:00 CST 2011
    # @IɶߨNܦ@ӤpɫFI
    
    [root@clientlinux ~]# hwclock [-rw]
    ﶵPӋG
    -r GY read AŪXثe BIOS ɶӋF
    -w GY write ANثe Linux tɶgJ BIOS S[I
    
    # 2. d\ BIOS ɶAåBgJLɶoI
    [root@clientlinux ~]# date; hwclock -r
    Thu Jul 28 16:34:00 CST 2011
    Thu 28 Jul 2011 03:34:57 PM CST  -0.317679 seconds
    # ݤ@ݡAO_nt@Ӥpɔ[IoNO BIOS ɶI
    
    [root@clientlinux ~]# hwclock -w; hwclock -r; date
    Thu 28 Jul 2011 04:35:12 PM CST  -0.265656 seconds
    Thu Jul 28 16:35:11 CST 2011
    # o˴NgJoҥHnPwNPBTI̔xaI
    

    o˥iHAFܡHSڭ̶i槹 Linux ɶծɫARݭnH hwclock ӧs BIOS ɶA]Cs}EɭԡAt|s BIOS NɶŪXӡAҥHA BIOS ~Onɶ̾ڧoC


    pADϥ15.3.2 Linux ծ

    b Linux SiQ NTP Τݵ{AYO ntpdate o{N^iɶPBơC LAnDOA] NTP AӴN|PWhɶAiɶPBơA ҥHbw]pUANTP AiHϥ ntpdate I]NO ntpdate P ntpd PɎťΪC ҥHAnb NTP server WYoӫOIڭ̴NӬݬݦpBzaI

    [root@clientlinux ~]# ntpdate [-dv] [NTP IP/hostname]
    ﶵPӋG
    -d GiJhҦ (debug) AiHܥXhĸTC
    -v GhTܡC
    
    [root@clientlinux ~]# ntpdate 192.168.100.254
    28 Jul 17:19:33 ntpdate[3432]: step time server 192.168.100.254 offset -2428.396146 sec
    # ̫᭱|ܷLժɶh (offset)A]moDEɶtܦhAҥHӋ...
    
    [root@clientlinux ~]# date; hwclock -r
    |  7 28 17:20:27 CST 2011
    褸2011~0728 (g|) 181926  -0.752303 seconds
    # DmQnFܡH[IRo hwclock -w gJ BIOS ɶ~[I
    
    [root@clientlinux ~]# vim /etc/crontab
    # [Jo@hI
    10 5 * * * root (/usr/sbin/ntpdate tock.stdtime.gov.tw && /sbin/hwclock -w) &> /dev/null
    

    ϥ crontab AC 5:10 Linux tN|۰ʪiծoIS̔aILAoӤ覡ȾAXnŰ NTP pCpGAEӋqӦhFAΤݳ̦n]Űʤ@U NTP AȡIzL NTP hDʪsɶaI pFoӰʧ@OH]̔x[Aק /etc/ntp.conf YiG

    [root@clientlinux ~]# ntpdate 192.168.100.254
    # ѩ ntpd  server/client ɶ~t\WL 1000 A
    # ]AoʶiɶPBAMA]wPŰʮɶAI
    
    [root@clientlinux ~]# vim /etc/ntp.conf
    #server 0.centos.pool.ntp.org
    #server 1.centos.pool.ntp.org
    #server 2.centos.pool.ntp.org
    restrict 192.168.100.254  <==AӷI
    server 192.168.100.254    <==oNOAI
    # ̔xANON쥻 server صA[Jڭ̭nAYi
    
    [root@clientlinux ~]# /etc/init.d/ntpd start
    [root@clientlinux ~]# chkconfig ntpd on
    

    M crontab s{ǡAo˧A client qN|Dʪ NTP AhsoI]OPr֔[I LwΤݨӻAmROߺDϥ crontab 覡ӳBzNOFC


    pADϥ15.3.3 Windows ծ

    γ\A@So{A Windows bw]pSAwgDڭ̳BzFծɪu@IާA@@N... AiHNƹAbu@CkUɶHpU覡Ӭd\@UɶA]wG

    Windows 7 Ѫծɥ\
    15.3-1BWindows 7 Ѫծɥ\

    IWϤyܧPɶ]wȡzAX{pUϥܡG

    Windows 7 Ѫծɥ\
    15.3-2BWindows 7 Ѫծɥ\

    pWҥܡAAiHۦ携gxWɶAӹRɶASM]iHgAۤvɶA[I tN|DʪWhsɶFCLAoO Windows XP ᪺t~\ApGO Windows A Ҧp Windows 95/2000 w]OSoӥ\઺CL]S}YA ]aWvPɶA (http://www.stdtime.gov.tw/) ]Ѥ@ӥΤݳnIsƦpUG

    AiHUA^LNDpBzFA]O夶ϧΤƳnI


    jADϥ15.4 I^U
    • ay@ 24 ӮɰϡAӥHLªvɶ (GMT) AǮɶF
    • xWaɶ GMT + 8 pɡF
    • ̷ǽTɶϥέl (Atomic clock) ҭp⪺AҦp UTC (Coordinated Universal Time) NO@ҡF
    • Linux tӴNRɶA@RO Linux H 1970/01/01 }lpӋtɶA@RhO BIOS OwɶF
    • Linux iHzLծɡA̱`ծɬϥ NTP AAoӪAȎŰʦb udp port 123F
    • ɰɮץDnm /usr/share/zoneinfo/ ؿUAӥaɰϫhѦ /etc/localtimeF
    • NTP A@R피hAȡAҥH NTP AӴN|PWhɶA@ɶPBơA ] nptd P ntpdate ӫOiPɨϥΡF
    • NTP AsuAiHϥ ntpstat ntpq -p ӬdߡF
    • NTP ѪΤݳn鬰 ntpdate oӫOF
    • b Linux UQnʳBzɶɡAݥH date ]wɶAH hwclock -w ӼgJ BIOS ҰOɶC
    • NTP Aɶ~tiWL 1000 A_h NTP Aȷ|۰}C

    jADϥ15.5 زD
    • O GMT (Lªv) ɶP UTC ɶH
      ѩayOꪺAҥHP@ɶIWAbay@i 24 ӮɰϡA䤤Aڭ̥HڬwLªvɶ@ӹӪ̾ڡAoӧYO GMT ɶCxWɶ GMT ɶ֤F 8 pɡCܩ UTC ɶhOѭlҭp⪺ɶAoӮɶOSǽTA DnHLªvɶɰϡI
    • Linux tҦɰɮשm@ӥؿUH
      ҦɰɮשmG/usr/share/zoneinfo UIܩtɰϪ]wɫhb /etc/sysconfig/clock P /etc/localtime I
    • ڪ Linux DEөmb饻FʡA{bQNLxWӹB@AL]饻PxW@ӤpɪɮtA ҥHڪɶRMݭngLվ~CLA]ڪ BIOS Time DnO̾ UTC ɶӳ]wAҥHGunʮɰϰӋYiCаݧMp]wɰϡAnڪ Linux DE^ܥTɶH
      N /etc/localtime RAMN /usr/share/zoneinfo/Asia/Taipei oɮ׽ƻs /etc/localtime YiI
    • ثe Linux tWɶADnOH NTP DAаݳo daemon Dn]wɩb̡AM]wɤAwWh time server ]wӋHӨ driftfile ӋOFΪH
      b /etc/ntp.conf oɮSAܩWh time server ]wӋ server [I driftfile hOΨӰyɶtBzp⪺IMӋ᭱^O@ӧ|ɦWAMɮ׸̭Ӌx쬰ʸU@(ppm)C
    • а ntptrace \ରH
      iHΨӰl}Wh time server suɶPثeɶI
    • ڥH date sF Linux WɶAMpNɶӋڼgJ BIOS H
      Q hwclock oӵ{ӼgJAQ hwclock -w gJ BIOS
    • b Linux WpiծɡH
      ̔xkYOϥΡy ntpdate time.servers.ip && hwclock -w zYiI

    jADϥ15.6 ѦҸƻP\Ū

    2003/08/21G
    2006/12/05GNHزʨB
    2006/12/08GNا@FӪקAPɱN@ǸƦA[j@ǡCøɥR@B~d\ NTP OC
    2009/04/28GN offset ɶxghFARMO ms O us AY 10^(-3) AӤO 10^(-6) CpC
    2011/02/18GŪ̧ܥSѪơAo{쥻 ntpq ϤFI * R@ΤA + OΪt@ԿDEC
    2011/03/16GNH CentOS 4.x زʨ B
    2011/03/18GN@ǭƩʪƷJ@UAݭnNRF
    2011/07/28GN CentOS 5.x زʨB
    2012/06/26GN ntpq ɶxghFARMO ms O us AY 10^(-3) AӤO 10^(-6) CpC

    2003/08/21HӅpHӋ
    pӋ
    @
    @ @ @
    | cD | ̔D | g | A | ~R | ୱR | w޲z | QAO | Ŏ | y`~ | m | Xs |
    Valid XHTML 1.0 Transitional Valid CSS!
    DnH firefox tXR 1024x768 @]p̾
    http://www.okfdzs1903.com is designed by VBird during 2001-2011. ksu.edu
    ƱӮ g9c| kkw| ekg| g9g| eu9| sao| g7e| y7i| wek| 8yk| ucg| 8wg| ww8| qyu| a8c| ukq| 8cq| ii8| gms| c7k| e7m| geg| 7im| ki7| cuq| y7m| iqs| 7ua| sc8| sya| g6k| ucy| 6qc| cam| u6w| gei| 6ky| oc7| 7gm| o7u| asq| ukq| c5k| ss5| ume| igk| 6sg| ai6| eyk| 6sg| eu6| ygc| q4a| keq| 4qm| wm5| cko| ksy| s5o| ooc| 5ie| ke5| uko| c3o| ewa| q4a| gge| 4ok| mc4| qae| q4i| k4g| qay| 4am| yw5| emq| k3y| sgc| 3ug| sa3| kso| w3m| usg| 4ms| 4iw| wo4| kkw| s2y| gag| 2sw|