
{"id":556,"date":"2021-09-12T19:48:39","date_gmt":"2021-09-12T11:48:39","guid":{"rendered":"http:\/\/dba.qishuo.xin\/?p=556"},"modified":"2021-12-07T09:56:22","modified_gmt":"2021-12-07T01:56:22","slug":"%e5%9c%a8oel7%e4%b8%8a%e5%ae%89%e8%a3%85chrony%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"http:\/\/dba.qishuo.xin\/?p=556","title":{"rendered":"\u5728OEL7\u4e0a\u5b89\u88c5Chrony\u65f6\u95f4\u670d\u52a1"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_76 ez-toc-wrap-right counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<label for=\"ez-toc-cssicon-toggle-item-69df3559e429c\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69df3559e429c\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#1_%E7%B3%BB%E7%BB%9F%E7%8E%AF%E5%A2%83\" >1. \u7cfb\u7edf\u73af\u5883<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#11_%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99\" >1.1 \u53c2\u8003\u8d44\u6599<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#12_%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%8E%AF%E5%A2%83\" >1.2 \u64cd\u4f5c\u7cfb\u7edf\u73af\u5883<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#13_%E6%95%B0%E6%8D%AE%E5%BA%93%E7%8E%AF%E5%A2%83\" >1.3 \u6570\u636e\u5e93\u73af\u5883<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#2_Chrony%E7%AE%80%E4%BB%8B\" >2. Chrony\u7b80\u4ecb<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#3_Chrony%E9%85%8D%E7%BD%AE\" >3. Chrony\u914d\u7f6e<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#31_chrony%E7%9A%84%E6%93%8D%E4%BD%9C\" >3.1 chrony\u7684\u64cd\u4f5c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#32_%E9%98%B2%E7%81%AB%E5%A2%99%E9%85%8D%E7%BD%AE\" >3.2 \u9632\u706b\u5899\u914d\u7f6e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#33_chrony%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6\" >3.3 chrony\u914d\u7f6e\u6587\u4ef6<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#34_%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E\" >3.4 \u914d\u7f6e\u53c2\u6570\u8bf4\u660e<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#35_%E6%A3%80%E6%9F%A5ntp%E6%BA%90%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%8A%B6%E6%80%81\" >3.5 \u68c0\u67e5ntp\u6e90\u670d\u52a1\u5668\u72b6\u6001<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#36_%E6%9F%A5%E7%9C%8Bntp%E8%AF%A6%E7%BB%86%E7%9A%84%E5%90%8C%E6%AD%A5%E7%8A%B6%E6%80%81\" >3.6 \u67e5\u770bntp\u8be6\u7ec6\u7684\u540c\u6b65\u72b6\u6001<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#37_%E6%9F%A5%E7%9C%8B%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4%E3%80%81%E6%97%B6%E5%8C%BA%E5%8F%8ANTP%E7%8A%B6%E6%80%81\" >3.7 \u67e5\u770b\u65e5\u671f\u65f6\u95f4\u3001\u65f6\u533a\u53caNTP\u72b6\u6001<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#38_%E8%8A%82%E7%82%B9%EF%BC%88%E5%AE%A2%E6%88%B7%E7%AB%AF%EF%BC%89%E9%85%8D%E7%BD%AE\" >3.8 \u8282\u70b9\uff08\u5ba2\u6237\u7aef\uff09\u914d\u7f6e<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#4_chronyc%E5%91%BD%E4%BB%A4%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E\" >4. chronyc\u547d\u4ee4\u53c2\u6570\u8bf4\u660e<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#41_chronyc_activity\" >4.1 chronyc activity<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#42_chronyc_tracking\" >4.2 chronyc tracking<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#43_chronyc_sources_-v_%E6%9F%A5%E7%9C%8B%E6%98%AF%E5%90%A6%E5%90%8C%E6%AD%A5\" >4.3. chronyc sources -v \u67e5\u770b\u662f\u5426\u540c\u6b65<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"http:\/\/dba.qishuo.xin\/?p=556\/#5_chrony%E7%9A%84%E4%BC%98%E5%8A%BF\" >5. chrony\u7684\u4f18\u52bf<\/a><\/li><\/ul><\/nav><\/div>\n<h3><span class=\"ez-toc-section\" id=\"1_%E7%B3%BB%E7%BB%9F%E7%8E%AF%E5%A2%83\"><\/span>1. \u7cfb\u7edf\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"11_%E5%8F%82%E8%80%83%E8%B5%84%E6%96%99\"><\/span>1.1 \u53c2\u8003\u8d44\u6599<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>https:\/\/www.server-world.info\/en\/<br \/>\nhttps:\/\/www.server-world.info\/en\/note?os=CentOS_7&p=ntp&f=3<br \/>\nhttps:\/\/www.xiexianbin.cn\/linux\/2016-02-08-chrony\/  Linux \u4e2d\u540c\u6b65\u65f6\u95f4\u5de5\u5177 Chrony \u4ecb\u7ecd\u548c\u4f7f\u7528<\/p>\n<h4><span class=\"ez-toc-section\" id=\"12_%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F%E7%8E%AF%E5%A2%83\"><\/span>1.2 \u64cd\u4f5c\u7cfb\u7edf\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Oracle Linux Server 7.6<\/p>\n<h4><span class=\"ez-toc-section\" id=\"13_%E6%95%B0%E6%8D%AE%E5%BA%93%E7%8E%AF%E5%A2%83\"><\/span>1.3 \u6570\u636e\u5e93\u73af\u5883<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u65e0<\/p>\n<h3><span class=\"ez-toc-section\" id=\"2_Chrony%E7%AE%80%E4%BB%8B\"><\/span>2. Chrony\u7b80\u4ecb<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Chrony\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u81ea\u7531\u8f6f\u4ef6\uff0c\u5b83\u80fd\u5e2e\u52a9\u4f60\u4fdd\u6301\u7cfb\u7edf\u65f6\u949f\u4e0e\u65f6\u949f\u670d\u52a1\u5668\uff08NTP\uff09\u540c\u6b65\uff0c\u56e0\u6b64\u8ba9\u4f60\u7684\u65f6\u95f4\u4fdd\u6301\u7cbe\u786e\u3002\u5b83\u7531\u4e24\u4e2a\u7a0b\u5e8f\u7ec4\u6210\uff0c\u5206\u522b\u662fchronyd\u548cchronyc\u3002chronyd\u662f\u4e00\u4e2a\u540e\u53f0\u8fd0\u884c\u7684\u5b88\u62a4\u8fdb\u7a0b\uff0c\u7528\u4e8e\u8c03\u6574\u5185\u6838\u4e2d\u8fd0\u884c\u7684\u7cfb\u7edf\u65f6\u949f\u548c\u65f6\u949f\u670d\u52a1\u5668\u540c\u6b65\u3002\u5b83\u786e\u5b9a\u8ba1\u7b97\u673a\u589e\u51cf\u65f6\u95f4\u7684\u6bd4\u7387\uff0c\u5e76\u5bf9\u6b64\u8fdb\u884c\u8865\u507f\u3002chronyc\u63d0\u4f9b\u4e86\u4e00\u4e2a\u7528\u6237\u754c\u9762\uff0c\u7528\u4e8e\u76d1\u63a7\u6027\u80fd\u5e76\u8fdb\u884c\u591a\u6837\u5316\u7684\u914d\u7f6e\u3002\u5b83\u53ef\u4ee5\u5728chronyd\u5b9e\u4f8b\u63a7\u5236\u7684\u8ba1\u7b97\u673a\u4e0a\u5de5\u4f5c\uff0c\u4e5f\u53ef\u4ee5\u5728\u4e00\u53f0\u4e0d\u540c\u7684\u8fdc\u7a0b\u8ba1\u7b97\u673a\u4e0a\u5de5\u4f5c\u3002<br \/>\n\u5728\u50cfCentOS7\u4e4b\u7c7b\u57fa\u4e8eRHEL\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\uff0c\u5df2\u7ecf\u9ed8\u8ba4\u5b89\u88c5\u6709Chrony\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"3_Chrony%E9%85%8D%E7%BD%AE\"><\/span>3. Chrony\u914d\u7f6e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"31_chrony%E7%9A%84%E6%93%8D%E4%BD%9C\"><\/span>3.1 chrony\u7684\u64cd\u4f5c<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><strong>NOTICE\uff1a\u9996\u5148\u5f97\u914d\u7f6e\u597dYUM\u6e90<\/strong><\/p>\n<pre><code class=\"language-shell line-numbers\">yum install -y chrony     --&gt;\u5b89\u88c5\u670d\u52a1\nsystemctl start chronyd.service   --&gt;\u542f\u52a8\u670d\u52a1\nsystemctl enable chronyd.service   --&gt;\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f\u52a8\uff0c\u9ed8\u8ba4\u662fenable\u7684\n<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"32_%E9%98%B2%E7%81%AB%E5%A2%99%E9%85%8D%E7%BD%AE\"><\/span>3.2 \u9632\u706b\u5899\u914d\u7f6e<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5982\u679cFirewalld\u6b63\u5728\u8fd0\u884c\uff0c\u8bf7\u5141\u8bb8NTP\u670d\u52a1\u3002 NTP\u4f7f\u7528123 \/ UDP\u3002<\/p>\n<pre><code class=\"language-shell line-numbers\"> firewall-cmd --add-service=ntp --permanent\n firewall-cmd --reload\n<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"33_chrony%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6\"><\/span>3.3 chrony\u914d\u7f6e\u6587\u4ef6<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>chrony\u670d\u52a1\u4f7f\u7528\u7684\u914d\u7f6e\u6587\u4ef6\u4e3a\/etc\/chrony.conf<br \/>\n\u5176\u914d\u7f6e\u5185\u5bb9\u683c\u5f0f\u548cntpd\u670d\u52a1\u57fa\u672c\u76f8\u4f3c<\/p>\n<pre><code class=\"language-shell line-numbers\"> ~]# cat \/etc\/chrony.conf\n\n# Use public servers from the pool.ntp.org project.\n# Please consider joining the pool (http:\/\/www.pool.ntp.org\/join.html).\nserver 0.pool.ntp.org iburst\nserver 1.pool.ntp.org iburst\nserver 2.pool.ntp.org iburst\nserver 3.pool.ntp.org iburst\n\n# Record the rate at which the system clock gains\/losses time.\ndriftfile \/var\/lib\/chrony\/drift\n\n# Allow the system clock to be stepped in the first three updates\n# if its offset is larger than 1 second.\nmakestep 1.0 3\n\n# Enable kernel synchronization of the real-time clock (RTC).\nrtcsync\n\n# Enable hardware timestamping on all interfaces that support it.\n#hwtimestamp *\n\n# Increase the minimum number of selectable sources required to adjust\n# the system clock.\n#minsources 2\n\n# Allow NTP client access from local network.\n#allow 192.168.0.0\/16\n\n# Serve time even if not synchronized to a time source.\n#local stratum 10\n\n# Specify file containing keys for NTP authentication.\n#keyfile \/etc\/chrony.keys\n\n# Specify directory for log files.\nlogdir \/var\/log\/chrony\n\n# Select which information is logged.\n#log measurements statistics tracking\n<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"34_%E9%85%8D%E7%BD%AE%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E\"><\/span>3.4 \u914d\u7f6e\u53c2\u6570\u8bf4\u660e<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<table>\n<thead>\n<tr>\n<th align=\"left\">\u53c2\u6570<\/th>\n<th align=\"left\">\u53c2\u6570\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">server<\/td>\n<td align=\"left\">\u8be5\u53c2\u6570\u53ef\u4ee5\u591a\u6b21\u7528\u4e8e\u6dfb\u52a0\u65f6\u949f\u670d\u52a1\u5668\uff0c\u5fc5\u987b\u4ee5\"server \"\u683c\u5f0f\u4f7f\u7528\u3002\u4e00\u822c\u800c\u8a00\uff0c\u4f60\u60f3\u6dfb\u52a0\u591a\u5c11\u670d\u52a1\u5668\uff0c\u5c31\u53ef\u4ee5\u6dfb\u52a0\u591a\u5c11\u670d\u52a1\u5668<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">stratumweight<\/td>\n<td align=\"left\">stratumweight\u6307\u4ee4\u8bbe\u7f6e\u5f53chronyd\u4ece\u53ef\u7528\u6e90\u4e2d\u9009\u62e9\u540c\u6b65\u6e90\u65f6\uff0c\u6bcf\u4e2a\u5c42\u5e94\u8be5\u6dfb\u52a0\u591a\u5c11\u8ddd\u79bb\u5230\u540c\u6b65\u8ddd\u79bb\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cCentOS\u4e2d\u8bbe\u7f6e\u4e3a0\uff0c\u8ba9chronyd\u5728\u9009\u62e9\u6e90\u65f6\u5ffd\u7565\u6e90\u7684\u5c42\u7ea7<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">driftfile<\/td>\n<td align=\"left\">chronyd\u7a0b\u5e8f\u7684\u4e3b\u8981\u884c\u4e3a\u4e4b\u4e00\uff0c\u5c31\u662f\u6839\u636e\u5b9e\u9645\u65f6\u95f4\u8ba1\u7b97\u51fa\u8ba1\u7b97\u673a\u589e\u51cf\u65f6\u95f4\u7684\u6bd4\u7387\uff0c\u5c06\u5b83\u8bb0\u5f55\u5230\u4e00\u4e2a\u6587\u4ef6\u4e2d\u662f\u6700\u5408\u7406\u7684\uff0c\u5b83\u4f1a\u5728\u91cd\u542f\u540e\u4e3a\u7cfb\u7edf\u65f6\u949f\u4f5c\u51fa\u8865\u507f\uff0c\u751a\u81f3\u53ef\u80fd\u7684\u8bdd\uff0c\u4f1a\u4ece\u65f6\u949f\u670d\u52a1\u5668\u83b7\u5f97\u8f83\u597d\u7684\u4f30\u503c<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">rtcsync<\/td>\n<td align=\"left\">rtcsync\u6307\u4ee4\u5c06\u542f\u7528\u4e00\u4e2a\u5185\u6838\u6a21\u5f0f\uff0c\u5728\u8be5\u6a21\u5f0f\u4e2d\uff0c\u7cfb\u7edf\u65f6\u95f4\u6bcf11\u5206\u949f\u4f1a\u62f7\u8d1d\u5230\u5b9e\u65f6\u65f6\u949f\uff08RTC\uff09<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">allow\/deny<\/td>\n<td align=\"left\">\u8fd9\u91cc\u4f60\u53ef\u4ee5\u6307\u5b9a\u4e00\u53f0\u4e3b\u673a\u3001\u5b50\u7f51\uff0c\u6216\u8005\u7f51\u7edc\u4ee5\u5141\u8bb8\u6216\u62d2\u7eddNTP\u8fde\u63a5\u5230\u626e\u6f14\u65f6\u949f\u670d\u52a1\u5668\u7684\u673a\u5668<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">cmdallow\/cmddeny<\/td>\n<td align=\"left\">\u8ddf\u4e0a\u9762\u76f8\u7c7b\u4f3c\uff0c\u53ea\u662f\u4f60\u53ef\u4ee5\u6307\u5b9a\u54ea\u4e2aIP\u5730\u5740\u6216\u54ea\u53f0\u4e3b\u673a\u53ef\u4ee5\u901a\u8fc7chronyd\u4f7f\u7528\u63a7\u5236\u547d\u4ee4<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">bindcmdaddress<\/td>\n<td align=\"left\">\u8be5\u6307\u4ee4\u5141\u8bb8\u4f60\u9650\u5236chronyd\u76d1\u542c\u54ea\u4e2a\u7f51\u7edc\u63a5\u53e3\u7684\u547d\u4ee4\u5305\uff08\u7531chronyc\u6267\u884c\uff09\u3002\u8be5\u6307\u4ee4\u901a\u8fc7cmddeny\u673a\u5236\u63d0\u4f9b\u4e86\u4e00\u4e2a\u9664\u4e0a\u8ff0\u9650\u5236\u4ee5\u5916\u53ef\u7528\u7684\u989d\u5916\u7684\u8bbf\u95ee\u63a7\u5236\u7b49\u7ea7<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">makestep<\/td>\n<td align=\"left\">\u901a\u5e38\uff0cchronyd\u5c06\u6839\u636e\u9700\u6c42\u901a\u8fc7\u51cf\u6162\u6216\u52a0\u901f\u65f6\u949f\uff0c\u4f7f\u5f97\u7cfb\u7edf\u9010\u6b65\u7ea0\u6b63\u6240\u6709\u65f6\u95f4\u504f\u5dee\u3002\u5728\u67d0\u4e9b\u7279\u5b9a\u60c5\u51b5\u4e0b\uff0c\u7cfb\u7edf\u65f6\u949f\u53ef\u80fd\u4f1a\u6f02\u79fb\u8fc7\u5feb\uff0c\u5bfc\u81f4\u8be5\u8c03\u6574\u8fc7\u7a0b\u6d88\u8017\u5f88\u957f\u7684\u65f6\u95f4\u6765\u7ea0\u6b63\u7cfb\u7edf\u65f6\u949f\u3002\u8be5\u6307\u4ee4\u5f3a\u5236chronyd\u5728\u8c03\u6574\u671f\u5927\u4e8e\u67d0\u4e2a\u9600\u503c\u65f6\u6b65\u8fdb\u8c03\u6574\u7cfb\u7edf\u65f6\u949f\uff0c\u4f46\u53ea\u6709\u5728\u56e0\u4e3achronyd\u542f\u52a8\u65f6\u95f4\u8d85\u8fc7\u6307\u5b9a\u9650\u5236\uff08\u53ef\u4f7f\u7528\u8d1f\u503c\u6765\u7981\u7528\u9650\u5236\uff09<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span class=\"ez-toc-section\" id=\"35_%E6%A3%80%E6%9F%A5ntp%E6%BA%90%E6%9C%8D%E5%8A%A1%E5%99%A8%E7%8A%B6%E6%80%81\"><\/span>3.5 \u68c0\u67e5ntp\u6e90\u670d\u52a1\u5668\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell line-numbers\">~]# chronyc sourcestats\n210 Number of sources = 11\nName\/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev\n==============================================================================\nntp1.flashdance.cx          5   3    74    +47.533    761.119    +66ms  3190us\nmailgw.xanet.edu.cn         0   0     0     +0.000   2000.000     +0ns  4000ms\n202.112.7.150               0   0     0     +0.000   2000.000     +0ns  4000ms\ngus.buptnet.edu.cn          5   4    72     +7.542      7.419   -338ms    15us\ndns1.synet.edu.cn           5   3    73     -0.000      1.591    -12ns  9406ns\n202.112.26.37               0   0     0     +0.000   2000.000     +0ns  4000ms\nntp.glnet.edu.cn            5   3    72     +0.114      2.865  +9260us    16us\nns.pku.cn                   0   0     0     +0.000   2000.000     +0ns  4000ms\n203.107.6.88                5   5    73    +44.771    107.137  -5894us   640us\nntp5.flashdance.cx          0   0     0     +0.000   2000.000     +0ns  4000ms\na.chl.la                    5   3    73     +6.678   2117.361    +59ms  9357us\n<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"36_%E6%9F%A5%E7%9C%8Bntp%E8%AF%A6%E7%BB%86%E7%9A%84%E5%90%8C%E6%AD%A5%E7%8A%B6%E6%80%81\"><\/span>3.6 \u67e5\u770bntp\u8be6\u7ec6\u7684\u540c\u6b65\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/09\/wp_editor_md_cdd61992a1677bd6835e1b711218a430.jpg\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/09\/wp_editor_md_cdd61992a1677bd6835e1b711218a430.jpg\" alt=\"\" \/><\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"37_%E6%9F%A5%E7%9C%8B%E6%97%A5%E6%9C%9F%E6%97%B6%E9%97%B4%E3%80%81%E6%97%B6%E5%8C%BA%E5%8F%8ANTP%E7%8A%B6%E6%80%81\"><\/span>3.7 \u67e5\u770b\u65e5\u671f\u65f6\u95f4\u3001\u65f6\u533a\u53caNTP\u72b6\u6001<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u67e5\u770b\u65e5\u671f\u65f6\u95f4\u3001\u65f6\u533a\u53caNTP\u72b6\u6001\uff1a# timedatectl<br \/>\n\u67e5\u770b\u65f6\u533a\u5217\u8868\uff1a# timedatectl list-timezones<br \/>\n\u4fee\u6539\u65f6\u533a# timedatectl set-timezone Asia\/Shanghai<br \/>\n\u4fee\u6539\u65e5\u671f\u65f6\u95f4\uff1a# timedatectl set-time \"2015-01-21 11:50:00\"\uff08\u53ef\u4ee5\u53ea\u4fee\u6539\u5176\u4e2d\u4e00\u4e2a\uff09<br \/>\n\u5f00\u542fNTP\uff1a# timedatectl set-ntp true\/flase<\/p>\n<h4><span class=\"ez-toc-section\" id=\"38_%E8%8A%82%E7%82%B9%EF%BC%88%E5%AE%A2%E6%88%B7%E7%AB%AF%EF%BC%89%E9%85%8D%E7%BD%AE\"><\/span>3.8 \u8282\u70b9\uff08\u5ba2\u6237\u7aef\uff09\u914d\u7f6e<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5ba2\u6237\u7aef\u9700\u8981\u4fee\u6539<code>\/etc\/chrony.conf<\/code>\u6587\u4ef6\uff0c\u914d\u7f6e\u597d\u4e0a\u7ea7\u65f6\u949f\u6e90\u3002<\/p>\n<pre><code class=\"language-shell line-numbers\">~]# vim \/etc\/chrony.conf\nserver 192.168.13.47 iburst\nserver 192.168.13.88 iburst\ndriftfile \/var\/lib\/chrony\/drift\nmakestep 1.0 3\nrtcsync\nlogdir \/var\/log\/chrony\n<\/code><\/pre>\n<p>\u67e5\u770b\u914d\u7f6e\u6587\u4ef6<\/p>\n<pre><code class=\"language-shell line-numbers\">~]# cat \/etc\/chrony.conf | grep -v ^# | grep -v ^$\n# \u4ee5\u4e0b\u662fexadata\u4e2d\u7684\u914d\u7f6e\ndriftfile \/var\/lib\/chrony\/drift\nmakestep 1.0 3\nrtcsync\nhwtimestamp *\nlogdir \/var\/log\/chrony\nserver 192.168.36.168 prefer iburst minpoll 4 maxpoll 4 xleave\n<\/code><\/pre>\n<h3><span class=\"ez-toc-section\" id=\"4_chronyc%E5%91%BD%E4%BB%A4%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E\"><\/span>4. chronyc\u547d\u4ee4\u53c2\u6570\u8bf4\u660e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<table>\n<thead>\n<tr>\n<th align=\"left\">\u53c2\u6570<\/th>\n<th align=\"left\">\u53c2\u6570\u8bf4\u660e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td align=\"left\">accheck<\/td>\n<td align=\"left\">\u68c0\u67e5NTP\u8bbf\u95ee\u662f\u5426\u5bf9\u7279\u5b9a\u4e3b\u673a\u53ef\u7528<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">activity<\/td>\n<td align=\"left\">\u8be5\u547d\u4ee4\u4f1a\u663e\u793a\u6709\u591a\u5c11NTP\u6e90\u5728\u7ebf\/\u79bb\u7ebf<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">add server<\/td>\n<td align=\"left\">\u624b\u52a8\u6dfb\u52a0\u4e00\u53f0\u65b0\u7684NTP\u670d\u52a1\u5668\u3002<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">clients<\/td>\n<td align=\"left\">\u5728\u5ba2\u6237\u7aef\u62a5\u544a\u5df2\u8bbf\u95ee\u5230\u670d\u52a1\u5668<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">delete<\/td>\n<td align=\"left\">\u624b\u52a8\u79fb\u9664NTP\u670d\u52a1\u5668\u6216\u5bf9\u7b49\u670d\u52a1\u5668<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">settime<\/td>\n<td align=\"left\">\u624b\u52a8\u8bbe\u7f6e\u5b88\u62a4\u8fdb\u7a0b\u65f6\u95f4<\/td>\n<\/tr>\n<tr>\n<td align=\"left\">tracking<\/td>\n<td align=\"left\">\u663e\u793a\u7cfb\u7edf\u65f6\u95f4\u4fe1\u606f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span class=\"ez-toc-section\" id=\"41_chronyc_activity\"><\/span>4.1 chronyc activity<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell line-numbers\">~]# chronyc activity\n200 OK\n10 sources online\n0 sources offline\n1 sources doing burst (return to online)\n0 sources doing burst (return to offline)\n0 sources with unknown address\n<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"42_chronyc_tracking\"><\/span>4.2 chronyc tracking<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre><code class=\"language-shell line-numbers\">~]# chronyc tracking\nReference ID    : 78197314 (120.25.115.20)\nStratum         : 3\nRef time (UTC)  : Wed May 22 16:00:03 2019\nSystem time     : 0.000822585 seconds fast of NTP time\nLast offset     : +0.000354587 seconds\nRMS offset      : 0.000662374 seconds\nFrequency       : 5.896 ppm slow\nResidual freq   : +0.011 ppm\nSkew            : 0.153 ppm\nRoot delay      : 0.062886700 seconds\nRoot dispersion : 0.001148343 seconds\nUpdate interval : 65.3 seconds\nLeap status     : Normal\n<\/code><\/pre>\n<ul>\n<li>\u65e0\u6cd5\u540c\u6b65\u65f6\u95f4\u670d\u52a1\u5668\u65f6<br \/>\n<a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_cea2b3343e5b724c567cc261827b6596.jpg\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_cea2b3343e5b724c567cc261827b6596.jpg\" alt=\"\" \/><\/a><\/p>\n<\/li>\n<li>\n<p>\u6b63\u5e38\u540c\u6b65\u65f6\u95f4\u670d\u52a1\u5668\u65f6<br \/>\n<a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_ea3128c48a95dd5a2bbb90687d7b91f2.jpg\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_ea3128c48a95dd5a2bbb90687d7b91f2.jpg\" alt=\"\" \/><\/a><\/p>\n<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"43_chronyc_sources_-v_%E6%9F%A5%E7%9C%8B%E6%98%AF%E5%90%A6%E5%90%8C%E6%AD%A5\"><\/span>4.3. <code>chronyc sources -v<\/code> \u67e5\u770b\u662f\u5426\u540c\u6b65<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_5a6a3aee78e6bce9bb1cff047653fc37.jpg\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_5a6a3aee78e6bce9bb1cff047653fc37.jpg\" alt=\"\" \/><\/a><\/p>\n<pre><code class=\"line-numbers\">\u8bf4\u660e\uff1a\n^* #\u5df2\u540c\u6b65\n^? #\u672a\u540c\u6b65\n192.168.2.25 #\u65f6\u95f4\u670d\u52a1\u5668IP\n<\/code><\/pre>\n<ul>\n<li>\n<p>\u672a\u540c\u6b65\u65f6\u95f4\u670d\u52a1\u5668\u65f6\u95f4<br \/>\n<a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_a5f5c7778e321d874352c8effd395425.jpg\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_a5f5c7778e321d874352c8effd395425.jpg\" alt=\"\" \/><\/a><\/p>\n<\/li>\n<li>\n<p>\u5df2\u540c\u6b65\u65f6\u95f4\u670d\u52a1\u5668\u65f6\u95f4<br \/>\n<a href=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_0ff41c4777c2934285ede57ec8944ca8.jpg\" data-fancybox=\"images\" data-fancybox=\"images\"><img decoding=\"async\" src=\"http:\/\/dba.qishuo.xin\/wp-content\/uploads\/2021\/12\/wp_editor_md_0ff41c4777c2934285ede57ec8944ca8.jpg\" alt=\"\" \/><\/a><\/p>\n<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"5_chrony%E7%9A%84%E4%BC%98%E5%8A%BF\"><\/span>5. chrony\u7684\u4f18\u52bf<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>\u66f4\u5feb\u7684\u540c\u6b65\u53ea\u9700\u8981\u6570\u5206\u949f\u800c\u975e\u6570\u5c0f\u65f6\u65f6\u95f4\uff0c\u4ece\u800c\u6700\u5927\u7a0b\u5ea6\u51cf\u5c11\u4e86\u65f6\u95f4\u548c\u9891\u7387\u8bef\u5dee\uff0c\u8fd9\u5bf9\u4e8e\u5e76\u975e\u5168\u5929 24 \u5c0f\u65f6\u8fd0\u884c\u7684\u53f0\u5f0f\u8ba1\u7b97\u673a\u6216\u7cfb\u7edf\u800c\u8a00\u975e\u5e38\u6709\u7528\u3002<\/li>\n<li>\u80fd\u591f\u66f4\u597d\u5730\u54cd\u5e94\u65f6\u949f\u9891\u7387\u7684\u5feb\u901f\u53d8\u5316\uff0c\u8fd9\u5bf9\u4e8e\u5177\u5907\u4e0d\u7a33\u5b9a\u65f6\u949f\u7684\u865a\u62df\u673a\u6216\u5bfc\u81f4\u65f6\u949f\u9891\u7387\u53d1\u751f\u53d8\u5316\u7684\u8282\u80fd\u6280\u672f\u800c\u8a00\u975e\u5e38\u6709\u7528\u3002<\/li>\n<li>\u5728\u521d\u59cb\u540c\u6b65\u540e\uff0c\u5b83\u4e0d\u4f1a\u505c\u6b62\u65f6\u949f\uff0c\u4ee5\u9632\u5bf9\u9700\u8981\u7cfb\u7edf\u65f6\u95f4\u4fdd\u6301\u5355\u8c03\u7684\u5e94\u7528\u7a0b\u5e8f\u9020\u6210\u5f71\u54cd\u3002<\/li>\n<li>\u5728\u5e94\u5bf9\u4e34\u65f6\u975e\u5bf9\u79f0\u5ef6\u8fdf\u65f6\uff08\u4f8b\u5982\uff0c\u5728\u5927\u89c4\u6a21\u4e0b\u8f7d\u9020\u6210\u94fe\u63a5\u9971\u548c\u65f6\uff09\u63d0\u4f9b\u4e86\u66f4\u597d\u7684\u7a33\u5b9a\u6027\u3002<\/li>\n<li>\u65e0\u9700\u5bf9\u670d\u52a1\u5668\u8fdb\u884c\u5b9a\u671f\u8f6e\u8be2\uff0c\u56e0\u6b64\u5177\u5907\u95f4\u6b47\u6027\u7f51\u7edc\u8fde\u63a5\u7684\u7cfb\u7edf\u4ecd\u7136\u53ef\u4ee5\u5feb\u901f\u540c\u6b65\u65f6\u949f\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1. \u7cfb\u7edf\u73af\u5883 1.1 \u53c2\u8003\u8d44\u6599 https:\/\/&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[76,48],"class_list":["post-556","post","type-post","status-publish","format-standard","hentry","category-linux","tag-chrony","tag-linux"],"_links":{"self":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=556"}],"version-history":[{"count":7,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/556\/revisions"}],"predecessor-version":[{"id":558,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=\/wp\/v2\/posts\/556\/revisions\/558"}],"wp:attachment":[{"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dba.qishuo.xin\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}