³¾­ôªº Linux ¨p©Ðµæ
¬°¨ú±o¸û¨ÎÂsÄýµ²ªG¡A½Ð·R¥Î firefox ÂsÄý¥»ºô­¶
| ÁcÅé¥D¯¸ | ²Åé¥D¯¸ | °ò¦½g | ¦øªA¾¹ | ¥ø·~À³¥Î | ®à­±À³¥Î | ¦w¥þºÞ²z | °Q½×ªO | »Å¾Ç¶é | ®ÑÄy·`»~ | ³¾­ô§Ú | ±X¤s¸ê¶Ç |
¡@ ¡@ ¡@
¡@
³Ìªñ§ó·s¤é´Á¡G2011/02/18
¥»¤å¤w¤£¦AºûÅ@¡A§ó·s¤å³¹½Ð°Ñ¦Ò³o¸Ì

«Ü¦h®É­Ô¥Ñ©ó¹q¸£µwÅ骺°ÝÃD¡A©Ò¥H§Ú­Ì³£·|½Õ¾ã¤@¤U®É¶¡¡A¦nÅý¹q¸£¨t²Îªº®É¶¡¥i¥H¤@ª½«O«ù¥¿½Tªºª¬ºA¡C ¦Ó¬JµM­n½Õ¾ã®É¶¡¡A¨º»ò¦ÛµM´N·|¦³¤@­ÓÅý§Ú­Ì¥i¥H¹ï·ÓµÛ¨Ó½Õ¾ã®É¶¡ªº¡y·Ç½T®É¶¡¡z«£¡I ¦b¹ê»Ú¥Í¬¡¤¤¡A§Ú­Ì¥i¥H³z¹L¹qµø¥x¡B¼s¼½¹q¥x¡B¹q¸Üµ¥µ¥¨Ó½Õ¾ã§Ú­Ìªº¤â¿ö¡A¨º»ò¦pªG¬O¦bºô¸ô¤W©O¡H ¸Ó¦p¦óÅý§Ú­Ìªº¥D¾÷ÀH®É«O«ù¥¿½Tªº®É¶¡¸ê°T¡H¡I¥t¥~¡A¾ã­Ó¦a²y³Q¤Á¤À¦¨¬° 24 ­Ó®É°Ï¡A¨º»ò¤°»ò¬O GMT (®æªL«Âªv®É¶¡)¡A§Ú­Ì©Ò¦bªº®É°Ï¤S¬O­þ¤@°Ï©O¡HÅý§Ú­Ì¨Ó²³æªº½Í¤@½Í§a¡I


¤j¼ÐÃDªº¹Ï¥Ü¥»³¹ªº¦æ«e·Ç³Æ¤u§@
NTP ¦øªA¾¹¬O­Ó«Ü®e©ö³]©wªºªA°È¡A§A¥u­n¼ô±xºô¸ô°ò¦§Y¥i»´©öªº±N¥L³]©w¦n¡C ³o¤@³¹¨S¦³¤°»ò«Ü­«­nªº¹w²ß¥\½Ò¡A±z¥i¥H»´ÃPªº¾Ç²ß°Ú¡I ^_^


¤j¼ÐÃDªº¹Ï¥ÜÃö©ó®É°Ï»Pºô¸ô®Õ®Éªº³q°T¨ó©w
®É¶¡¹ï©ó²{¥N¤H¨Ó»¡¬O«Ü­«­nªº¡A¦]¬°¡y Time is money ¡I¡z¡C¬JµM®É¶¡¦p¦¹­«­n¡A¹ï©ó Internet ¨Ó»¡À³¸Ó¤]¬O«Ü­«­n§a¡H ¬°¤°»ò©O¡HÁÙ°O±o§Ú­Ì¦b°ò¦¾Ç²ß½g¸Ì­±½Í¨ìªº¡yµn¿ýÀɤÀªR¡z§a¡H ¦pªG§A¬[³]¤F¤@­Óµn¿ýÀÉ°O¿ý¦øªA¾¹ªº¸Ü¡A¨º»òÁ`±o­n¤ÀªR¨C­Ó¥D¾÷©Ò¶Ç¨Óªº¸ê°T§a¡H¦pªG¨C¤@³¡¥D¾÷ªº®É¶¡³£¤£¬Û¦P¡A ¨º¦p¦ó§PÂ_°ÝÃDµo¥Íªº®É¶¡ÂI¡H©Ò¥HÅo¡A¡y¨C¤@³¡¥D¾÷ªº®É¶¡¦P¨B¤Æ¡z´N«Ü­«­n¤F¡C

¨C¤@³¡¥D¾÷®É¶¡ªº¦P¨B¤Æ­«­n©Ê·íµM¤£¥u¦p¦¹¡A¥]¬A¤§«e½Í¨ìªº DHCP ¥Î¤áºÝ/¦øªA¾¹ºÝ©Ò»Ý­nªº¯²¬ù®É¶¡­­¨î¡B ºô¸ô°»´ú®É©Ò»Ý­nª`·Nªº®É¶¡ÂI¡B­è­è½Í¨ìªºµn¿ýÀɤÀªR¥\¯à¡B¨ã¦³¬ÛÃö©Êªº¥D¾÷©¼¦¹¤§¶¡ªº¿ù»~°»´úµ¥µ¥¡A ³£»Ý­n¨ã¦³¬Û¦Pªº®É¶¡¤~¯à°÷®»¥X°ÝÃD©O¡C¦n¤F¡A©³¤U«¥­Ì´N¨Ó²á¤@²á¡A¦p¦ó§Q¥Îºô¸ô¨Ó¶i¦æ¥D¾÷ªº®É¶¡¦P¨B¤Æ§a¡I


¤p¼ÐÃDªº¹Ï¥Ü¤°»ò¬O®É°Ï¡H¥þ²y¦³¦h¤Ö®É°Ï¡HGMT ¦b¨º­Ó®É°Ï¡H
¦]¬°¦a²y¬O¶êªº¡A©Ò¥H¦P¤@­Ó®É¨è¡A¦b¦a²yªº¤@Ãä¬O¥Õ¤Ñ¡A¤@Ãä¬O¶Â©]¡C¦Ó¦]¬°¤HÃþ¨Ï¥Î¤@¤Ñ 24 ¤p®Éªº¨î«×¡A©Ò¥H¡A¦b¦a²y¹ï¨¤ªº¨âÃä´NÀ³¸Ó®t¤F 12 ªº¤p®É¤~¹ï¡C¥Ñ©ó¦P¤@­Ó®É¶¡ÂI¤W­±¡A ¾ã­Ó¦a²yªº®É¶¡À³¸Ó³£¤£¤@¼Ë¡A¬°¤F¸Ñ¨M³o­Ó°ÝÃD¡A©Ò¥H¥i¥H·Q¨£ªº¡A¦a²y´N³Q¤À¦¨ 24 ­Ó®É°Ï¤F¡I

¨º»ò³o 24 ­Ó®É°Ï¬O¨Ì¾Ú¤°»ò¨Ó¹º¤Àªº©O¡H¥Ñ©ó¦a²y³Q¤HÃþ¥H¡y¸g½n«×¡z®y¼Ð¨Ó¶i¦æ©w¦ì¡A ¦Ó¸g«×¬°¹sªº¦aÂI¦b­^°ê¡y®æªL«Âªv¡z³o­Ó«°¥«©Ò¦bÁa­å­±¤W¡A (µù¡G©Ò¿×ªºÁa­å­±´N¬O¥Ñ«n·¥¤Á¨ì¥_·¥ªºª½½u¡A¦Ó¾î¤Á­±´N¬O»P¨ª¹D¥­¦æªº¤Á½u)¡A¦p¤U¹Ï©Ò¥Ü¡G

¦a²yªº¤l¤È½u¡B¸g½n«×»P®É°Ïªº¤À¹j·§©À
¹Ï¤@¡B¦a²yªº¤l¤È½u¡B¸g½n«×»P®É°Ïªº¤À¹j·§©À

¦]¬°Â¶¦a²y¤@°é¬O 360 «×¨¤¡A³o 360 «×¨¤¦@¤À¬° 24 ­Ó®É°Ï¡A·íµM¤@­Ó®É°Ï´N¬O 15 «×¨¤°Õ¡I ¤S¥Ñ©ó¬O¥H®æªL«Âªv®É¶¡¬°¼Ð·Ç®É¶¡(Greenwich Mean Time, GMT ®É¶¡)¡A¥[¤W¦a²y¦ÛÂ઺Ãö«Y¡A¦]¦¹¡A¦b®æªL«Âªv¥HªFªº°Ï°ì®É¶¡¬O¤ñ¸û§Öªº(+¤p®É)¡A ¦Ó¥H¦èªº¦a¤è·íµM´N¬O¸ûºCÅo¡I

¥H¥xÆW¬°¨Ò¡A¦]¬°¥xÆW©Ò¦b¦a¬ù¬°ªF¸g 120 «×¥_½n 25 «×¥ª¥k¡A¤S¦]¬°¥xÆW¦b®æªL«ÂªvªºªF¤è (¼o¸Ü¡I¦]¬°¬OªF¸g¹À¡I ^_^)¡A¦]¦¹¥xÆW¥»¦a®É¶¡ (local time) ·|¤ñ GMT ®É¶¡§Ö 8 ¤p®É (GMT + 8)¡C·í®æªL«Âªv®É¶¡¬°¹sÂI¡A¥xÆW´N¤w¸g¬O¦­¤W¤KÂI¤F¡I ©³¤U¬ù²¤¦C¥X¦U­Ó®É°Ïªº¦WºÙ»P©Ò¦b¸g«×¡A¥H¤Î»P GMT ®É¶¡ªº®É®t¡G

¼Ð·Ç®É°Ï
¸g«×
®É®t
GMT , Greenwich Mean Time 0   W/E ¼Ð·Ç®É¶¡
CET , Central European 15  E +1  ªF¤@°Ï
EET , Eastern European 30  E +2  ªF¤G°Ï
BT  , Baghdad 45  E +3  ªF¤T°Ï
USSR, Zone 3  60  E +4  ªF¥|°Ï
USSR, Zone 4 75  E +5  ªF¤­°Ï
Indian, First 82.3E +5.5ªF¤­¥b°Ï
USSR, Zone 5 90  E +6  ªF¤»°Ï
SST , South Sumatra 105 E +7  ªF¤C°Ï
JT  , Java 112 E +7.5ªF¤C¥b°Ï
CCT , China Coast (¥xÆW©Ò¦b¦a) 120 E +8  ªF¤K°Ï
JST , Japan 135 E +9  ªF¤E°Ï
SAST, South Australia 142 E +9.5ªF¤E¥b°Ï
GST , Guam 150 E +10 ªF¤Q°Ï
NZT , New Zealand 180 E +12 ªF¤Q¤G°Ï
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  ¦è¤@°Ï

©Ò¥HÅo¡A¥xÆW®É¶¡¬O GMT + 8 ´N«Ü®e©ö±Àºâ¥X¨Ó¤F§a¡I­n¯S§O¯d·Nªº¬O¡A«Ü¦hªB¤Í¦b¦w¸Ë Linux ªº®É­Ô¡A Á`¬O·|µo²{¥Ø«eªº®É¶¡ºC©ÎªÌ§Ö¤F 8 ¤p®É¡A¤£­nÃhºÃ¡Aµ´¹ï»P®É°Ï¦³Ãö¡I »°ºòµ¹¥L¬d¤@¤U¦p¦ó½Õ¾ã®É°Ï§a¡I ^_^¡C

¥t¥~¡A¦b¤Wªí¤¤¦³­Ó¤ñ¸û¦³½ìªº®É°Ï¡A¨º´N¬O¦b¤Ó¥­¬v¤W­±ªº°ê»Ú´«¤é½u¤F¡I§Ú­Ì­è­è»¡¡A¦b®æªL«ÂªvªºªFÃä®É¶¡·|¸û§Ö¡A ¦Ó¦b¦èÃä®É¶¡·|¸ûºC¡A¦ý¬O¨âÃä¦U¨«¤F 180 «×¤§«á´N·|¸IÀY°Ú¡I¨º¤£´N­è¦n®t¤F 24 ¤p®É¶Ü¡H¨S¿ù°Õ¡I ©Ò¥H¤~­q©w¬°¡y°ê»Ú´«¤é½u¡z°Ú¡I°ê»Ú´«¤é½u­è¦n¦b¤Ó¥­¬v¤W­±¡A¦]¦¹¡A¦pªG±z¦³§¤­¸¾÷¨ì¬ü°êªº¸gÅçÀ³¸Ó·|µo²{¡A«x¡I «ç»ò¥Xµoªº®É¶¡¬O¬P´Á¤»¤U¤È¡A§¤¤F 13 ­Ó¤p®Éªº­¸¾÷¨ì¤F¬ü°êÁÙ¬O¬P´Á¤»¡I¦]¬°­è¦n³q¹L¤F°ê»Ú´«¤é½u¡A ¤é´Á´î¤Ö¤F¤@¤Ñ³á¡I¦pªG¤Ï¹L¨Ó¡A¥Ñ¬ü°ê¨ì¥xÆW¡A¤é´Á´N·|¦h¥[¤@¤Ñ³á¡I ^_^


¤p¼ÐÃDªº¹Ï¥Ü¤°»ò¬O®L©u¸`¬ù®É¶¡ (daylight savings)¡H
°£¤F®É°Ïªº·§©À¥ý«Ø¥ß°_¨Ó¤§«á¡A²{¦b¦A¨Ó½Í¤@½Í¡A¨º»ò¤°»ò¬O¡y®L©u¸`¬ù®É¶¡¡z¡H ¬JµM¬O¡y®L©u¸`¬ù®É¶¡¡z·íµM¥D­n¬O»P®L¤Ñ¦³Ãö°Õ¡I¦]¬°¦a²y¦b¹B¦æªº®É­Ô¬O§e²{¤@­Ó¶É±×¨¤¦b¶¤Ó¶§¹BÂ઺¡A ©Ò¥H¤~¦³¬K®L¬î¥V(³o­Ó¤j®aÀ³¸Ó³£ª¾¹D°Õ¡I)¡A¦b®L¤Ñªº®É­Ô¡A¥Õ¤Ñªº®É¶¡·|¤ñ¸ûªø¡A©Ò¥H¬°¤F¸`¬ù¥Î¹q¡A ¦]¦¹¦b®L¤Ñªº®É­Ô¬Y¨Ç¦a°Ï·|±N¥L­Ìªº®É¶¡©w¦­¤@¤p®É¡A¤]´N¬O»¡¡A­ì¥»®É°Ï¬O 8 ÂI¦n¤F¡A ¦ý¬O¦]¬°®L¤Ñ¤Ó¶§¤ñ¸û¦­¥X²{¡A¦]¦¹§â®É¶¡¦V«e®¿¡A¦b 8 ÂIªº®É­Ô¡A­q©w¬°¸Ó¤Ñªº 7 ÂI¡ã¦p¦¹¤@¨Ó¡A §Ú­Ì´N¥i¥H§Q¥Î¶§¥ú·Ó©ú¡A¬Ù¥h¤Fªá¶O¹q¤Oªº®É¶¡¡A¦]¦¹¤~·|ºÙ¤§¬°®L©u¸`¬ù®É¶¡¡I

¦]¬°¥xÆW¹ê¦b¬O¤Ó¤p¤F¡A¨Ã¨S¦³¾î¸ó¨â­Ó®É°Ï¡A¦]¦¹¡A®L©u¸`¬ù®É¶¡¹ï§Ú­Ì¨Ó»¡¡AÁöµMÁÙ¬O¦³À°§U°Õ¡I ¤£¹L¡A¦ü¥G¨S¦³¯S§O±À¦æªº¼Ë¤l»¡¡ã


¤p¼ÐÃDªº¹Ï¥ÜCoordinated Universal Time (UTC)»P¨t²Î®É¶¡ªº»~®t
ÁA¸Ñ¤F¤@¨Ç®É°Ïªº·§©À¤§«á¡A³o¸Ì­n½Íªº¬O¡y¤°»ò¬O¥¿½Tªº®É¶¡¡z¡C ¦b­pºâ®É¶¡ªº®É­Ô¡A³Ì·Ç½Tªº­pºâÀ³¸Ó¬O¨Ï¥Î¡y­ì¤l¾_Àú¶g´Á¡z©Ò­pºâªºª«²z®ÉÄÁ¤F (Atomic Clock, ¤]³QºÙ¬°­ì¤lÄÁ)¡A³o¤]³Q©w¸q¬°¼Ð·Ç®É¶¡ (International Atomic Time)¡C¦Ó§Ú­Ì±`±`¬Ý¨£ªº UTC ¤]´N¬O Coordinated Universal Time (¨ó©M¼Ð·Ç®É¶¡)´N¬O§Q¥Î³oºØ Atomic Clock ¬°°ò·Ç©Ò©w¸q¥X¨Óªº¥¿½T®É¶¡¡C¨Ò¦p 1999 ¦~¦b¬ü°ê±Ò¥Îªº­ì¤lÄÁ NIST F-1¡A ¥L©Ò²£¥Íªº®É¶¡»~®t¨C¨â¤d¦~¤~®t¤@¬íÄÁ¡I¯uªº¬O«Ü·Ç§o¡I³o­Ó UTC ¼Ð·Ç®É¶¡¬O¥H GMT ³o­Ó®É°Ï¬°¥Dªº³á¡I©Ò¥H¥»¦a®É¶¡»P UTC ®É¶¡ªº®É®t´N¬O¥»¦a®É¶¡»P GMT ®É¶¡ªº®É®t´N¬O¤F¡I

¨Æ¹ê¤W¡A¦b§Ú­Ìªº¨­Ãä´N¦³«Ü¦hªº­ì¤lÄÁ¡A¨Ò¦p¥Û­^ªí¡AÁÙ¦³¹q¸£¥D¾÷¤W­±ªº BIOS ¤º³¡´N§t¦³¤@­Ó­ì¤lÄÁ¦b¬ö¿ý»P­pºâ®É¶¡ªº¶i¦æ§o¡I¤£¹L¥Ñ©ó­ì¤lÄÁ¥D­n¬O§Q¥Î­pºâ´¹¤ù (crystal) ªº­ì¤l¾_Àú¶g´Á¥h­p®Éªº¡A³o¬O¦]¬°¨CºØ´¹¤ù³£¦³¦Û¤vªº¿W¯Sªº¾_Àú¶g´Á¤§¬G¡C µM¦Ó¦]¬°³oºØ´¹¤ùªº¾_Àú¶g´Á¦b¤£¦Pªº´¹¤ù¤§¶¡¦h¦h¤Ö¤Ö³£·|¦³ÂI®t²§©Ê¡A ¬Æ¦Ü¦P¤@§å´¹¤ù¤]¥i¯à·|©Î¦h©Î¤Ö¦³¨Ç³\ªº®t²§(´N³s·Å«×¤]¥i¯à³y¦¨³o¼Ëªº»~®t©O¡I)¡A¦]¦¹¤]´N³y¦¨¤F BIOS ªº®É¶¡·|¤T¤£¤­®Éªºµ¹¥L§Ö¤F´X¬í©ÎªÌºC¤F´X¬í¡C

©Î³\±z·|»{¬°¡ABIOS ­p®É¾¹¨C¤Ñ§Ö­Ó¤­¬í¤]¨S¦³¤°»ò¤F¤£°_ªº¡A¤£¹L¦pªG±z¦A¥J²Óªººâ¤@ºâ¡A·|µo²{¡A¤@¤Ñ§Ö¤­¬í¡A ¨º»ò¤@­Ó¤ë§Ö2.5¤ÀÄÁ¡A¤@¦~´N§Ö¤F 75 ¤ÀÄÁ¤F¡I©Ò¥H»¡¡A¨þ¨þ¡I®É¶¡®t¬O¯uªº·|¦s¦bªº¡I ¨º»ò¦pªG±zªº¹q¸£¯uªº¦³³o¼Ëªº±¡ªp¡A¨º­n«ç»ò¨Ó­«·s®Õ¥¿®É¶¡©O¡H¨º´N»Ý­n¡yºô¸ô®Õ®É¡z (Network Time Protocol, NTP) ªº¥\¯à¤F¡I©³¤U§Ú­Ì´N½Í¤@½Í¨º­Ó NTP ªº daemon §a¡I


¤p¼ÐÃDªº¹Ï¥ÜNTP ³q°T¨ó©w
¦p¦P«e­±»¡ªº¡A¹q¸£¥D¾÷¥D­n¬O¥H BIOS ¤º³¡ªº®É¶¡¬°¥D­nªº®É¶¡¨Ì¾Ú¡A¦Ó°¾°¾³o­Ó®É¶¡¥i¯à¦]¬° BIOS ¤º³¡´¹¤ù¥»¨­ªº°ÝÃD¡A¦Ó¾É­P BIOS ®É¶¡»P¼Ð·Ç®É¶¡ (UTC) ¦³¤@ÂIÂIªº®t²§¦s¦b¡I ©Ò¥H¬°¤FÁקK¥D¾÷®É¶¡¦]¬°ªø´Á¹B§@¤U©Ò¾É­Pªº®É¶¡°¾®t¡A¶i¦æ®É¶¡¦P¨B (synchronize) ªº¤u§@´NÅ㪺«Ü­«­n¤F¡I

¨º»ò«ç»òÅý®É¶¡¦P¨B¤Æ©O¡H·Q¤@·Q¡A¦pªG§Ú­Ì¿ï¾Ü´X³¡¥D­n¥D¾÷ (Primary server) ½Õ®Õ®É¶¡¡AÅý³o¨Ç Primary Servers ªº®É¶¡¦P¨B¤§«á¡A¦A¶}©ñºô¸ôªA°È¨ÓÅý Client ºÝ³s½u¡A¨Ã¥B´£¨Ñ Client ºÝ½Õ¾ã¦Û¤vªº®É¶¡¡A¤£´N¥i¥H¹F¨ì¥þ³¡ªº¹q¸£®É¶¡¦P¨B¤Æªº¹B§@¤F¶Ü¡I¨º»ò¤°»ò¨ó©w¥i¥H¹F¨ì³o¼Ëªº¥\¯à©O¡H¨º´N¬O Network Time Protocol ¡A¥t¥~ÁÙ¦³ Digital Time Synchronization Protocol (DTSS) ¤]¥i¥H¹F¨ì¬Û¦Pªº¥\¯à¡I

¤£¹L¡A¨ì©³ NTP ³o­Ó daemon ¬O¦p¦óÅý Server »P Client ¦P¨B¥L­Ìªº®É¶¡©O¡H
  1. ­º¥ý¡A¥D¾÷·íµM»Ý­n±Ò°Ê³o­Ó daemon ¡A¤§«á¡A
  2. Client ·|¦V NTP Server µo°e¥X½Õ®Õ®É¶¡ªº message ¡A
  3. µM«á NTP Server ·|°e¥X¥Ø«eªº¼Ð·Ç®É¶¡µ¹ Client ¡A
  4. Client ±µ¦¬¤F¨Ó¦Û Server ªº®É¶¡«á¡A·|¾Ú¥H½Õ¾ã¦Û¤vªº®É¶¡¡A´N¹F¦¨¤Fºô¸ô®Õ®É«£¡I
¤£¹L¡A¦b¤W­±ªº¨BÆJ¤¤±z¦³¨S¦³·Q¨ì¤@¥ó¨Æ°Ú¡A¨º´N¬O¦pªG Client ¨ì Server ªº°T®§¶Ç°e®É¶¡¹Lªø«ç»ò¿ì¡HÁ|¨Ò¨Ó»¡¡A§Ú¦b¥xÆW¥H ADSL ªº PC ¥D¾÷¡A³s½u¨ì¬ü°êªº NTP Server ¥D¾÷¶i¦æ®É¶¡¦P¨B¤Æ­n¨D¡A¦Ó¬ü°ê NTP Server ¦¬¨ì§Úªº­n¨D¤§«á¡A´Nµo°e·í®Éªº¥¿½T®É¶¡µ¹§Ú¡A¤£¹L¡A ¥Ñ¬ü°ê±N¸ê®Æ¶Ç°e¦^§Úªº PC ®É¡A®É¶¡¥i¯à¤w¸g©µ¿ð¤F 10 ¬íÄÁ¥h¤F¡I³o¼Ë¤@¨Ó¡A§Úªº PC ®Õ¥¿ªº®É¶¡¬O 10 ¬íÄÁ«eªº¼Ð·Ç®É¶¡³á¡I¦¹¥~¡A¦pªG¬ü°ê¨º»ò NTP ¥D¾÷¦³¤Ó¦hªº¤H³ßÅw¤W¥h¶i¦æºô¸ô®Õ®É¤F¡A©Ò¥H loading (­t²ü) ¤Ó­«°Õ¡I¾É­P°T®§ªº¦^¶Ç¤S©µ¿ðªº§ó¬°ÄY­«¡I¨º«ç»ò¿ì¡H

¬°¤F³o¨Ç©µ¿ðªº°ÝÃD¡A¦³¤@¨Ç program ¤w¸g¶}µo¤F¦Û°Ê­pºâ®É¶¡¶Ç°e¹Lµ{ªº»~®t¡A¥H§ó·Ç½Tªº®Õ·Ç¦Û¤vªº®É¶¡¡I·íµM°Õ¡A¦b daemon ªº³¡¤À¡A¤]¦P®É¥H server/client ¤Î master/slave ªº¬[ºc¨Ó´£¨Ñ¨Ï¥ÎªÌ¶i¦æºô¸ô®Õ®Éªº°Ê§@¡I©Ò¿×ªº master/slave ´N¦³ÂIÃþ¦ü DNS ªº¨t²Î«£¡IÁ|¨Ò¨Ó»¡¡A¥xÆWªº¼Ð·Ç®É¶¡¥D¾÷¥h°ê»Ú¼Ð·Ç®É¶¡ªº¥D¾÷®Õ®É¡A µM«á¦U¤j±M°|®Õ¦A¨ì¥xÆWªº¼Ð·Ç®É¶¡®Õ®É¡AµM«á§Ú­Ì¦A¨ì¦U¤j±M°|®Õªº¼Ð·Ç®É¶¡®Õ®É¡I³o¼Ë¤@¨Ó¡A¨º´X³¡°ê»Ú¼Ð·Ç®É¶¡¥D¾÷ (Time server) ªº loading ´N¤£¦Ü©ó¤Ó¤j¡A¦Ó§Ú­Ì¤]¥i¥H«Ü§Ö³tªº¹F¨ì¥¿½Tªººô¸ô®Õ®Éªº¥Øªº©O¡I¥xÆW±`¨£ªº Time Server ¦³¡G
  • tock.stdtime.gov.tw
  • time.stdtime.gov.tw
  • clock.stdtime.gov.tw
  • freq_f.stdtime.gov.tw
  • tick.stdtime.gov.tw
¦Ü©ó ntp ³o­Ó daemon ¬O¥H port 123 ¬°³sµ²ªº°ð¤f (¨Ï¥Î UDP «Ê¥])¡A©Ò¥H§Ú­Ì­n§Q¥Î Time server ¨Ó¶i¦æ®É¶¡ªº¦P¨B§ó·s®É¡A´N±o­n¨Ï¥Î NTP ®M¥ó´£¨Ñªº ntpdate ¨Ó¶i¦æ port 123 ªº³s½u³á¡IÃö©óºô¸ô®Õ®É§ó¦hªº»¡©ú¡A¥i¥H¨ì NTP ªº©x¤èºô¯¸¤W¹î¬Ý³á¡I

¤j¼ÐÃDªº¹Ï¥ÜNTP ¦øªA¾¹ªº¦w¸Ë»P³]©w
NTP ¦øªA¾¹¤]¬O¤@­Ó«Ü®e©ö´N¥i¥H¬[³]¦¨¥\ªºª±·N¨à¡A¤£¹L³o­Ó®M¥ó¦b¤£¦Pªº distribution ¤W­±¥i¯à¦³¤£¤@¼Ëªº¦WºÙ¡A §A­n§@ªº¨ä¹ê´N¬O±N¥L¦w¸Ë°_¨Ó¤§«á¡A³W©w¤@³¡¤W¼h NTP ¦øªA¾¹¨Ó¦P¨B¤Æ§Aªº®É¶¡§Y¥i°Ú¡I ¦pªG§A¥u¬O·Q­n¶i¦æ§A¦Û¤v³æ³¡¥D¾÷ªº®É¶¡¦P¨B¤Æ¡A§O¬[³] NTP ¡Aª½±µ¨Ï¥Î NTP ¥Î¤áºÝ³nÅé§Y¥i³á¡I


¤p¼ÐÃDªº¹Ï¥Ü©Ò»Ý®M¥ó»P®M¥óµ²ºc
¦b CentOS ¤WÀY¡A§A©Ò»Ý­nªº®M¥ó¨ä¹ê¶È¦³ ntp ³o­Óª±·N¨à¦Ó¤w¡A½Ð¦Û¦æ¨Ï¥Î rpm ¥h§ä§ä¬Ý¡A ­Y¨S¦³¦w¸Ë¡A½Ð®³¥X­ìª©¥úºÐ¨Ó¦w¸Ë¡A©ÎªÌ§Q¥Î yum install ntp §Y¥i°Ú¡I ¸U¤@§ä¤£¨ìªº¸Ü¡A¨º´N¥Î Tarball ªº¤è¦¡¨Ó¦w¸Ë§a¡I½Ð¦Û¦æ«e©¹ ntp ©x¤èºô¯¸¤U¸ü­ì©l½X¨Ó¦w¸Ë¥ý¡C ¤£¹L¡A§Ú­ÌÁٻݭn®É°Ï¬ÛÃöªº¸ê®ÆÀɮסA©Ò¥H§A»Ý­nªº®M¥ó¦³¡G
  • ntp
    ´N¬O NTP ¦øªA¾¹ªº¥D­n®M¥ó°Õ¡A¥]¬A³]©wÀÉ¥H¤Î°õ¦æÀɵ¥µ¥¡A³£¬O³o­Ó®M¥ó´£¨Ñªº¡F

  • tzdata
    ®M¥ó¦WºÙ¬°¡y Time Zone data ¡zªºÁY¼gÅo¡ã¥D­n´£¨Ñ¤F¦U­Ó®É°Ï¹ïÀ³ªºÅã¥Ü®æ¦¡¡C
¦Ü©ó§A»Ý­nªºÀɮפ譱¡A¥D­n¦³³o´X­Óª±·N¨à°Õ¡G
  • /etc/ntp.conf
    ³o­Ó¬O NTP daemon ªº¥D­n³]©wÀÉ¡A¨Ì¾Ú¤£¦Pªºª©¥»©ñ¸mªº¥Ø¿ý¥i¯à·|¤£¦P¡A¤£¹LÀɦW³£¬O¤@¼Ëªº¡I¨Ï¥Î locate ntp.conf ·j´M¤@¤U±zªº¨t²Î¦³¨S¦³³o­ÓÀɮקa¡I³o¤]¬O NTP °ß¤@ªº¤@­Ó³]©wÀɮסI

  • /usr/share/zoneinfo/
    ³o¬O­Ó¥Ø¿ý¡A³o­Ó¥Ø¿ý¬O Linux ¥»¨­´£¨Ñªº¡A¦Ó¤£¬O NTP ©Ò´£¨Ñªº¡C ¦b³o­Ó¥Ø¿ý¤UªºÀɮרä¹ê¬O³W©w¤F¦U¥D­n®É°Ïªº®É¶¡³]©wÀɮסA¨Ò¦p¥xÆW¦a°Ïªº®É°Ï³]©wÀɮצb /usr/share/zoneinfo/Asia/Taipei ´N¬O¤F¡I³o­Ó¥Ø¿ý¸Ì­±ªºÀÉ®×»P©³¤U­n½Íªº¨â­ÓÀÉ®× (clock »P localtime) ¬O¦³Ãö«Yªº³á¡I

  • /etc/sysconfig/clock
    ³o­ÓÀɮרä¹ê¤]¤£¥]§t¦b NTP ªº daemon ·í¤¤¡A¦]¬°³o­Ó¬O linux ªº¥D­n®É°Ï³]©wÀÉ®×°Ú¡I¨C¦¸¶}¾÷«á Linux ·|¦Û°ÊªºÅª¨ú³o­ÓÀɮרӳ]©w¦Û¤v¨t²Î©Ò¹w³]­nÅã¥Üªº®É¶¡»¡¡IÁ|­Ó¨Ò¤l¨Ó»¡¡A ¦b§Ú­Ì¥xÆW¦a°Ïªº¥»¦a®É¶¡³]©w¤¤¡A³o­ÓÀɮפºÀ³¸Ó·|¥X²{¤@¦æ¡yZONE="Asia/Taipei"¡zªº¦r¼Ë¡A ³oªí¥Ü§Ú­Ìªº®É¶¡³]©wÀɮסy­n¨ú¥Î /usr/share/zoneinfo/Asia/Taipei ¨º­ÓÀɮסzªº·N«ä¡I

  • /etc/localtime
    ³o­ÓÀÉ®×´N¬O¡y¥»¦aºÝªº®É¶¡³]©wÀÉ¡z°Õ¡I­è­è¨º­Ó clock Àɮ׸̭±³W©w¤F¨Ï¥Îªº®É¶¡³]©wÀÉ (ZONE) ¬° /usr/share/zoneinfo/Asia/Taipei ¡A©Ò¥H»¡³o´N¬O¥»¦aºÝªº®É¶¡¤F¡A¦¹®É Linux ¨t²Î´N·|±N Taipei ¨º­ÓÀɮ׽ƻs¤@¥÷¦¨¬° /etc/localtime ¡A©Ò¥H¥¼¨Ó§Ú­Ìªº®É¶¡Åã¥Ü´N·|¥H Taipei ¨º­Ó®É¶¡³]©wÀɮ׬°·Ç¡C

    ¦n¤F¡A¦pªG²{¦b§Ú³o³¡¥D¾÷·h¨ì¤é¥»ªF¨Ê¥h¤F¡A¨º»ò§ÚÀ³¸Ó¦p¦ó½Õ¾ã®É¶¡©O¡H¨ä¹ê¤°»ò½Õ¾ã³£¤£»Ý­n¡A¦]¬°§Ú­Ìªº localtime ¥D­n¬O¤ÀªR»P UTC ®É¶¡ªº®É®t¨ÓÅã¥Üªº®æ¦¡¡A©Ò¥H¡A±z¥u­n±N /etc/sysconfig/clock ¸Ì­±ªº ZONE ³]©w¦¨¬° Asia/Tokyo ¨Ã¥B±N /usr/share/zoneinfo/Asia/Tokyo ½Æ»s¦¨¬° /etc/localtime ¡A¨þ¨þ¡I´N¯àÅã¥Ü®É¶¡¬°¤é¥»ªF¨Êªº®É¶¡¤F¡I³o¼Ë¬O§_¯à°÷ÁA¸Ñ¡H

  • /bin/date
    ³o­Ó¬O Linux ¨t²Î¤W­±±`¨£ªº¤é´Á»P®É¶¡¿é¥X«ü¥O¡A¥Î³~«Ü¼s³á¡I°£¤F¿é¥X®É¶¡¥~¡A¤]¥i¥H­×§ï®É¶¡¡C

  • /sbin/hwclock
    ³o¬O¤@­Ó root ¤~¯à°õ¦æªº«ü¥O¡A¦]¬° Linux ¨t²Î¤W­± BIOS ®É¶¡»P Linux ¨t²Î®É¶¡¬O¤À¶}ªº¡A©Ò¥H¨Ï¥Î date ³o­Ó«ü¥O½Õ¾ã¤F®É¶¡¤§«á¡AÁٻݭn¨Ï¥Î hwclock ¤~¯à±N­×§ï¹L«áªº®É¶¡¼g¤J BIOS ·í¤¤¡I

  • /usr/sbin/ntpd
    ³o´N¬O NTP ªº¥D­n daemon ÀÉ®×°Õ¡I±o­n±Ò°Ê¥L¤~¯à´£¨Ñ NTP ªA°È¡Cª`·N¡A³o­Ó«ü¥O¹w³]·|°Ñ¦Ò /etc/ntp.conf ¸Ì­±ªº³]©w³á¡I

  • /usr/sbin/ntpdate
    ³o­Ó´N¬O Client ºÝ¥Î¨Ó³s±µ NTP Server ªº¥D­n°õ¦æÀÉÅo¡I¦pªG±z¨S¦³­n±Ò¥Î NTP ¦Ó¶È·Q­n¨Ï¥Î NTP Client ¥\¯àªº¸Ü¡A¨º»ò¥u·|¥Î¨ì³o­Ó«ü¥O¦Ó¤w°Õ¡I

  • /usr/sbin/ntptrace
    ³o­Ó«ü¥O¥i¥H¥Î¨Ó°lÂܬY³¡®É¶¡¦øªA¾¹ªº®É¶¡¹ïÀ³Ãö«Y¡A³o¤]¬O­Ó«Ü¦³¥Îªº«ü¥O³á¡I©³¤U§Ú­Ì·|¤¶²Ð¦p¦ó¨Ï¥Î³o¤äµ{¦¡¡I
±µ¤U¨Ó¡A§Ú­Ì¥ý¨Ó½Í¤@½Í¦p¦ó³]­p¨º­Ó /etc/ntp.conf §a¡I


¤p¼ÐÃDªº¹Ï¥Ü¥D­n³]©wÀÉ ntp.conf ªº³B²z
¦p«e©Ò­z¡A¥Ñ©ó NTP ®É¶¡¦øªA¾¹±Ä¥ÎÃþ¦ü¶¥¼h¬[ºc (stratum) ¨Ó³B²z®É¶¡ªº¦P¨B¤Æ¡A ©Ò¥H¥L¨Ï¥Îªº¬OÃþ¦ü¤@¯ë server/client ªº¥D±q¬[ºc¡Cºô¸ôªÀ·|¤W­±¦³´£¨Ñ¤@¨Ç¥D­n»P¦¸­nªº®É¶¡¦øªA¾¹¡A ³o¨Ç§¡ÄÝ©ó²Ä¤@¶¥¤Î²Ä¤G¶¥ªº®É¶¡¦øªA¾¹ (stratum-1, stratum-2) ¡A¦p¤U©Ò¥Ü¡G
¥Ñ©ó³o¨Ç®É¶¡¦øªA¾¹¤j¦h¦b°ê¥~¡A©Ò¥H§Ú­Ì¬O§_­n¨Ï¥Î³o¨Ç¦øªA¾¹¨Ó¦P¨B¤Æ¦Û¤vªº®É¶¡©O¡H ¨ä¹ê¦pªG¥xÆW¦a°Ï¤w¸g¦³¼Ð·Ç®É¶¡¦øªA¾¹ªº¸Ü¡A¥Î¨º³¡§Y¥i¡A¤£»Ý­n³s½u¨ì°ê¥~°Õ¡I®ö¶OÀW¼e»P®É¶¡°Ú¡I ¦Ó¦p«e­±´£¨ìªº¡A¥xÆW¦a°Ï¤w¸g¦³²Ä¤G¶¥ªº®É¶¡¦øªA¾¹¤F¡A©Ò¥H·íµM§Ú­Ì¥i¥Hª½±µ¿ï¾Ü¥xÆW¦a°Ïªº NTP ¥D¾÷§Y¥i¡C

  • ®É¶¡¦øªA¾¹ªº¶¥¼h·§©À
  • ¨ä¹ê NTP ªº¶¥¼h·§©À»P DNS «ÜÃþ¦ü°Õ¡A·í§A¬[³]¤@³¡ NTP ¥D¾÷¡A³o³¡ NTP ©Ò¦V¤W­n¨D¦P¨B¤Æªº¨º³¡¥D­n¥D¾÷¬° stratum-1 ®É¡A¨º»ò§Aªº NTP ´N¬O stratum-2 Åo¡IÁ|¨Ò¨Ó»¡¡A¦pªG§Ú­Ìªº NTP ¬O¦V¥xÆWªº tock.stdtime.gov.tw ³o³¡ stratum-2 ªº¥D¾÷­n¨D®É¶¡¦P¨B¤Æ¡A¨º§Ú­Ìªº¥D¾÷§Y¬° stratum-3 ¡A¦pªGÁÙ¦³¨ä¥Lªº NTP ¥D¾÷¦V§Ú­Ì­n¨D®É¶¡¦P¨B¡A ¨º»ò¸Ó³¡¥D¾÷«h·|¬O stratum-4 °Õ¡I´N³o¼Ë°Ú¡ã ¨º³Ì¦h¥i¥H¦³´X­Ó¶¥¼h¡H³Ì¦h¥i¹F 15 ­Ó¶¥¼h³á¡I

    ¦pªG§Aµû¦ô¤@¤U¡A½T©w¦³¬[³] NTP ªº»Ý¨D®É¡A§Ú­Ì¥i¥Hª½±µ¿ï¾Ü¥xÆW¦a°Ïªº¤W¼h NTP ¨Ó¦P¨B¤Æ®É¶¡§Y¥i¡C Á|¨Ò¨Ó»¡ tock.stdtime.gov.tw ³o­Ó°ê®a³æ¦ìªº²Ä¤G¼h¥D¾÷ (stratum-2) À³¸Ó¬O¤ñ¸û¾A¦Xªº¡C ¤@¯ë¨Ó»¡¡A§Ú­Ì¦b¶i¦æ NTP ¥D¾÷ªº³]©w®É¡A³£·|¥ý¿ï¾Ü¦h³¡¤W¼hªº Time Server ¨Ó°µ¬°§Ú­Ì³o¤@³¡ NTP Server ªº®Õ¥¿¤§¥Î¡A¿ï¾Ü¦h³¡ªº­ì¦]¬O¦]¬°¥i¥HÁקK¦]¬°¬Y³¡®É¶¡¦øªA¾¹¬ðµM±¾ÂI®É¡A ¨ä¥L¥D¾÷¤´µM¥i¥H´£¨Ñ§Ú­Ìªº NTP ¥D¾÷¨Ó¦Û§Ú§ó·s°Ú¡IµM«á§Ú­Ìªº NTP Server ¤~´£¨Ñµ¹¦Û¤vªº Client ºÝ§ó·s®É¶¡¡C¦p¦¹¤@¨Ó¡A°ê®a³æ¦ìªº tock.stdtime.gov.tw ­t¸ü¤~¤£·|¤Ó¤j¡A¦Ó§Ú­Ìªº Client ¤]¥i¥H«Ü§Ö³tªº¹F¨ì®Õ®Éªº°Ê§@¡I

    ¦n¤F¡A§Ú°²³]­Íªº NTP ¦øªA¾¹©Ò»Ý­n³]©wªº¬[ºc¦p¤U¡G
    • §Úªº¤W¼h NTP ¦øªA¾¹¦@¦³ tock.stdtime.gov.tw, tick.stdtime.gov.tw, time.stdtime.gov.tw ¤T³¡¡A¨ä¤¤¥H tock.stdtime.gov.tw ³ÌÀu¥ý¨Ï¥Î (prefer)¡F
    • ¤£¹ï Internet ´£¨ÑªA°È¡A¶È¤¹³\¨Ó¦Û¤º³¡ºô°ì 192.168.1.0/24 ªº¬d¸ß¦Ó¤w¡F
    • °»´ú¤@¨Ç BIOS ®ÉÄÁ»P Linux ¨t²Î®É¶¡ªº®t²§¨Ã¼g¤J /var/lib/ntp/drift ÀÉ®×·í¤¤¡C
    ¦n¤F¡A¥ýÅý§Ú­Ì½Í¤@½Í¦p¦ó¦b ntp.conf ¸Ì­±³]©wÅv­­±±¨î§a¡I


  • §Q¥Î restrict ¨ÓºÞ²zÅv­­±±¨î
  • ¦b ntp.conf Àɮפº¥i¥H§Q¥Î¡y restrict ¡z¨Ó±±ºÞÅv­­¡A³o­Ó°Ñ¼Æªº³]©w¤è¦¡¬°¡G
    restrict [§AªºIP] mask [netmask_IP] [parameter]
    
    ¨ä¤¤ parameter ªº°Ñ¼Æ¥D­n¦³©³¤U³o¨Ç¡G
    • ignore
      ©Úµ´©Ò¦³Ãþ«¬ªº NTP ³s½u¡F

    • nomodify
      ¥Î¤áºÝ¤£¯à§ó§ï NTP ¦øªA¾¹ªº®É¶¡°Ñ¼Æ¡A³o§Yªí¥Ü¥Î¤áºÝ¤£¯à¨Ï¥Î ntpc »P ntpq ³o¨â¤äµ{¦¡¨Ó­×§ï¦øªA¾¹Åo¡C ¦ý¥Î¤áºÝ¤´¥i³z¹L³o³¡¥D¾÷¨Ó¶i¦æºô¸ô®Õ®Éªº¡F

    • noquery
      ¥Î¤áºÝ¤£¯à°÷¨Ï¥Î ntpq, ntpc µ¥«ü¥O¨Ó¬d¸ß®É¶¡¦øªA¾¹¡Aµ¥©ó¤£´£¨Ñ NTP ªººô¸ô®Õ®ÉÅo¡F

    • notrap
      ¤£´£¨Ñ trap ³o­Ó»·ºÝ¨Æ¥óµn¿ý (remote event logging) ªº¥\¯à¡C

    • notrust
      ©Úµ´¨S¦³»{ÃÒªº¥Î¤áºÝ¡C
    ¨º¦pªG§A¨S¦³¦b parameter ªº¦a¤è¥[¤W¥ô¦ó°Ñ¼Æªº¸Ü¡A³oªí¥Ü¡y¸Ó IP ©Îºô¬q¤£¨ü¥ô¦ó­­¨î¡zªº·N«ä³á¡I¤@¯ë¨Ó»¡¡A§Ú­Ì¥i¥H¥ýÃö³¬ NTP ªº¨Ï¥ÎÅv­­¡AµM«á¦b¤@­Ó¤@­Óªº±Ò¥Î¤¹³\µn¤Jªººô¬q¡C


  • §Q¥Î server ³]©w¤W¼h NTP ¦øªA¾¹
  • ¤W¼h NTP ¦øªA¾¹ªº³]©w¤è¦¡¬°¡G
    server [IP or hostname] [prefer]
    
    ¦b server «áºÝ¥i¥H±µ IP ©Î¥D¾÷¦WºÙ¡A³¾­ô­Ó¤H¤ñ¸û³ßÅw¨Ï¥Î¥D¾÷¦WºÙ¨Ó³]©w»¡¡I ¦Ü©ó¨º­Ó perfer ªí¥Ü¡yÀu¥ý¨Ï¥Î¡zªº¥D¾÷Åo¡ã¦³°÷²³æ§a¡I


  • ¥H driftfile °O¿ý®É¶¡®t²§
  • ³]©wªº¤è¦¡¦p¤U¡G
    driftfile [¥i¥H³Q ntpd ¼g¤Jªº¥Ø¿ý»PÀÉ®×]
    
    ¦]¬°¹w³]ªº NTP Server ¥»¨­ªº®É¶¡­pºâ¬O¨Ì¾Ú BIOS ªº´¹¤ù¾_Àú¶g´ÁÀW²v¨Ó­pºâªº¡A¦ý¬O³o­Ó¼Æ­È»P¤W¼h Time Server ¤£¨£±o·|¤@­P°Ú¡I©Ò¥H NTP ³o­Ó daemon (ntpd) ·|¦Û°Êªº¥h­pºâ§Ú­Ì¦Û¤v¥D¾÷ªºÀW²v»P¤W¼h Time server ªºÀW²v¡A¨Ã¥B±N¨â­ÓÀW²vªº»~®t°O¿ý¤U¨Ó¡A°O¿ý¤U¨ÓªºÀÉ®×´N¬O¦b driftfile «á­±±µªº§¹¾ãÀɦW·í¤¤¤F¡IÃö©óÀɦW§A¥²¶·­nª¾¹D¡G
    • driftfile «á­±±µªºÀɮ׻ݭn¨Ï¥Î§¹¾ã¸ô®|ÀɦW¡F
    • ¸ÓÀɮפ£¯à¬O³sµ²ÀÉ¡F
    • ¸ÓÀɮ׻ݭn³]©w¦¨ ntpd ³o­Ó daemon ¥i¥H¼g¤JªºÅv­­¡C
    • ¸ÓÀɮשҰO¿ýªº¼Æ­È³æ¦ì¬°¡G¦Ê¸U¤À¤§¤@¬í (ppm)¡C
    driftfile «á­±±µªºÀÉ®×·|³Q ntpd ¦Û°Ê§ó·s¡A©Ò¥H¥LªºÅv­­¤@©w­n¯à°÷Åý ntpd ¼g¤J¤~¦æ¡C¦b CentOS 4.x ¹w³]ªº NTP ¦øªA¾¹¤¤¡A¨Ï¥Îªº ntpd ªº owner ¬O ntp ¡A³o³¡¥÷¥i¥H¬d¾\ /etc/sysconfig/ntpd ´N¥i¥Hª¾¹D°Õ¡I

  • keys [key_file]
  • °£¤F¥H restrict ¨Ó­­¨î¥Î¤áºÝªº³s½u¤§¥~¡A§Ú­Ì¤]¥i¥H³z¹Lª÷Æ_¨t²Î¨Óµ¹¥Î¤áºÝ»{ÃÒ¡A ¦p¦¹¤@¨Ó¥i¥HÅý¥D¾÷ºÝ§ó©ñ¤ß¤F¡C¤£¹L¦b³o­Ó³¹¸`¸Ì­±§Ú­Ì¼È¤£°Q½×³o­Ó³¡¤À¡A ¦³¿³½ìªºªB¤Í¥i¥H°Ñ¦Ò ntp-keygen ³o­Ó«ü¥Oªº¬ÛÃö»¡©ú³á¡I

    ®Ú¾Ú¤W­±ªº»¡©ú¡A§Ú­Ì³Ì²×¥i¥H¨ú±o³o¼Ëªº³]©wÀɮפº®e³á¡I
    [root@linux ~]# vi /etc/ntp.conf
    # ¦b«O¯d¤j³¡¤Àªº¹w³]­Èªº±¡ªp¤U¡A§Ú­Ì§@¤F´X­Ó¤p³¡¤Àªº­×§ï³á¡G
    # 1. ¥ý³B²zÅv­­¤è­±ªº°ÝÃD¡G
    restrict default nomodify notrap noquery
    restrict 220.130.158.71  <==©³¤U³o¤T¦æ¦b¶}©ñ¥D¾÷¶i¤JªºÅv­­
    restrict 220.130.158.51
    restrict 220.130.158.52
    restrict 127.0.0.1   mask 255.0.0.0  <==¤º³¡»P LAN ªº¨Ï¥ÎÅv­­
    restrict 192.168.1.0 mask 255.255.255.0 nomodify
    
    # 2. ³]©w¥D¾÷¨Ó·½¡I
    server 220.130.158.71 prefer  <==¥H³o³¡¥D¾÷¬°³ÌÀu¥ý
    server 220.130.158.51
    server 220.130.158.51
    
    # 3.­ì¥»¤º©wªº¤@­Ó¤º³¡®É¶¡¸ê®Æ¡A¤£»Ý­n§ó°Ê¥L
    server  127.127.1.0     # local clock
    fudge   127.127.1.0 stratum 10
    
    # 4. ´N¬O¨º­Ó®É¶¡®t²§¤ÀªRªº©N©N¡A«O¯d¹w³]­È§Y¥i¡C
    driftfile /var/lib/ntp/drift
    broadcastdelay  0.008
    
    # 5.¼È®É¤£·|¨Ï¥Îªº keys ¬ÛÃö»{ÃÒ¥\¯à¡C
    keys            /etc/ntp/keys
    
    µM«á·Ç³Æ¤@¤U­×­q¤@¤U /etc/sysconfig/ntpd §a¡I
    [root@linux ~]# vi /etc/sysconfig/ntpd
    OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"
    SYNC_HWCLOCK=yes
    # ±N¥L§ï¦¨ yes §a¡I³o¼Ë BIOS ªº®É¶¡¤]·|¸òµÛ§ïÅܪº¡I
    
    ³o¼Ë´N³]©w§´·í¤F¡A·Ç³Æ¨Ó±Ò°Ê NTP ªA°È§a¡I


    ¤p¼ÐÃDªº¹Ï¥ÜNTP ªº±Ò°Ê»PÆ[¹î
    ³]©w§¹ ntp.conf ¤§«á´N¥i¥H±Ò°Ê ntp ¦øªA¾¹¤F¡C±Ò°Ê»PÆ[¹îªº¤è¦¡¦p¤U¡G
    1. ±Ò°Ê NTP 
    [root@linux ~]# /etc/init.d/ntpd start
    
    2. Æ[¹î±Ò°Êªº°ð¤f¬Ý¬Ý¡G
    [root@linux ~]# netstat -tlunp
    Proto Recv-Q Send-Q Local Address      Foreign Address  PID/Program name
    udp        0      0 192.168.1.254:123  0.0.0.0:*        15118/ntpd
    udp        0      0 127.0.0.1:123      0.0.0.0:*        15118/ntpd
    udp        0      0 0.0.0.0:123        0.0.0.0:*        15118/ntpd
    udp        0      0 :::123             :::*             15118/ntpd
    # ¥D­n¬O UDP «Ê¥]¡A¥B¦b port 123 ³o­Ó°ð¤fªº°Õ¡I
    
    ³o¼Ë´Nªí¥Ü§Ú­Ìªº NTP ¦øªA¾¹¤w¸g±Ò°Ê¤F¡A¤£¹L­n»P¤W¼h NTP ¦øªA¾¹³s½u«hÁٻݭn¤@¨Ç®É¶¡¡A ³q±`±Ò°Ê NTP «á¬ù¦b 15 ¤ÀÄÁ¤º¤~·|©M¤W¼h NTP ¦øªA¾¹¶¶§Q³s±µ¤W¡C ¨º­n¦p¦ó½T»{§Ú­Ìªº NTP ¦øªA¾¹¦³¶¶§Qªº§ó·s¦Û¤vªº®É¶¡©O¡H§A¥i¥H¨Ï¥Î©³¤U´X­Ó«ü¥O¨Ó¬d¾\³á¡G
    [root@linux ~]# ntpstat
    synchronised to NTP server (220.130.158.71) at stratum 3
       time correct to within 495 ms
       polling server every 64 s
    # ³o­Ó«ü¥O¥i¥H¦C¥X§Ú­Ìªº NTP ¦øªA¾¹¦³¸ò¤W¼h³s½u§_¡C¥Ñ¤W­zªº¿é¥Xµ²ªG¥i¥Hª¾¹D¡A
    # ®É¶¡¦³®Õ¥¿¬ù 495 * 10^(-3) ¬í¡A¥B¨C®æ 64 ¬í·|¥D°Ê¥h§ó·s®É¶¡³á¡I
    
    [root@linux ~]# ntptrace -n 127.0.0.1
    127.0.0.1: stratum 3, offset -0.034965, synch distance 0.109233
    220.130.158.71: stratum 2, offset -0.000873, synch distance 0.031625
    220.130.158.50: timed out, nothing received
    ***Request timed out
    # ³o­Ó«ü¥O«h¥i¥H¦C¥X¥Ø«e§Ú­Ìªº NTP ¦øªA¾¹»P¤W¼h NTP ¦øªA¾¹©¼¦¹¤§¶¡ªºÃö«Y¡C
    # ¥Ñ©ó§Ú­Ì¤w¸g©M²Ä¤G¼h³s±µ¤W¡A¦ý²Ä¤G¼h»P²Ä¤@¼h´N¤£¬O§Ú­Ì¯àºÞ²zªºÅo¡C
    # ©Ò¥H¨º­Ó timed out ¥i¥H¤£²z¥L¨SÃö«Yªº¡C
    
    [root@linux ~]# ntpq -p
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
    *220-130-158-71. 220.130.158.50   2 u   53   64   77   36.800  -10.496   1.890
     220-130-158-51. .INIT.          16 u    -   64    0    0.000    0.000 4000.00
    +220-130-158-51. 220.130.158.50   2 u   49   64   77   33.448  -10.431   2.581
     LOCAL(0)        LOCAL(0)        10 l   51   64   77    0.000    0.000   0.004
    
    ³o­Ó ntpq -p ¥i¥H¦C¥X¥Ø«e§Ú­Ìªº NTP »P¬ÛÃöªº¤W¼h NTP ªºª¬ºA¡A¤WÀYªº´X­ÓÄæ¦ìªº·N¸q¬°¡G
    • remote¡G¥ç§Y¬O NTP ¥D¾÷ªº IP ©Î¥D¾÷¦WºÙÅo¡ãª`·N³Ì¥ªÃ䪺²Å¸¹¡A ¦pªG¦³¡y*¡z¥Nªí¥Ø«e¥¿¦b§@¥Î·í¤¤ªº¤W¼h NTP ¡A¦pªG¬O¡y+¡z¥Nªí¤]¦³³s¤W½u¡A¦Ó¥B¥i§@¬°¤U¤@­Ó´£¨Ñ®É¶¡§ó·sªº­Ô¿ïªÌ¡C
    • refid¡G°Ñ¦Òªº¤W¤@¼h NTP ¥D¾÷ªº¦ì§}
    • st¡G´N¬O stratum ¶¥¼hÅo¡I
    • when¡G´X¬íÄÁ«e´¿¸g°µ¹L®É¶¡¦P¨B¤Æ§ó·sªº°Ê§@¡F
    • poll¡G¤U¤@¦¸§ó·s¦b´X¬íÄÁ¤§«á¡F
    • reach¡G¤w¸g¦V¤W¼h NTP ¦øªA¾¹­n¨D§ó·sªº¦¸¼Æ
    • delay¡Gºô¸ô¶Ç¿é¹Lµ{·í¤¤©µ¿ðªº®É¶¡¡A³æ¦ì¬° 10^(-6) ¬í
    • offset¡G®É¶¡¸ÉÀvªºµ²ªG¡A³æ¦ì»P 10^(-3) ¬í
    • jitter¡GLinux ¨t²Î®É¶¡»P BIOS µwÅé®É¶¡ªº®t²§®É¶¡¡A ³æ¦ì¬° 10^(-6) ¬í¡C
    ¨Æ¹ê¤W³o­Ó¿é¥Xªºµ²ªG§i¶D§Ú­Ì¡A®É¶¡¯uªº«Ü·Ç¤F°Õ¡I¦]¬°®t²§³£¦b 0.0001 ¬í¥H¤º¡A ¥i¥H²Å¦X§Ú­Ìªº¤@¯ë¨Ï¥Î¤F¡C¥t¥~¡A§A¤]¥i¥HÀˬd¤@¤U§Aªº BIOS ®É¶¡»P Linux ¨t²Î®É¶¡ªº®t²§¡A ´N¬O /var/lib/ntp/drift ³o­ÓÀɮתº¤º®e¡A´N¯àÁA¸Ñ¨ì«¥­Ìªº Linux ¨t²Î®É¶¡»P BIOS µwÅé®ÉÄÁ¨ì©³®t¦h¤[¡H³æ¦ì¬° 10^(-6) ¬í°Õ¡I


    ¤p¼ÐÃDªº¹Ï¥Ü¦w¥þ©Ê³]©w
    NTP ¦øªA¾¹¦b¦w¥þªº¬ÛÃö©Ê¤è­±¡A¨ä¹ê­è­è§Ú­Ì¦b /etc/ntp.conf ¸Ì­±ªº restrict °Ñ¼Æ¤¤´N¤w¸g³]©w¤F NTP ³o­Ó daemon ªºªA°È­­¨î½d³ò¤F¡I¤£¹L¡A¦b¨¾¤õÀð iptables ªº³¡¤À¡AÁÙ¬O»Ý­n¶}±Ò³s½uºÊÅ¥ªº°Õ¡I©Ò¥H¡A¦b±zªº iptables ³W«hªº scripts ·í¤¤¡A»Ý­n¥[¤J³o¤@¬q (§Ú¬O¥H¶}©ñ 192.168.1.0/24 ³o­Óºô°ì§@¬°½d¨Òªº¡I)
    iptables -A INPUT -p UDP -i $EXTIF -s 192.168.1.0/24  --dport 123 -j ACCEPT
    
    ­YÁÙ­n¶}©ñ¨ä¥Lªººô¬q©ÎªÌ¥D¾÷¡A½Ð¦Û¦æ­×§ï±zªº¨¾¤õÀð¾÷¨î«£¡I

    ¤j¼ÐÃDªº¹Ï¥Ü¥Î¤áºÝªº®É¶¡§ó·s¤è¦¡
    ¤WÀY¤¶²Ð¤F NTP ¦øªA¾¹ªº¦w¸Ë»P³]©w¡A¦pªG§Ú­Ì¶È¦³¤Q³¡¤£¨ìªº¥D¾÷®É¡A¦Ñ¹ê»¡¡A¹ê¦b¨S¦³¬[³] NTP ¦øªA¾¹ªº»Ý¨D¡C ¥u­n¯à°÷¦b§Aªº¥D¾÷¤WÀY¥H NTP ¥Î¤áºÝ³nÅé¨Ó¶i¦æºô¸ô®Õ®É´N¯à°÷¦P¨B¤Æ®É¶¡¤F¡A¨S¥²­n®É®É¨è¨è¶i¦æ®É¶¡ªº®Õ¥¿§a¡I^_^¡I ©³¤U§Ú­Ì·|¤¶²Ð´X­Ó­«­nªº·§©À¡AÁA¸Ñ¤@¤U¬°¦ó¹q¸£Ãö¾÷¤F®É¶¡ÁÙ¯à°÷Ä~Äò°O¾Ð©O¡H


    ¤p¼ÐÃDªº¹Ï¥ÜLinux ¨t²Î®É¶¡»PµwÅé®É¶¡
    ¦b«¥­Ìªº Linux §@·~¨t²Î·í¤¤¨ä¹ê¦³¨â­Ó®É¶¡³á¡A¤À§O¬O¡G
    • ¤@­Ó¬O BIOS °O¿ýªº¹ê»Ú®É¶¡¡A³o¤]¬OµwÅé©Ò°O¿ýªº¡F
    • ¤@­Ó¬O Linux ¦Û¤vªº¨t²Î®É¶¡¡A¥Ñ 1970/01/01 ¶}©l°O¿ýªº®É¶¡°Ñ¼Æ¡C
    ·í Linux ¶}¾÷«á¡A¥L·|¥D°ÊªºÅª¥X BIOS ©Ò°O¿ýªº®É¶¡¡AµM«á¶}©l¥Î¦Û¤vªº¤è¦¡¨Ó­pºâ®É¶¡¤F¡C ·í§Ú­Ì¨Ï¥Î date ¤§Ãþªº«ü¥O¨Ó¬d¸ß©ÎªÌ¬O³]©w®É¶¡®É¡A¸Ó®É¶¡«üªº¶È¬O Linux ªº®É¶¡¦Ó¤w¡A ¨Ã¨S¦³§ó°Ê¨ì BIOS ¤º©Ò°O¿ýªº®É¶¡§o¡I°£«D§A¨Ï¥Î hwclock ¨Ó¼g¤J©ÎªÌ¬OŪ¥X BIOS ªº®É¶¡¡C

    ¦Ó¥Ñ©ó BIOS ·|°O¿ý®É¶¡¦Ó¥B·|«ùÄò­p®É¡A¦]¦¹§Ú­ÌÃö¾÷«á¦A¶}¾÷®É¡A·|µo²{®É¶¡¨ä¹ê¬O¦³¶¶§Qªº²Ö¿n¤W¨Óªº¡C ¬°¤F­nºû«ù BIOS ©Ò°O¿ýªº¸ê°T¡A¦]¦¹¥D¾÷ªO¤W­±ªº¹q¦À´N«Ü­«­n¤F¡A ¦]¬°¥L¥i¥HÅý BIOS ¦bÃö¾÷ªº®É­ÔÁÙÄ~Äòªº°O¿ýµwÅé¸ê°T¥H¤Îºû«ù®É¶¡ªº²Ö­p¡C ©Ò¥H¦pªG§Aµo²{¶}¾÷«á¾ã­Ó BIOS ®É¶¡³ºµM«ì´_¦¨¬°¨t²Î¥X¼t­È¡A«Ü¥i¯à´N¬O¥D¾÷ªO¤W­±ªº¹q¦À¨S¹q¤F¡C ¦pªG§A±N BIOS Â_¹q³B²z®É¡A¼K¼K¡I®É¶¡¥i¯à¤]·|«ì´_¦¨¬°¨t²Î¥X¼t­È°Ú¡C

    ¥Ñ©ó¨C­Ó BIOS ¤º³¡ªº®É¶¡­pºâ¾¹¥i¯à¦³ÂI»~®t¡A¦]¦¹»P§Ú­Ìªº Linux ®É¶¡¦h¦h¤Ö¤Ö´N·|²£¥Í®t²§¡A ³o­Ó®t²§¦b®É¶¡©Ôªø¤§«á¡A´N·|µo²{¥Lªº­«­n©Ê¤F¡C©Ò¥H¤~·|»Ý­n¶i¦æºô¸ô®Õ®É¹À¡I±z»¡¬O§a¡ã


    ¤p¼ÐÃDªº¹Ï¥ÜLinux ¨t²Î®É°Ï»P¤â°Ê®Õ®É¤u§@¡G date, hwclock
    §Ú­Ì¦b«e­±»¡¹L¡A Linux ªº®É°ÏÀÉ®×´N¬O /etc/localtime ¡A³o¬O¤@­Ó®É¶¡®æ¦¡ªºÀɮצӤ£¬O ASCII Ãþ«¬ªºÀɮ׳á¡I (file /etc/localtime ¥i¥H¬Ý¥X)¡A¦Ü©ó©Ò¦³ªº Time Zone «h©ñ¸m¦b /usr/share/zoneinfo ³o­Ó¥Ø¿ý¤U¡C½Ðª`·N¡G
    • ·í /etc/localtime ¦s¦b®É¡A¨t²Îªº®É°Ï¥H¸ÓÀÉ®×¥Nªíªº®É°Ï¨ÓÅã¥Ü¡B
    • ·í /etc/localtime ¤£¦s¦b®É¡A¨t²Îªº®É°Ï¥D­n¥H GMT (©Î UTC) ¬°·Ç¡F
    ©Ò¥H¡A¦pªG±z·Q­nÅܧó±z Linux ¨t²Îªº®É°Ï¡A¨º»ò¥u­n¦b /usr/share/zoneinfo ¸Ì­±§ä¨ì±z»Ý­nªº®É°ÏÀɮסA µM«á±N¥L½Æ»s¤@¥÷¦¨¬° /etc/localtime ´N¥i¥H¶¶§Qªº§ó·s®É°Ï³]©w¤F¡I¥t¥~¡A¦P®É«Øij­×¥¿¤@¤U /etc/sysconfig/clock ³o­ÓÀɮ׸̭±ªº ZONE ³]©w­È¡I¥H§Ú­Ì¥xÆWªº Time zone ¬°¨Ò¡A¦b /etc/sysconfig/clock ³o­ÓÀÉ®×·í¤¤À³¸Ó¬O¡yZONE="Asia/Taipei"¡z³o´Nªí¥Ü§Ú­Ìªº®É°ÏÀɮ׬° /usr/share/zoneinfo/Asia/Taipei ³o­ÓÀÉ®×Åo¡I½Ð¹ïÀ³µÛ­×§ï¦¨±z©Ò·Q­nªº®É°Ï§a¡I

    ¨ÒÃD¡G
    °²³]§Aªº¥D¾÷¥»¨Ó¦b¥xÆW¡A«á¨Ó³Q·h¨ì¬ü°êªº¬¥§üÁF (Los_Angeles) ¥h¤F¡C ½Ð°Ý§A¦p¦ó§ó§ï¥D¾÷ªº®É°Ï°Ñ¦ÒÀɮסH
    榭G
      ®É°Ï°Ñ¦ÒÀɦb¬O /etc/localtime ¡A¤£¹L³o­ÓÀɮצb¤£¦Pªº Linux distribution ªº³B²z¤è¦¡¤£¤@¼Ë¡C ¥H Red Hat ¨t²Î¬°¨Ò¡A¥L¬O¥H½Æ»sªº¤è¦¡¨Ó³B²z³o­ÓÀɮסC¦Ó SuSE «h¬O¥H hard link ¨Ó³B²zªº¡C ©Ò¥H¡A½Ð°O±o¤£­nÀH·Nªº³æ¯Â¥Î¡y½Æ»s¡zªº¤è¦¡¨Ó³B²z¡A³Ì¦n¥ý²¾°£«á½Æ»s¡C ©Ò¥H§A¥i¥H³o¼Ë°µ¡G
      [root@linux ~]# rm /etc/localtime
      [root@linux ~]# cp -a /usr/share/zoneinfo/America/Los_Angeles \
      > /etc/localtime
      [root@linux ~]# vi /etc/sysconfig/clock
      ZONE="America/Los_Angeles"
      UTC=false
      ARC=false
      
      ³o¼Ë´N OK ªº°Õ¡I ^_^

    ¦n¤F¡A®É°Ï­×¥¿§¹²¦¤F¡A¨º»ò®É¶¡©O¡H¦p«e©Ò­z¡A¥Ø«e Linux ¨t²Î¤W­±¦³¨â­Ó®É¶¡³á¡A¤@­Ó¬O Linux ¨t²Î¡A¥t¤@­Ó«h¬O BIOS ®É¶¡¡I§Ú­Ì¥i¥H¨Ï¥Î date ³o­Ó«ü¥O¨Ó¤â°Ê­×¥¿¥Ø«e¥D¾÷ªº®É¶¡¡A¤£¹L¡A date ³o­Ó«ü¥O¶È­×¥¿ Linux ®É¶¡¦Ó¤w¡A§Ú­ÌÁٻݭn¥H hwclock ³o­Ó«ü¥O¨Ó±N BIOS ®É¶¡¤]§ó·s¤~¦æ¡I
    [root@linux ~]# date MMDDhhmmYYYY
    °Ñ¼Æ¡G
    MM¡G¤ë¥÷
    DD¡G¤é´Á
    hh¡G¤p®É
    mm¡G¤ÀÄÁ
    YYYY¡G¦è¤¸¦~
    
    1. ­×§ï®É¶¡¦¨¬° 1 ¤p®É«áªº®É¶¡¸Ó¦p¦ó¬O¦n¡H
    [root@linux ~]# date
    Thu Dec  7 15:36:45 CST 2006
    
    [root@linux ~]# date 120716362006
    Thu Dec  7 16:36:00 CST 2006
    # Á@¡I®É¶¡¥ß¨è´N­×§ï¹L¨Ó¤F¡I
    
    [root@linux ~]# hwclock [-rw]
    °Ñ¼Æ¡G
    -r ¡G¥ç§Y read ¡AŪ¥X¥Ø«e BIOS ¤ºªº®É¶¡°Ñ¼Æ¡F
    -w ¡G¥ç§Y write ¡A±N¥Ø«eªº Linux ¨t²Î®É¶¡¼g¤J BIOS ·í¤¤°Ú¡I
    
    2. ¬d¾\ BIOS ®É¶¡¡A¨Ã¥B¼g¤J§ó§ï¹Lªº®É¶¡Åo¡I
    [root@linux ~]# hwclock -r
    Thu Dec  7 15:37:44 2006  -0.627128 seconds
    # ¬Ý¤@¬Ý¡A¬O§_­è¦n®t²§¬ù¤@­Ó¤p®É°Ú¡I³o´N¬O BIOS ®É¶¡¡I
    
    [root@linux ~]# hwclock -w
    # ³o¼Ë´N¼g¤JÅo¡ã«Ü²³æ§a¡I
    
    ³o¼Ë¥i¥HÁA¸Ñ¤F¶Ü¡H·í§Ú­Ì¶i¦æ§¹ Linux ®É¶¡ªº®Õ®É«á¡AÁٻݭn¥H hwclock ¨Ó§ó·s BIOS ªº®É¶¡¡A¦]¬°¨C¦¸¶}¾÷ªº®É­Ô¡A¨t²Î·|­«·s¥Ñ BIOS ±N®É¶¡Åª¥X¨Ó¡A©Ò¥H¡A BIOS ¤~¬O­«­nªº®É¶¡¨Ì¾Ú§o¡C


    ¤p¼ÐÃDªº¹Ï¥ÜLinux ªººô¸ô®Õ®É
    ¦b Linux ªºÀô¹Ò·í¤¤¥i§Q¥Î NTP ªº¥Î¤áºÝµ{¦¡¡A¥ç§Y¬O ntpdate ³o¤äµ{¦¡´N¯à°÷¶i¦æ®É¶¡ªº¦P¨B¤Æ¡C ¤£¹L§A­nª¾¹Dªº¬O¡A¦]¬° NTP ¦øªA¾¹¥»¨Ó´N·|»P¤W¼h®É¶¡¦øªA¾¹¶i¦æ®É¶¡ªº¦P¨B¤Æ¡A ©Ò¥H¦b¹w³]ªº±¡ªp¤U¡ANTP ¦øªA¾¹¤£¥i¥H¨Ï¥Î ntpdate ¡I¤]´N¬O»¡ ntpdate »P ntpd ¤£¯à¦P®É±Ò¥Îªº¡C ©Ò¥H§A¤£­n¦b NTP server ¤WÀY°õ¦æ³o­Ó«ü¥OËç¡I§Ú­Ì´N¨Ó¬Ý¬Ý¦p¦ó³B²z§a¡I
    [root@linux ~]# ntpdate [-nv] [NTP IP/hostname]
    °Ñ¼Æ¡G
    -d ¡G¶i¤J°£¿ù¼Ò¦¡ (debug) ¡A¥i¥HÅã¥Ü¥X§ó¦hªº¦³®Ä¸ê°T¡C
    
    [root@linux ~]# ntpdate 192.168.1.254
     7 Dec 17:21:46 ntpdate[1427]: adjust time server 192.168.1.254 offset -0.0147 sec
    # ³Ì«á­±·|Åã¥Ü·L½Õªº®É¶¡¦³¦h¤Ö (offset)
    
    [root@linux ~]# hwclock -w
    # ÁÙ±o¼g¤J BIOS ®É¶¡¤~¦æ°Ú¡I
    
    [root@linux ~]# vi /etc/crontab
    # ¥[¤J³o¤@¦æ¥h¡I
    10 5 * * * root /usr/sbin/ntpdate tock.stdtime.gov.tw && /sbin/hwclock -w
    
    ¨Ï¥Î cron ¤§«á¡A¨C¤Ñ 5:10 Linux ¨t²Î´N·|¦Û°Êªº¶i¦æºô¸ô®Õ®ÉÅo¡I¬Û·íªºÂ²©ö§a¡I


    ¤p¼ÐÃDªº¹Ï¥ÜWindows ªººô¸ô®Õ®É
    ©Î³\§A¤@ª½³£¨Sµo²{¡A¨ä¹ê Windows ¦b¹w³]ªº±¡ªp·í¤¤¡A¤w¸gÀ°§Ú­Ì³B²z¤Fºô¸ô®Õ®Éªº¤u§@³á¡I ¤£ºÞ§AÄ@¤£Ä@·N.....§A¥i¥H±N·Æ¹«ªº«ü¼Ð«ü¦b¤u§@¦C¥k¤U¨¤ªº®É¶¡³B«ö¨â¤U¡A´N·|¥X²{¦p¤Uªºµe­±¡G

    Windows XP ´£¨Ñªººô¸ô®Õ®É¥\¯à
    ¹Ï¤G¡BWindows XP ´£¨Ñªººô¸ô®Õ®É¥\¯à

    ¦p¤W©Ò¥Ü¡A§A¥i¥H¦Û¦æ¶ñ¼g¥xÆWªº®É¶¡¦øªA¾¹¨Ó¹ïÀ³®É¶¡¡A·íµM¤]¥i¥H¶ñ¼g§A¦Û¤vªº®É¶¡¦øªA¾¹°Ú¡I ¤§«á¨t²Î´N·|¥D°Êªº¤Wºô¥h§ó·s®É¶¡¤F¡C¤£¹L¡A³o¬O Windows XP ¤~¦³ªº¥\¯à¡A¦pªG¬O¤ñ¸û¦­´Áªº Windows ¡A ¨Ò¦p Windows 95/2000 ¹w³]¬O¨S¦³³o­Ó¥\¯àªº¡C¤£¹L¤]¨S¦³Ãö«Y¡A ¦]¬°°ê®aÀW²v»P®É¶¡¼Ð·Ç¹êÅç«Ç (http://www.stdtime.gov.tw/) ¤]¦³´£¨Ñ¤@­Ó¥Î¤áºÝ³nÅé³á¡I³sµ²¸ê®Æ¦p¤U¡G
    §A¥i¥H¤U¸ü¡Aª½±µ°õ¦æ¥L´Nª¾¹D¦p¦ó³B²z¤F¡A¦]¬°¬O¥þ¤¤¤å¤¶­±ªº¹Ï§Î¤Æ³nÅé¹À¡I

    ¤j¼ÐÃDªº¹Ï¥Ü­«ÂI¦^ÅU
    • ¦a²y¦@¦³ 24 ­Ó®É°Ï¡A¦Ó¥H®æªL«Âªv®É¶¡ (GMT) ¬°¼Ð·Ç®É¶¡¡F
    • ¥xÆW¥»¦a®É¶¡¬° GMT + 8 ¤p®É¡F
    • ³Ì·Ç½Tªº®É¶¡¬°¨Ï¥Î­ì¤lÄÁ (Atomic clock) ©Ò­pºâªº¡A¨Ò¦p UTC (Coordinated Universal Time) ´N¬O¤@¨Ò¡F
    • Linux ¨t²Î¥»¨Ó´N¦³¨âºØ®É¶¡¡A¤@ºØ¬O Linux ¥H 1970/01/01 ¶}©l­p¼Æªº¨t²Î®É¶¡¡A¤@ºØ«h¬O BIOS °O¸üªºµwÅé®É¶¡¡F
    • Linux ¥i¥H³z¹Lºô¸ô®Õ®É¡A³Ì±`¨£ªººô¸ô®Õ®É¬°¨Ï¥Î NTP ¦øªA¾¹¡A³o­ÓªA°È±Ò°Ê¦b udp port 123¡F
    • ®É°ÏÀÉ®×¥D­n©ñ¸m©ó /usr/share/zoneinfo/ ¥Ø¿ý¤U¡A¦Ó¥»¦a®É°Ï«h°Ñ¦Ò /etc/localtime¡F
    • NTP ¦øªA¾¹¬°¤@ºØ¶¥¼h¦¡ªºªA°È¡A©Ò¥H NTP ¦øªA¾¹¥»¨Ó´N·|»P¤W¼h®É¶¡¦øªA¾¹§@®É¶¡ªº¦P¨B¤Æ¡A ¦]¦¹ nptd »P ntpdate ¨â­Ó«ü¥O¤£¥i¦P®É¨Ï¥Î¡F
    • NTP ¦øªA¾¹ªº³s½uª¬ºA¥i¥H¨Ï¥Î ntptrace ¤Î ntpq -p ¨Ó¬d¸ß¡F
    • NTP ´£¨Ñªº¥Î¤áºÝ³nÅ鬰 ntpdate ³o­Ó«ü¥O¡F
    • ¦b Linux ¤U·Q­n¤â°Ê³B²z®É¶¡®É¡A»Ý¥H date ³]©w®É¶¡«á¡A¥H hwclock -w ¨Ó¼g¤J BIOS ©Ò°O¿ýªº®É¶¡¡C
    • ¦b LPI ºô¯¸ http://www.lpi.org ¸Ì­±´£¨ìªº¡A¦b LPI 102 ¸Ì­± NTP ¨ä¹ê¦ÒªºÁÙ¤£¤Ö¡ITopic 1.111.6 Maintain system time ¸Ì­±»¡¨ì¡AÀ³¸ÕªÌÀ³¸Ó­nÁA¸Ñ BIOS ®É¶¡»P UTC ®É¶¡ªº·N¸q¡A¦P®É»Ý­nª¾¹D«ç»ò³]©w timezone ¡A¦Ó®É¶¡®t©Ò¨Ï¥ÎªºÀÉ®× driftfile ¤]»Ý­nÁA¸Ñ§o¡I¥i¯à·|¦Òªº¤º®e§t¦³¡G
      • date
      • hwclock
      • ntpd
      • ntpdate
      • /usr/share/zoneinfo
      • /etc/localtime
      • /etc/ntp.conf
      • /etc/ntp.drift (·sª©¤w¸g§ï¦Ü /var/lib/ntp/drift)

    ¤j¼ÐÃDªº¹Ï¥Ü½Ò«á½m²ß
    • ¤°»ò¬O GMT (®æªL«Âªv) ®É¶¡»P UTC ®É¶¡¡H
    • ¥Ñ©ó¦a²y¬O¶êªº¡A©Ò¥H¦P¤@®É¶¡ÂI¤W¡A¦b¦a²y¦@¥i¤À¬° 24 ­Ó®É°Ï¡A¨ä¤¤¡A§Ú­Ì¥H¼Ú¬wªº®æªL«Âªv®É¶¡¬°¤@­Ó¹ï·Óªº¨Ì¾Ú¡A³o­Ó§Y¬O GMT ®É¶¡¡C¥xÆW®É¶¡¤ñ GMT ®É¶¡§Ö¤F 8 ¤p®É¡C¦Ü©ó UTC ®É¶¡«h¬O¥Ñ­ì¤lÄÁ©Ò­pºâªº®É¶¡¡A³o­Ó®É¶¡¬O¬Û·íªº·Ç½Tªº¡A ¥D­n¤´¥H®æªL«Âªv®É¶¡¬°®É°Ï¡I
    • Linux ¨t²Îªº©Ò¦³®É°ÏÀɮשñ¸m­þ¤@­Ó¥Ø¿ý©³¤U¡H
    • ©Ò¦³ªº®É°ÏÀɮשñ¸m©ó¡G/usr/share/zoneinfo ©³¤U¡I¦Ü©ó¨t²Î®É°Ïªº³]©wÀÉ«h¦b /etc/sysconfig/clock »P /etc/localtime ³á¡I
    • §Úªº Linux ¥D¾÷¥»¨Ó©ñ¸m¦b¤é¥»ªF¨Ê¡A²{¦b·Q±N¥L®³¨ì¥xÆW¨Ó¹B§@¡A¤£¹L¦]¬°¤é¥»»P¥xÆW¦³¤@­Ó¤p®Éªº®É®t¡A ©Ò¥H§Úªº®É¶¡À³¸Ó»Ý­n¸g¹L½Õ¾ã¤~¦æ¡C¤£¹L¡A¦]¬°§Úªº BIOS Time ¥D­n¬O¨Ì¾Ú UTC ®É¶¡¨Ó³]©wªº¡A©Ò¥H¦ü¥G¥u­n§ó°Ê®É°Ï°Ñ¼Æ§Y¥i¡C½Ð°Ý§Ú¸Ó¦p¦ó³]©w®É°Ï¡A¦nÅý§Úªº Linux ¥D¾÷¯à°÷Åã¥Ü¥¿½Tªº®É¶¡¡H
    • ¥ý±N /etc/localtime §R°£¡AµM«á±N /usr/share/zoneinfo/Asia/Taipei ³o­ÓÀɮ׽ƻs¦¨¬° /etc/localtime §Y¥i¡I
    • ¥Ø«e Linux ¨t²Î¤W­±ªº®É¶¡¦øªA¾¹¥D­n¬O¥H NTP ¬°¥D¡A½Ð°Ý³o­Ó daemon ªº¥D­n³]©wÀÉ©ñ¦b­þ¸Ì¡A¦Ó¸Ó³]©wÀɤ¤¡A°w¹ï¤W¼h time server ªº³]©w°Ñ¼Æ¬°¦ó¡H¦Ó¨º­Ó driftfile °Ñ¼Æ¬O·F¹À¥Îªº¡H
    • ¦b /etc/ntp.conf ³o­ÓÀÉ®×·í¤¤¡A¦Ü©ó¤W¼h time server ªº³]©w°Ñ¼Æ¬° server °Ú¡I¨º­Ó driftfile «h¬O¥Î¨Ó°µ¬°¡y®É¶¡®tÃB¡zªº­pºâªº¡I¸Ó°Ñ¼Æ«á­±±µªº¬O¤@­Ó§¹¾ã¸ô®|ªºÀɦW¡A¸ÓÀɮ׸̭±ªº¼Æ­È³æ¦ì¬°¦Ê¸U¤À¤§¤@(ppm)¡C
    • ½Ð°Ý ntptrace ªº¥\¯à¬°¦ó¡H
    • ¥i¥H¥Î¨Ó°lÂܤW¼h time server ªº³s½u®É¶¡»P¥Ø«e®É¶¡¡I
    • §Ú¥H date §ó·s¤F§Ú Linux ¤W­±ªº®É¶¡«á¡A¸Ó¦p¦ó±N®É¶¡¼Æ¾Ú¼g¤J BIOS ¤º¡H
    • ¥²¶·§Q¥Î hwclock ³o­Óµ{¦¡¨Ó¼g¤J¡A§Q¥Î hwclock -w ¼g¤J BIOS
    • ¦b Linux ¤W­±¦p¦ó¶i¦æºô¸ô®Õ®É¡H
    • ³Ì²³æªº¤èªk§Y¬O¨Ï¥Î¡y ntpdate time.servers.ip && hwclock -w ¡z§Y¥i¡I

    ¤j¼ÐÃDªº¹Ï¥Ü°Ñ¦Ò¸ê®Æ

    2003/08/21¡G­º¦¸§¹¦¨
    2006/12/05¡G±Nªº¤å³¹²¾°Ê¨ì¦¹³B
    2006/12/08¡G±N¤å³¹§@¤F­Óª©­±­×§ï¡A¦P®É±N¤@¨Ç¸ê®Æ¦A¥[±j¤@¨Ç¡C¨Ã¸É¥R¤@¨ÇÃB¥~ªº¬d¾\ NTP ªº«ü¥O¡C
    2009/04/28¡G±N offset ªº®É¶¡³æ¦ì¼g¿ù¤F¡AÀ³¸Ó¬O ms ¤£¬O us ¡A¥ç§Y 10^(-3) ¬í¡A¦Ó¤£¬O 10^(-6) ¬í¡C©êºp¡C
    2011/02/18¡G¥ÑŪªÌ§õ‰í¥S´£¨Ñªº¸ê®Æ¡Aµo²{­ì¥» ntpq ªº»¡©ú¤Ï¤F¡I * À³¬°§@¥Î¤¤¡A¦Ó + ¬O¸û¨Îªº¥t¤@³¡­Ô¿ï¥D¾÷¡C
    ¡@
    ¡@ ¡@ ¡@
    | ÁcÅé¥D¯¸ | ²Åé¥D¯¸ | °ò¦½g | ¦øªA¾¹ | ¥ø·~À³¥Î | ®à­±À³¥Î | ¦w¥þºÞ²z | °Q½×ªO | »Å¾Ç¶é | ®ÑÄy·`»~ | ³¾­ô§Ú | ±X¤s¸ê¶Ç |
    ¥»ºô­¶¥D­n¥H firefox °t¦X¸ÑªR«× 1024x768 §@¬°³]­p¨Ì¾Ú
    http://linux.vbird.org is designed by VBird during 2001-2011. ksu.edu