{"id":6000,"date":"2016-04-21T11:05:12","date_gmt":"2016-04-21T03:05:12","guid":{"rendered":"https:\/\/kyle.ai\/blog\/?p=6000"},"modified":"2016-06-13T15:19:26","modified_gmt":"2016-06-13T07:19:26","slug":"ntpd%e6%97%b6%e9%92%9f%e5%90%8c%e6%ad%a5%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/6000.html","title":{"rendered":"ntpd\u65f6\u949f\u540c\u6b65\u670d\u52a1"},"content":{"rendered":"<p><strong>CentOS\u914d\u7f6e\u65f6\u95f4\u540c\u6b65NTP<\/strong><\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528ntpd\u800c\u4e0d\u662fntpdate\uff1f<br \/>\n\u539f\u56e0\u5f88\u7b80\u5355\uff0cntpd\u662f\u6b65\u8fdb\u5f0f\u7684\u9010\u6e10\u8c03\u6574\u65f6\u95f4\uff0c\u800cntpdate\u662f\u65ad\u70b9\u66f4\u65b0\uff0c\u6bd4\u5982\u73b0\u5728\u670d\u52a1\u5668\u65f6\u95f4\u662f9.18\u5206\uff0c\u800c\u6807\u51c6\u65f6\u95f4\u662f9.28\u5206\uff0cntpd\u4f1a\u5728\u4e00\u6bb5\u65f6\u95f4\u5185\u9010\u6e10\u7684\u628a\u65f6\u95f4\u6821\u51c6\u5230\u4e0e\u6807\u51c6\u65f6\u95f4\u76f8\u540c\uff0c\u800cntpdate\u4f1a\u7acb\u523b\u628a\u65f6\u95f4\u8c03\u6574\u52309.28\u5206\uff0c\u5982\u679c\u4f60\u5f80\u6570\u636e\u5e93\u5185\u5199\u5165\u5185\u5bb9\u6216\u5728\u5176\u4ed6\u5bf9\u65f6\u95f4\u6709\u4e25\u683c\u8981\u6c42\u7684\u751f\u4ea7\u73af\u5883\u4e0b\uff0c\u4ea7\u751f\u7684\u540e\u679c\u4f1a\u662f\u5f88\u4e25\u91cd\u7684\u3002\uff08\u6ce8\uff1a\u5f53\u672c\u5730\u65f6\u95f4\u4e0e\u6807\u51c6\u65f6\u95f4\u76f8\u5dee30\u5206\u949f\u4ee5\u4e0a\u662fntpd\u4f1a\u505c\u6b62\u5de5\u4f5c\uff09<\/p>\n<p><span style=\"font-size: medium;\"><strong>NTP\u901a\u4fe1\u534f\u8bae\u539f\u7406<\/strong><\/span><\/p>\n<p>1.\u9996\u5148\u4e3b\u673a\u542f\u52a8NTP\u3002<br \/>\n2.\u5ba2\u6237\u7aef\u4f1a\u5411NTP\u670d\u52a1\u5668\u53d1\u9001\u8c03\u6574\u65f6\u95f4\u7684message\u3002<br \/>\n3.\u7136\u540eNTP server\u4f1a\u9001\u51fa\u5f53\u524d\u7684\u6807\u51c6\u65f6\u95f4\u7ed9client<br \/>\n4.client\u63a5\u53d7\u6765\u81easerver\u7684\u65f6\u95f4\u540e\uff0c\u4f1a\u6839\u636e\u8fd9\u4e2a\u4fe1\u606f\u6765\u8c03\u6574\u81ea\u5df1\u7684\u65f6\u95f4\u3002\u8fd9\u6837\u5c31\u5b9e\u73b0\u4e86\u7f51\u7edc\u5bf9\u65f6\u3002<\/p>\n<p>NTP\u8fd9\u4e2adeamon\u91c7\u7528\u4e86UDP 123\u7aef\u53e3\u3002\u5f53\u6211\u4eec\u8981\u5229\u7528Tim server\u6765\u8fdb\u884c\u5b9e\u8df5\u7684\u540c\u6b65\u66f4\u65b0\u65f6\uff0c\u5c31\u9700\u8981\u4f7f\u7528NTP\u8f6f\u4ef6\u63d0\u4f9b\u7684ntpdate\u6765\u8fde\u63a5\u7aef\u53e3123<\/p>\n<p><span style=\"font-size: medium;\"><strong>\u76f8\u5173\u7684\u547d\u4ee4\u548c\u914d\u7f6e\u6587\u4ef6<\/strong><\/span><\/p>\n<p>\/etc\/ntp.conf: linux\u5404\u7248\u672c\u867d\u7136\u76ee\u5f55\u4e0d\u540c\uff0c\u4f46\u6587\u4ef6\u540d\u76f8\u540c\u3002\u53ef\u4ee5\u7528which ntp.conf \u6216\u8005locate ntp.conf\u6765\u67e5\u627e\u3002\u8fd9\u662fNTP\u552f\u4e00\u7684\u4e00\u4e2a\u8bbe\u7f6e\u6587\u4ef6\u3002<br \/>\n\/usr\/share\/zoneinfo\/: \u8fd9\u4e2a\u91cc\u9762\u89c4\u5b9a\u4e86\u8fd9\u4e2a\u4e3b\u8981\u65f6\u533a\u7684\u65f6\u95f4\u8bbe\u7f6e\u6587\u4ef6\u3002<br \/>\n\/etc\/sysconfig\/clock: \u8fd9\u4e2a\u6587\u4ef6\u662flinux\u7684\u4e3b\u8981\u65f6\u533a\u8bbe\u7f6e\u6587\u4ef6\uff0c\u6bcf\u6b21\u5f00\u673a\u540elinux\u4f1a\u81ea\u52a8\u8bfb\u53d6\u8fd9\u4e2a\u6587\u4ef6\u6765\u8bbe\u7f6e\u7cfb\u7edf\u6240\u9ed8\u8ba4\u7684\u663e\u793a\u65f6\u95f4\uff0c\u53ef\u4ee5\u770b\u770b\u5b83\u91cc\u9762\u5230\u5e95\u8bbe\u7f6e\u4e86\u4ec0\u4e48\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ncat \/etc\/sysconfig\/clock\r\n# The ZONE parameter is only evaluated by system-config-date.\r\n# The timezone of the system is defined by the contents of \/etc\/localtime.\r\nZONE=&quot;Asia\/Shanghai&quot;\r\nUTC=true\r\nARC=false\r\n<\/pre>\n<p>\/etc\/localtime: \u672c\u5730\u7aef\u65f6\u95f4\u914d\u7f6e\u6587\u4ef6\u3002<br \/>\n\/bin\/date: \u8fd9\u4e2a\u662f\u65f6\u95f4\u7684\u4fee\u6539\u547d\u4ee4\uff0c\u9664\u4e86\u8f93\u51fa\u65f6\u95f4\uff0c\u8fd8\u53ef\u4ee5\u4fee\u6539\u65f6\u95f4\u3002<br \/>\n\/sbin\/hwclock: \u56e0\u4e3alinux\u7cfb\u7edf\u4e0a\u9762BIOS\u65f6\u95f4\u4e0elinux\u7cfb\u7edf\u65f6\u95f4\u662f\u5206\u5f00\u7684\uff0c\u6240\u4ee5\u4f7f\u7528date\u8fd9\u4e2a\u6307\u4ee4\u8c03\u6574\u4e86\u65f6\u95f4\u4e4b\u540e\uff0c\u8fd8\u9700\u8981\u4f7f\u7528hwclock\u624d\u80fd\u5c06\u4fee\u6539\u8fc7\u7684\u65f6\u95f4\u5199\u5165BIOS\u4e2d\u3002<br \/>\n\/usr\/sbin\/ntpd: \u8fd9\u662fNTP\u7684daemon\u6587\u4ef6\uff0c\u9700\u8981\u542f\u52a8\u5b83\u624d\u80fd\u63d0\u4f9bNTP\u670d\u52a1\uff0c\u8fd9\u4e2a\u547d\u4ee4\u4f1a\u8bfb\u53d6\/etc\/ntp.conf\u91cc\u9762\u7684\u8bbe\u7f6e\u3002<br \/>\n\/usr\/sbin\/ntpdate: \u8fd9\u662fclient\u7528\u6765\u8fde\u63a5NTP Server\u7684\u4e3b\u8981\u6267\u884c\u6587\u4ef6\uff0c\u5982\u679c\u60a8\u4e0d\u60f3\u542f\u7528NTP\uff0c\u53ea\u60f3\u542f\u7528NTP Client\u529f\u80fd\u7684\u8bdd\uff0c\u53ef\u4ee5\u53ea\u5e94\u7528\u6b64\u547d\u4ee4\u3002<br \/>\n\/usr\/sbin\/ntptrace: \u53ef\u4ee5\u7528\u6765\u8ffd\u8e2a\u67d0\u53f0\u65f6\u95f4\u670d\u52a1\u5668\u7684\u65f6\u95f4\u5bf9\u5e94\u5173\u7cfb\u3002<\/p>\n<p><span style=\"font-size: medium;\"><strong>\u5b89\u88c5\u4e0e\u914d\u7f6e<\/strong><\/span><\/p>\n<p>\u8bbe\u7f6e\u65f6\u533a:cp \/usr\/share\/zoneinfo\/Asia\/Shanghai \/etc\/localtime<br \/>\n\u5b89\u88c5ntpd\u670d\u52a1:yum -y install ntp<br \/>\n\u914d\u7f6entpd<br \/>\n\/etc\/ntp.conf<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nrestrict default kod nomodify notrap nopeer noquery\r\n# restrict -6 default kod nomodify notrap nopeer noquery  #\u9488\u5bf9ipv6\u8bbe\u7f6e\r\n\r\n# \u5141\u8bb8\u672c\u5730\u6240\u6709\u64cd\u4f5c\r\nrestrict 127.0.0.1\r\n#restrict -6 ::1\r\n\r\n# \u5141\u8bb8\u7684\u5c40\u57df\u7f51\u7edc\u6bb5\u6216\u5355\u72ecip\r\nrestrict 10.0.0.0 mask 255.0.0.0 nomodify motrap\r\nrestrict 192.168.0.0 mask 255.255.255.0 nomodify motrap\r\nrestrict 192.168.1.123 mask 255.255.255.255 nomodify motrap\r\n\r\n# \u4f7f\u7528\u4e0a\u5c42\u7684internet ntp\u670d\u52a1\u5668\r\nrestrict cn.pool.ntp.org\r\nrestrict 1.cn.poo.ntp.org\r\nrestrict 0.asia.pool.ntp.org\r\nrestrict 3.asia.pool.ntp.org\r\nserver cn.pool.ntp.org prefer\r\nserver 1.cn.poo.ntp.org\r\nserver 0.asia.pool.ntp.org\r\nserver 3.asia.pool.ntp.org\r\n\r\n# \u5982\u679c\u65e0\u6cd5\u4e0e\u4e0a\u5c42ntp server\u901a\u4fe1\u4ee5\u672c\u5730\u65f6\u95f4\u4e3a\u6807\u51c6\u65f6\u95f4\r\nserver   127.127.1.0    # local clock\r\nfudge    127.127.1.0 stratum 10\r\n\r\n# \u8ba1\u7b97\u672cntp server \u4e0e\u4e0a\u5c42ntpserver\u7684\u9891\u7387\u8bef\u5dee\r\ndriftfile \/var\/lib\/ntp\/drift\r\n\r\n# Key file containing the keys and key identifiers used when operating\r\n# with symmetric key cryptography.\r\nkeys \/etc\/ntp\/keys\r\n\r\n#\u65e5\u5fd7\u6587\u4ef6\r\nlogfile \/var\/log\/ntp.log\r\n<\/pre>\n<p>\u5982\u679c\u53ea\u662f\u60f3\u5728\u6ca1\u6709\u5916\u7f51\u8fde\u63a5\u7684\u5185\u7f51\u91cc\u9762\u505a\u65f6\u949fserver\uff0c\u90a3\u4e48\u5728 ntp.conf\u4e2d\u52a0\u5165\u4e0b\u9762\u914d\u7f6e\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ntos orphan\r\n\r\nserver 127.127.0.1\r\nfudge 127.127.0.1 stratum 1\r\n\r\n# \u628a\u5176\u5b83\u6240\u6709\u5916\u7f51\u7684 server \u914d\u7f6e\u5168\u90e8\u5220\u9664\u6389\u3002\r\n<\/pre>\n<p>\u4fee\u6539\/etc\/sysconfig\/ntpd:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# Drop root to id 'ntp:ntp' by default.\r\nOPTIONS=&quot;-u ntp:ntp -p \/var\/run\/ntpd.pid&quot;\r\n# Set to 'yes' to sync hw clock after successful ntpdate\r\nSYNC_HWCLOCK=yes #make no into yes; BIOS\u7684\u65f6\u95f4\u4e5f\u4f1a\u8ddf\u7740\u4fee\u6539\r\n# Additional options for ntpdate\r\nNTPDATE_OPTIONS=&quot;&quot;\r\n<\/pre>\n<p>\u9a8c\u8bc1\u4e0e\u72b6\u6001\u68c0\u67e5<br \/>\n\u8fd0\u884cntp<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nservice ntpd start\/stop\/restart\r\n\r\n# \u67e5\u770bntp\u7684\u7aef\u53e3,\u5e94\u8be5\u770b\u5230123\u7aef\u53e3\r\nnetstat -unlnp\r\n\r\n# \u67e5\u770bntp\u670d\u52a1\u5668\u6709\u65e0\u548c\u4e0a\u5c42\u8fde\u901a\r\nntpstat\r\n\r\nsynchronised to NTP server () at stratum 2\r\ntime correct to within 74 ms\r\npolling server every 128 s\r\n# \u6ce8\u610f\uff1a\u6b64\u547d\u4ee4\u51fa\u73b0\u4e0a\u8ff0synchronised\u7ed3\u679c\u6bd4\u8f83\u6162\uff0c\u6211\u7684\u7528\u4e86\u5927\u69825\u5206\u949f\u3002\r\n<\/pre>\n<p>\u67e5\u770bntp\u670d\u52a1\u5668\u4e0e\u4e0a\u5c42\u95f4\u7684\u8054\u7cfb:ntptrace<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nntptrace -n 127.0.0.1\r\n\r\n127.0.0.1: stratum 3, offset -0.001095, synch distance 0.532610\r\n116.193.83.174: timed out, nothing received\r\n<\/pre>\n<p>\u67e5\u770bntp\u670d\u52a1\u5668\u4e0e\u4e0a\u5c42ntp\u670d\u52a1\u5668\u7684\u72b6\u6001:ntpq<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nntpq -p\r\n\r\n# \u5176\u4e2d:\r\n# remote - \u672c\u673a\u548c\u4e0a\u5c42ntp\u7684ip\u6216\u4e3b\u673a\u540d\uff0c\u201c+\u201d\u8868\u793a\u4f18\u5148\uff0c\u201c*\u201d\u8868\u793a\u6b21\u4f18\u5148\r\n# refid  - \u53c2\u8003\u4e0a\u4e00\u5c42ntp\u4e3b\u673a\u5730\u5740\r\n# st     - stratum\u9636\u5c42\r\n# when   - \u591a\u5c11\u79d2\u524d\u66fe\u7ecf\u540c\u6b65\u8fc7\u65f6\u95f4\r\n# poll   - \u4e0b\u6b21\u66f4\u65b0\u5728\u591a\u5c11\u79d2\u540e\r\n# reach  - \u5df2\u7ecf\u5411\u4e0a\u5c42ntp\u670d\u52a1\u5668\u8981\u6c42\u66f4\u65b0\u7684\u6b21\u6570\r\n# delay  - \u7f51\u7edc\u5ef6\u8fdf\r\n# offset - \u65f6\u95f4\u8865\u507f\r\n# jitter - \u7cfb\u7edf\u65f6\u95f4\u4e0ebios\u65f6\u95f4\u5dee\r\n<\/pre>\n<p>\u5982\u679c\u6240\u6709\u8fdc\u7a0b\u670d\u52a1\u5668\u7684jitter\u503c\u662f4000\u5e76\u4e14delay\u548creach\u7684\u503c\u662f0\uff0c\u90a3\u4e48\u8bf4\u660e\u65f6\u95f4\u540c\u6b65\u662f\u6709\u95ee\u9898\u7684\u3002<\/p>\n<p>\u53ef\u80fd\u7684\u539f\u56e0\u662f\u9632\u706b\u5899\u963b\u65ad\u4e86\u4e0eserver\u4e4b\u95f4\u7684\u901a\u8baf\uff0c\u5373123\u7aef\u53e3\u662f\u5426\u6b63\u5e38\u5f00\u653e\uff1b<\/p>\n<p>\u6b64\u5916\u6bcf\u6b21\u91cd\u542fNTP\u670d\u52a1\u5668\u4e4b\u540e\u5927\u7ea6\u89813\uff0d5\u5206\u949f\u5ba2\u6237\u7aef\u624d\u80fd\u4e0eserver\u5efa\u7acb\u6b63\u5e38\u7684\u901a\u8baf\u8fde\u63a5\uff0c\u5426\u5219\u4f60\u5728\u5ba2\u6237\u7aef\u6267\u884c\u201cntpdate \u670d\u52a1\u5668ip\u201d\u7684\u65f6\u5019\u5c06\u8fd4\u56de\uff1a<\/p>\n<p>27 Jun 10:20:17 ntpdate[21920]: no server suitable for synchronization found<\/p>\n<p><span style=\"font-size: medium;\"><strong>\u542f\u52a8NTPD<\/strong><\/span><\/p>\n<p>\u6211\u91c7\u7528\u4e86\u4e00\u4e2a\u5f88\u7b28\u7684\u529e\u6cd5\u6765\u624b\u52a8\u542f\u52a8ntpd\uff0c\u800c\u4e0d\u662f\u628antpd\u52a0\u5165\u670d\u52a1\uff0c\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u811a\u672c<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nvi ntpstart.sh\r\nntpdate cn.pool.ntp.org\r\nntpdate cn.pool.ntp.org\r\nservice ntpd start\r\n<\/pre>\n<p>\u7136\u540e\u52a0\u5165\/etc\/rc.local:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\/shpath\/ntpstart.sh\r\n<\/pre>\n<p>\u8fd9\u662f\u56e0\u4e3a\u6211\u6709\u4e00\u53f0\u670d\u52a1\u5668\u542f\u52a8\u540e\u7684\u65f6\u95f4\u603b\u662f\u4e0e\u6807\u51c6\u65f6\u95f4\u5dee\u522b\u5f88\u5927\uff0c\u6bcf\u6b21\u542f\u52a8\u540entpd\u8981\u82b1\u5f88\u591a\u65f6\u95f4\u624d\u80fd\u628a\u65f6\u95f4\u6821\u51c6\uff0c\u6240\u4ee5\u6211\u662f\u5148\u5728\u7cfb\u7edf\u542f\u52a8\u540entpdate\u66f4\u65b0\u4e24\u6b21\uff0c\u7136\u540e\u518d\u542f\u52a8ntpd\u670d\u52a1\uff0c\u5728freebsd\u91cc\u597d\u50cf\u6709\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\uff0c\u8ba9\u65f6\u95f4\u670d\u52a1\u5668\u5728\u7cfb\u7edf\u542f\u52a8\u4e4b\u524d\u542f\u52a8\u7684\uff0ccentos\u8fd8\u6ca1\u4ed4\u7ec6\u7422\u78e8\u3002<\/p>\n<p><span style=\"font-size: medium;\"><strong>\u5ba2\u6237\u7aef\u914d\u7f6e<\/strong><\/span><\/p>\n<p>\u65b9\u6cd51.\u4f7f\u7528ntpdate\u4e0e\u4e0a\u9762\u914d\u7f6e\u7684\u65f6\u95f4\u670d\u52a1\u5668\u5b9a\u65f6\u540c\u6b65\uff0c\u4e0d\u63a8\u8350\u6b64\u65b9\u6cd5<br \/>\n\u65b9\u6cd52.\u5b89\u88c5ntpd\uff0c\u6307\u5b9a\u65f6\u95f4server\u4e3a\u4e0a\u9762\u914d\u7f6e\u7684\u670d\u52a1\u5668\u5730\u5740\uff0c\u63a8\u8350<br \/>\n\u66f4\u8be6\u7ec6\u7684\u4ecb\u7ecd\u53c2\u89c1\u53f0\u6e7e \u9e1f\u54e5\u7684Linux\u79c1\u623f\u83dc: http:\/\/linux.vbird.org\/linux_server\/0440ntp.php<\/p>\n<p>\u9644\u5f55<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n\u4e2d\u56fd\u56fd\u5bb6\u6388\u65f6\u4e2d\u5fc3(\u9655\u897f\u897f\u5b89) 210.72.145.44\r\n\u4e0a\u6d77\uff1a 61.129.66.79 (t2.hshh.org) 61.129.42.44 (ntp.fudan.edu.cn) 202.120.2.101 (ntp.sjtu.edu.cn)\r\n\u6d59\u6c5f 218.75.4.130 (t1.hshh.org)\r\n\u5185\u8499\u53e4 218.21.130.42 (t1.hshh.org)\r\n\u9999\u6e2f: 137.189.11.66 (clock.cuhk.edu.hk ) 137.189.11.128 (ntp.cuhk.edu.hk )\r\n\u53f0\u6e7e: 220.130.158.52(time.stdtime.gov.tw) 220.130.158.72(Clock.stdtime.gov.tw)\r\n220.130.158.51(tick.stdtime.gov.tw) 220.130.158.54(watch.stdtime.gov.tw)\r\nasia.pool.ntp.org\uff0c \u66f4\u591a\u4e9a\u6d32\u670d\u52a1\u5668\u8bf7\u53c2\u8003 http:\/\/www.pool.ntp.org\/zone\/asia\r\ncn.pool.ntp.org, \u66f4\u591a\u4e2d\u56fd\u670d\u52a1\u5668\u8bf7\u53c2\u8003 http:\/\/www.pool.ntp.org\/zone\/cn\r\ntw.pool.ntp.org, \u66f4\u591a\u4e2d\u56fd\u53f0\u6e7e\u670d\u52a1\u5668\u8bf7\u53c2\u8003 http:\/\/www.pool.ntp.org\/zone\/tw\r\nhk.pool.ntp.org, \u66f4\u591a\u4e2d\u56fd\u9999\u6e2f\u670d\u52a1\u5668\u8bf7\u53c2\u8003 http:\/\/www.pool.ntp.org\/zone\/hk\r\n<\/pre>\n<p>\u53d6\u6d88ntpd\u81ea\u52a8\u542f\u52a8\uff0c\u5728\u7cfb\u7edf\u542f\u52a8\u65f6\uff0c\u6307\u5b9antpdate\u8fdc\u7a0b\u6807\u51c6\u65f6\u95f4\u670d\u52a1\u5668\u4e24\u6b21\uff0c\u7136\u540eservice ntpd start<br \/>\n\u597d\u50cf\u4e5f\u53ef\u4ee5\u4fee\u6539rc.conf\u6216\u8005\u52a0\u4e0a\u4e00\u5806\u4ec0\u4e48\u53c2\u6570\u6765\u5b9e\u73b0\uff0c\u6211\u5077\u61d2\u7528\u8fd9\u4e2a\u7b28\u529e\u6cd5\u6765\u4fdd\u8bc1\u65f6\u95f4\u7684\u51c6\u786e\u4e86<\/p>\n<p><span style=\"font-size: medium;\"><strong>\u89e3\u51b3ntp\u7684\u9519\u8bef<\/strong><\/span><\/p>\n<p>\u89e3\u51b3ntp\u7684\u9519\u8bef no server suitable for synchronization found<\/p>\n<p>\u5f53\u7528ntpdate -d \u6765\u67e5\u8be2\u65f6\u4f1a\u53d1\u73b0\u5bfc\u81f4 no server suitable for synchronization found \u7684\u9519\u8bef\u7684\u4fe1\u606f\u6709\u4ee5\u4e0b2\u4e2a\uff1a<\/p>\n<p><span style=\"font-size: medium;\"><strong>\u9519\u8bef1.Server dropped: Strata too high<\/strong><\/span><\/p>\n<p>\u5728ntp\u5ba2\u6237\u7aef\u8fd0\u884cntpdate serverIP\uff0c\u51fa\u73b0no server suitable for synchronization found\u7684\u9519\u8bef\u3002<\/p>\n<p>\u5728ntp\u5ba2\u6237\u7aef\u7528ntpdate \u2013d serverIP\u67e5\u770b\uff0c\u53d1\u73b0\u6709Server dropped: strata too high\u7684\u9519\u8bef\uff0c\u5e76\u4e14\u663e\u793astratum 16\u3002\u800c\u6b63\u5e38\u60c5\u51b5\u4e0bstratum\u8fd9\u4e2a\u503c\u5f97\u8303\u56f4\u662f0~15\u3002<\/p>\n<p>\u8fd9\u662f\u56e0\u4e3aNTP server\u8fd8\u6ca1\u6709\u548c\u5176\u81ea\u8eab\u6216\u8005\u5b83\u7684server\u540c\u6b65\u4e0a\u3002<\/p>\n<p>\u4ee5\u4e0b\u7684\u5b9a\u4e49\u662f\u8ba9NTP Server\u548c\u5176\u81ea\u8eab\u4fdd\u6301\u540c\u6b65\uff0c\u5982\u679c\u5728\/ntp.conf\u4e2d\u5b9a\u4e49\u7684server\u90fd\u4e0d\u53ef\u7528\u65f6\uff0c\u5c06\u4f7f\u7528local\u65f6\u95f4\u4f5c\u4e3antp\u670d\u52a1\u63d0\u4f9b\u7ed9ntp\u5ba2\u6237\u7aef\u3002<\/p>\n<p>server 127.127.1.0<br \/>\nfudge 127.127.1.0 stratum 8<\/p>\n<p>\u5728ntp server\u4e0a\u91cd\u65b0\u542f\u52a8ntp\u670d\u52a1\u540e\uff0cntp server\u81ea\u8eab\u6216\u8005\u4e0e\u5176server\u7684\u540c\u6b65\u7684\u9700\u8981\u4e00\u4e2a\u65f6\u95f4\u6bb5\uff0c\u8fd9\u4e2a\u8fc7\u7a0b\u53ef\u80fd\u662f5\u5206\u949f\uff0c\u5728\u8fd9\u4e2a\u65f6\u95f4\u4e4b\u5185\u5728\u5ba2\u6237\u7aef\u8fd0\u884cntpdate\u547d\u4ee4\u65f6\u4f1a\u4ea7\u751fno server suitable for synchronization found\u7684\u9519\u8bef\u3002<\/p>\n<p>\u90a3\u4e48\u5982\u4f55\u77e5\u9053\u4f55\u65f6ntp server\u5b8c\u6210\u4e86\u548c\u81ea\u8eab\u540c\u6b65\u7684\u8fc7\u7a0b\u5462\uff1f \u5728ntp server\u4e0a\u4f7f\u7528\u547d\u4ee4\uff1a<\/p>\n<p>watch ntpq -p<\/p>\n<p>\u51fa\u73b0\u753b\u9762\uff1a<br \/>\nEvery 2.0s: ntpq -p Thu Jul 10 02:28:32 2008<br \/>\nremote refid st t when poll reach delay offset jitter<br \/>\n==============================================================================<br \/>\n192.168.30.22 LOCAL(0) 8 u 22 64 1 2.113 179133. 0.001<br \/>\nLOCAL(0) LOCAL(0) 10 l 21 64 1 0.000 0.000 0.001<\/p>\n<p>\u6ce8\u610fLOCAL\u7684\u8fd9\u4e2a\u5c31\u662f\u4e0e\u81ea\u8eab\u540c\u6b65\u7684ntp server\u3002<\/p>\n<p>\u6ce8\u610freach\u8fd9\u4e2a\u503c\uff0c\u5728\u542f\u52a8ntp server\u670d\u52a1\u540e\uff0c\u8fd9\u4e2a\u503c\u5c31\u4ece0\u5f00\u59cb\u4e0d\u65ad\u589e\u52a0\uff0c\u5f53\u589e\u52a0\u523017\u7684\u65f6\u5019\uff0c\u4ece0\u523017\u662f5\u6b21\u7684\u53d8\u66f4\uff0c\u6bcf\u4e00\u6b21\u662fpoll\u7684\u503c\u7684\u79d2\u6570\uff0c\u662f64\u79d2*5=320\u79d2\u7684\u65f6\u95f4\u3002<\/p>\n<p>\u5982\u679c\u4e4b\u540e\u4ecentp\u5ba2\u6237\u7aef\u540c\u6b65ntp server\u8fd8\u5931\u8d25\u7684\u8bdd\uff0c\u7528ntpdate \u2013d\u6765\u67e5\u8be2\u8be6\u7ec6\u9519\u8bef\u4fe1\u606f\uff0c\u518d\u505a\u5224\u65ad\u3002<\/p>\n<p><span style=\"font-size: medium;\"><strong>\u9519\u8bef2.Server dropped: no data<\/strong><\/span><\/p>\n<p>\u4ece\u5ba2\u6237\u7aef\u6267\u884cnetdate \u2013d\u65f6\u6709\u9519\u8bef\u4fe1\u606f\u5982\u4e0b\uff1a<\/p>\n<p>transmit(192.168.30.22)<br \/>\ntransmit(192.168.30.22)<br \/>\ntransmit(192.168.30.22)<br \/>\ntransmit(192.168.30.22)<br \/>\ntransmit(192.168.30.22)<br \/>\n192.168.30.22: Server dropped: no data<br \/>\nserver 192.168.30.22, port 123<br \/>\n&#8230;..<br \/>\n28 Jul 17:42:24 ntpdate[14148]: no server suitable for synchronization found<br \/>\n\u51fa\u73b0\u8fd9\u4e2a\u95ee\u9898\u7684\u539f\u56e0\u53ef\u80fd\u6709\u4e24\u4e2a\uff1a<\/p>\n<p>1.\u68c0\u67e5ntp\u7684\u7248\u672c\uff0c\u5982\u679c\u4f60\u4f7f\u7528\u7684\u662fntp4.2\uff08\u5305\u62ec4.2\uff09\u4e4b\u540e\u7684\u7248\u672c\uff0c\u5728restrict\u7684\u5b9a\u4e49\u4e2d\u4f7f\u7528\u4e86notrust\u7684\u8bdd\uff0c\u4f1a\u5bfc\u81f4\u4ee5\u4e0a\u9519\u8bef\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5ntp\u7684\u7248\u672c\uff1antpq -c version\u3002\u4e0b\u9762\u662f\u6765\u81eantp\u5b98\u65b9\u7f51\u7ad9\u7684\u8bf4\u660e\uff1a<\/p>\n<p>The behavior of notrust changed between versions 4.1 and 4.2.<br \/>\nIn 4.1 (and earlier) notrust meant &#8220;Don&#8217;t trust this host\/subnet for time&#8221;.<br \/>\nIn 4.2 (and later) notrust means &#8220;Ignore all NTP packets that are not cryptographically authenticated.&#8221; This forces remote time servers to authenticate themselves to your (client) ntpd<br \/>\n\u89e3\u51b3:\u628anotrust\u53bb\u6389\u3002<\/p>\n<p>2.\u68c0\u67e5ntp server\u7684\u9632\u706b\u5899\u3002\u53ef\u80fd\u662fserver\u7684\u9632\u706b\u5899\u5c4f\u853d\u4e86upd 123\u7aef\u53e3\u3002 \u53ef\u4ee5\u7528\u547d\u4ee4service iptables stop\u6765\u5173\u6389iptables\u670d\u52a1\u540e\u518d\u5c1d\u8bd5\u4ecentp\u5ba2\u6237\u7aef\u7684\u540c\u6b65\uff0c\u5982\u679c\u6210\u529f\uff0c\u8bc1\u660e\u662f\u9632\u706b\u5899\u7684\u95ee\u9898\uff0c\u9700\u8981\u66f4\u6539iptables\u7684\u8bbe\u7f6e\u3002<\/p>\n<p><span style=\"font-size: medium;\"><strong>NTP\u5de5\u4f5c\u539f\u7406<\/strong><\/span><\/p>\n<p>NTP\u7684\u57fa\u672c\u5de5\u4f5c\u539f\u7406\u5982 \u56fe \u6240\u793a\u3002Device A\u548cDevice B\u901a\u8fc7\u7f51\u7edc\u76f8\u8fde\uff0c\u5b83\u4eec\u90fd\u6709\u81ea\u5df1\u72ec\u7acb\u7684\u7cfb\u7edf\u65f6\u949f\uff0c\u9700\u8981\u901a\u8fc7NTP\u5b9e\u73b0\u5404\u81ea\u7cfb\u7edf\u65f6\u949f\u7684\u81ea\u52a8\u540c\u6b65\u3002\u4e3a\u4fbf\u4e8e\u7406\u89e3\uff0c\u4f5c\u5982\u4e0b\u5047\u8bbe\uff1a<\/p>\n<p>\u5728Device A\u548cDevice B\u7684\u7cfb\u7edf\u65f6\u949f\u540c\u6b65\u4e4b\u524d\uff0cDevice A\u7684\u65f6\u949f\u8bbe\u5b9a\u4e3a10:00:00am\uff0cDevice B\u7684\u65f6\u949f\u8bbe\u5b9a\u4e3a11:00:00am\u3002<\/p>\n<p>Device B\u4f5c\u4e3aNTP\u65f6\u95f4\u670d\u52a1\u5668\uff0c\u5373Device A\u5c06\u4f7f\u81ea\u5df1\u7684\u65f6\u949f\u4e0eDevice B\u7684\u65f6\u949f\u540c\u6b65\u3002<\/p>\n<p>NTP\u62a5\u6587\u5728Device A\u548cDevice B\u4e4b\u95f4\u5355\u5411\u4f20\u8f93\u6240\u9700\u8981\u7684\u65f6\u95f4\u4e3a1\u79d2\u3002<\/p>\n<p><a href=\"https:\/\/kyle.ai\/blog\/wp-content\/uploads\/2016\/04\/26694208_1388469635gFnP.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6010\" alt=\"26694208_1388469635gFnP\" src=\"https:\/\/kyle.ai\/blog\/wp-content\/uploads\/2016\/04\/26694208_1388469635gFnP.jpg\" width=\"412\" height=\"380\" \/><\/a><\/p>\n<p>\u7cfb\u7edf\u65f6\u949f\u540c\u6b65\u7684\u5de5\u4f5c\u8fc7\u7a0b\u5982\u4e0b\uff1a<\/p>\n<p>Device A\u53d1\u9001\u4e00\u4e2aNTP\u62a5\u6587\u7ed9Device B\uff0c\u8be5\u62a5\u6587\u5e26\u6709\u5b83\u79bb\u5f00Device A\u65f6\u7684\u65f6\u95f4\u6233\uff0c\u8be5\u65f6\u95f4\u6233\u4e3a10:00:00am\uff08T1\uff09\u3002<\/p>\n<p>\u5f53\u6b64NTP\u62a5\u6587\u5230\u8fbeDevice B\u65f6\uff0cDevice B\u52a0\u4e0a\u81ea\u5df1\u7684\u65f6\u95f4\u6233\uff0c\u8be5\u65f6\u95f4\u6233\u4e3a11:00:01am\uff08T2\uff09\u3002<\/p>\n<p>\u5f53\u6b64NTP\u62a5\u6587\u79bb\u5f00Device B\u65f6\uff0cDevice B\u518d\u52a0\u4e0a\u81ea\u5df1\u7684\u65f6\u95f4\u6233\uff0c\u8be5\u65f6\u95f4\u6233\u4e3a11:00:02am\uff08T3\uff09\u3002<\/p>\n<p>\u5f53Device A\u63a5\u6536\u5230\u8be5\u54cd\u5e94\u62a5\u6587\u65f6\uff0cDevice A\u7684\u672c\u5730\u65f6\u95f4\u4e3a10:00:03am\uff08T4\uff09\u3002<\/p>\n<p>\u81f3\u6b64\uff0cDevice A\u5df2\u7ecf\u62e5\u6709\u8db3\u591f\u7684\u4fe1\u606f\u6765\u8ba1\u7b97\u4e24\u4e2a\u91cd\u8981\u7684\u53c2\u6570\uff1a<\/p>\n<p>NTP\u62a5\u6587\u7684\u5f80\u8fd4\u65f6\u5ef6Delay=\uff08T4-T1\uff09-\uff08T3-T2\uff09=2\u79d2\u3002<\/p>\n<p>Device A\u76f8\u5bf9Device B\u7684\u65f6\u95f4\u5deeoffset=\uff08\uff08T2-T1\uff09+\uff08T3-T4\uff09\uff09\/2=1\u5c0f\u65f6\u3002<\/p>\n<p>\u8fd9\u6837\uff0cDevice A\u5c31\u80fd\u591f\u6839\u636e\u8fd9\u4e9b\u4fe1\u606f\u6765\u8bbe\u5b9a\u81ea\u5df1\u7684\u65f6\u949f\uff0c\u4f7f\u4e4b\u4e0eDevice B\u7684\u65f6\u949f\u540c\u6b65\u3002<\/p>\n<p><span style=\"font-size: medium;\"><strong>NTP\u7684\u62a5\u6587\u683c\u5f0f<\/strong><\/span><\/p>\n<p>NTP\u6709\u4e24\u79cd\u4e0d\u540c\u7c7b\u578b\u7684\u62a5\u6587\uff0c\u4e00\u79cd\u662f\u65f6\u949f\u540c\u6b65\u62a5\u6587\uff0c\u53e6\u4e00\u79cd\u662f\u63a7\u5236\u62a5\u6587\u3002\u63a7\u5236\u62a5\u6587\u4ec5\u7528\u4e8e\u9700\u8981\u7f51\u7edc\u7ba1\u7406\u7684\u573a\u5408\uff0c\u5b83\u5bf9\u4e8e\u65f6\u949f\u540c\u6b65\u529f\u80fd\u6765\u8bf4\u5e76\u4e0d\u662f\u5fc5\u9700\u7684\uff0c\u8fd9\u91cc\u4e0d\u505a\u4ecb\u7ecd\u3002<\/p>\n<p><a href=\"https:\/\/kyle.ai\/blog\/wp-content\/uploads\/2016\/04\/26694208_1388469709u52I.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-6011\" alt=\"26694208_1388469709u52I\" src=\"https:\/\/kyle.ai\/blog\/wp-content\/uploads\/2016\/04\/26694208_1388469709u52I.jpg\" width=\"490\" height=\"359\" \/><\/a><\/p>\n<p>\u4e3b\u8981\u5b57\u6bb5\u7684\u89e3\u91ca\u5982\u4e0b\uff1a<\/p>\n<p>LI\uff08Leap Indicator\uff09\uff1a\u957f\u5ea6\u4e3a2\u6bd4\u7279\uff0c\u503c\u4e3a\u201c11\u201d\u65f6\u8868\u793a\u544a\u8b66\u72b6\u6001\uff0c\u65f6\u949f\u672a\u88ab\u540c\u6b65\u3002\u4e3a\u5176\u4ed6\u503c\u65f6NTP\u672c\u8eab\u4e0d\u505a\u5904\u7406\u3002<\/p>\n<p>VN\uff08Version Number\uff09\uff1a\u957f\u5ea6\u4e3a3\u6bd4\u7279\uff0c\u8868\u793aNTP\u7684\u7248\u672c\u53f7\uff0c\u76ee\u524d\u7684\u6700\u65b0\u7248\u672c\u4e3a3\u3002<\/p>\n<p>Mode\uff1a\u957f\u5ea6\u4e3a3\u6bd4\u7279\uff0c\u8868\u793aNTP\u7684\u5de5\u4f5c\u6a21\u5f0f\u3002\u4e0d\u540c\u7684\u503c\u6240\u8868\u793a\u7684\u542b\u4e49\u5206\u522b\u662f\uff1a0\u672a\u5b9a\u4e49\u30011\u8868\u793a\u4e3b\u52a8\u5bf9\u7b49\u4f53\u6a21\u5f0f\u30012\u8868\u793a\u88ab\u52a8\u5bf9\u7b49\u4f53\u6a21\u5f0f\u30013\u8868\u793a\u5ba2\u6237\u6a21\u5f0f\u30014\u8868\u793a\u670d\u52a1\u5668\u6a21\u5f0f\u30015\u8868\u793a\u5e7f\u64ad\u6a21\u5f0f\u6216\u7ec4\u64ad\u6a21\u5f0f\u30016\u8868\u793a\u6b64\u62a5\u6587\u4e3aNTP\u63a7\u5236\u62a5\u6587\u30017\u9884\u7559\u7ed9\u5185\u90e8\u4f7f\u7528\u3002<\/p>\n<p>Stratum\uff1a\u7cfb\u7edf\u65f6\u949f\u7684\u5c42\u6570\uff0c\u53d6\u503c\u8303\u56f4\u4e3a1\uff5e16\uff0c\u5b83\u5b9a\u4e49\u4e86\u65f6\u949f\u7684\u51c6\u786e\u5ea6\u3002\u5c42\u6570\u4e3a1\u7684\u65f6\u949f\u51c6\u786e\u5ea6\u6700\u9ad8\uff0c\u51c6\u786e\u5ea6\u4ece1\u523016\u4f9d\u6b21\u9012\u51cf\uff0c\u5c42\u6570\u4e3a16\u7684\u65f6\u949f\u5904\u4e8e\u672a\u540c\u6b65\u72b6\u6001\uff0c\u4e0d\u80fd\u4f5c\u4e3a\u53c2\u8003\u65f6\u949f\u3002<\/p>\n<p>Poll\uff1a\u8f6e\u8be2\u65f6\u95f4\uff0c\u5373\u4e24\u4e2a\u8fde\u7eedNTP\u62a5\u6587\u4e4b\u95f4\u7684\u65f6\u95f4\u95f4\u9694\u3002<\/p>\n<p>Precision\uff1a\u7cfb\u7edf\u65f6\u949f\u7684\u7cbe\u5ea6\u3002<\/p>\n<p>Root Delay\uff1a\u672c\u5730\u5230\u4e3b\u53c2\u8003\u65f6\u949f\u6e90\u7684\u5f80\u8fd4\u65f6\u95f4\u3002<\/p>\n<p>Root Dispersion\uff1a\u7cfb\u7edf\u65f6\u949f\u76f8\u5bf9\u4e8e\u4e3b\u53c2\u8003\u65f6\u949f\u7684\u6700\u5927\u8bef\u5dee\u3002<\/p>\n<p>Reference Identifier\uff1a\u53c2\u8003\u65f6\u949f\u6e90\u7684\u6807\u8bc6\u3002<\/p>\n<p>lReference Timestamp\uff1a\u7cfb\u7edf\u65f6\u949f\u6700\u540e\u4e00\u6b21\u88ab\u8bbe\u5b9a\u6216\u66f4\u65b0\u7684\u65f6\u95f4\u3002<\/p>\n<p>Originate Timestamp\uff1aNTP\u8bf7\u6c42\u62a5\u6587\u79bb\u5f00\u53d1\u9001\u7aef\u65f6\u53d1\u9001\u7aef\u7684\u672c\u5730\u65f6\u95f4\u3002<\/p>\n<p>Receive Timestamp\uff1aNTP\u8bf7\u6c42\u62a5\u6587\u5230\u8fbe\u63a5\u6536\u7aef\u65f6\u63a5\u6536\u7aef\u7684\u672c\u5730\u65f6\u95f4\u3002<\/p>\n<p>Transmit Timestamp\uff1a\u5e94\u7b54\u62a5\u6587\u79bb\u5f00\u5e94\u7b54\u8005\u65f6\u5e94\u7b54\u8005\u7684\u672c\u5730\u65f6\u95f4\u3002<\/p>\n<p>Authenticator\uff1a\u9a8c\u8bc1\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS\u914d\u7f6e\u65f6\u95f4\u540c\u6b65NTP \u4e3a\u4ec0\u4e48\u8981\u4f7f\u7528ntpd\u800c\u4e0d\u662fntpdate\uff1f \u539f\u56e0\u5f88\u7b80\u5355\uff0cntpd\u662f\u6b65\u8fdb\u5f0f\u7684\u9010\u6e10 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-6000","post","type-post","status-publish","format-standard","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=6000"}],"version-history":[{"count":7,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6000\/revisions"}],"predecessor-version":[{"id":6015,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6000\/revisions\/6015"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=6000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=6000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=6000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}