﻿{"id":1625,"date":"2019-07-05T11:09:07","date_gmt":"2019-07-05T03:09:07","guid":{"rendered":"http:\/\/www.llku.com\/?p=1625"},"modified":"2019-07-05T11:11:42","modified_gmt":"2019-07-05T03:11:42","slug":"ntp%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%90%8c%e6%ad%a5%e6%97%b6%e9%97%b4%e8%af%a6%e7%bb%86%e9%85%8d%e7%bd%ae%ef%bc%88%e8%bd%ac%e8%bd%bd%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.llku.com\/?p=1625","title":{"rendered":"ntp\u670d\u52a1\u5668\u540c\u6b65\u65f6\u95f4\u8be6\u7ec6\u914d\u7f6e\uff08\u8f6c\u8f7d\uff09"},"content":{"rendered":"<div>NTP\u670d\u52a1\u7aef\uff1alinl_S \u00a0 \u00a0IP\uff1a10.0.0.15<\/div>\n<div>NTP\u5ba2\u6237\u7aef\uff1alin_C \u00a0 \u00a0IP\uff1a10.0.0.16<\/div>\n<h1>NTP\u670d\u52a1\u6982\u8ff0<\/h1>\n<h3>1\u3001\u539f\u7406<\/h3>\n<div>NTP\uff08Network TimeProtocol\uff0c\u7f51\u7edc\u65f6\u95f4\u534f\u8bae\uff09\u662f\u7528\u6765\u4f7f\u8ba1\u7b97\u673a\u65f6\u95f4\u540c\u6b65\u7684\u4e00\u79cd\u534f\u8bae\u3002\u5b83\u53ef\u4ee5\u4f7f\u8ba1\u7b97\u673a\u5bf9\u5176\u670d\u52a1\u5668\u6216\u65f6\u949f\u6e90\u505a\u540c\u6b65\u5316\uff0c\u5b83\u53ef\u4ee5\u63d0\u4f9b\u9ad8\u7cbe\u51c6\u5ea6\u7684\u65f6\u95f4\u6821\u6b63\uff08LAN\u4e0a\u4e0e\u6807\u51c6\u95f4\u5dee\u5c0f\u4e8e1\u6beb\u79d2\uff0cWAN\u4e0a\u51e0\u5341\u6beb\u79d2\uff09\uff0c\u5207\u53ef\u4ecb\u7531\u52a0\u5bc6\u786e\u8ba4\u7684\u65b9\u5f0f\u6765\u9632\u6b62\u6076\u610f\u7684\u534f\u8bae\u653b\u51fb\u3002<\/div>\n<div><\/div>\n<div>\u6a21\u5f0f\uff1aC\/S\u6a21\u5f0f<\/div>\n<div>\u8fd0\u884c\u6a21\u5f0f\uff1a<\/div>\n<div><span lang=\"EN-US\"><img loading=\"lazy\" src=\"https:\/\/images2015.cnblogs.com\/blog\/941838\/201605\/941838-20160526200453569-1219376121.jpg\" alt=\"\" width=\"393\" height=\"266\" \/><br \/>\n<\/span><\/div>\n<div><\/div>\n<h3>2\u3001\u7aef\u53e3(123)<\/h3>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# vim \/etc\/services \r\n2 nntp            119\/tcp         readnews untp   # USENET News Transfer Protocol\r\n3 nntp            119\/udp         readnews untp   # USENET News Transfer Protocol\r\n4 ntp             123\/tcp\r\n5 ntp             123\/udp                         # Network Time Protocol<\/pre>\n<\/div>\n<div>\n<div>\u62d3\u5c55\uff1a<\/div>\n<\/div>\n<div>NNTP\uff08Network News Transport Protocol\uff09\uff0c\u4e2d\u6587\u91ca\u4e49\uff1a\uff08RFC-977\uff09\u7f51\u7edc\u65b0\u95fb\u4f20\u8f93\u534f\u8bae\u3002\u8fd9\u662f\u4e00\u4e2a\u4e3b\u8981\u7528\u4e8e\u9605\u8bfb\u548c\u53d1\u5e03\u65b0\u95fb\u6587\u7ae0\uff08\u4fd7\u79f0\u4e3a\u201c\u5e16\u5b50\u201d\uff0c\u6bd4\u8f83\u6b63\u5f0f\u7684\u540d\u5b57\u662f\u201c\u65b0\u95fb\u7ec4\u90ae\u4ef6\u201d\uff09\u5230Usenet \u4e0a\u7684Internet\u5e94\u7528\u534f\u8bae\uff0c\u4e5f\u8d1f\u8d23\u65b0\u95fb\u5728\u670d\u52a1\u5668\u95f4\u7684\u4f20\u9001\u3002<\/div>\n<div><\/div>\n<div>\u5b89\u88c5NTP<\/div>\n<div><span data-wiz-span=\"data-wiz-span\">\u9ed8\u8ba4\u662f\u5df2\u5b89\u88c5\uff0c\u5982\u679c\u662f\u6700\u5c0f\u5316\u5b89\u88c5\u7cfb\u7edf\uff0c\u5219\u9700\u8981\u624b\u52a8\u5b89\u88c5\u3002<\/span><\/div>\n<div>1\uff09NTP\u76f8\u5173\u8f6f\u4ef6\u5305<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# ls \/mnt\/Packages\/ntp*\r\n2 \/mnt\/Packages\/ntp-4.2.6p5-1.el6.x86_64.rpm         #NTP\u670d\u52a1\u7aef\u8f6f\u4ef6\u5305\r\n3 \/mnt\/Packages\/ntpdate-4.2.6p5-1.el6.x86_64.rpm     #NTP\u5ba2\u6237\u7aef\u8f6f\u4ef6\u5305<\/pre>\n<\/div>\n<\/div>\n<div>\n<div>2\uff09\u5b89\u88c5NTP\u670d\u52a1\u7aef\u8f6f\u4ef6\u5305\uff1a<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# yum -y install ntp         #NTP\u4e24\u4e2a\u8f6f\u4ef6\u5305\u90fd\u4f1a\u5b89\u88c5\u4e0a\r\n2 ...\r\n3 Installed:\r\n4   ntp.x86_64 0:4.2.6p5-1.el6                                      \r\n5 Dependency Installed:\r\n6   ntpdate.x86_64 0:4.2.6p5-1.el6                                  \r\n7 Complete!<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div>\u00a0 \u00a0 \u5b89\u88c5\u5ba2\u6237\u7aef\uff1a<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_C ~]# rpm -ivh \/mnt\/Packages\/ntpdate-4.2.6p5-1.el6.x86_64.rpm     #\u53ea\u5b89\u88c5ntpdate\u5b89\u88c5\u5305\r\n2 warning: \/mnt\/Packages\/ntpdate-4.2.6p5-1.el6.x86_64.rpm: Header V3 RSA\/SHA256 Signature, key ID fd431d51: NOKEY\r\n3 Preparing...                ########################################### [100%]\r\n4     package ntpdate-4.2.6p5-1.el6.x86_64 is already installed<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div>\u00a0 \u00a0 NTP\u914d\u7f6e\u6587\u4ef6\u6240\u5728\u4f4d\u7f6e<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# ls \/etc\/ntp.conf \r\n2 \/etc\/ntp.conf<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div>3\uff09\u542f\u52a8NTP\u670d\u52a1<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre> 1 [root@linl_S ~]# service ntpd start          #\u542f\u52a8ntp\u670d\u52a1\r\n 2 Starting ntpd:                                             [  OK  ]\r\n 3 [root@linl_S ~]# netstat -anptu |grep 123    #\u67e5\u770b\u7aef\u53e3123\u662f\u5426\u5f00\u653e\r\n 4 udp        0      0 10.0.0.15:123               0.0.0.0:*                               5846\/ntpd           \r\n 5 udp        0      0 127.0.0.1:123               0.0.0.0:*                               5846\/ntpd           \r\n 6 udp        0      0 0.0.0.0:123                 0.0.0.0:*                               5846\/ntpd           \r\n 7 udp        0      0 fe80::20c:29ff:fea9:c1ae:123 :::*                                    5846\/ntpd           \r\n 8 udp        0      0 ::1:123                     :::*                                    5846\/ntpd           \r\n 9 udp        0      0 :::123                      :::*                                    5846\/ntpd           \r\n10 [root@linl_S ~]# chkconfig ntpd on           #\u5f00\u673a\u81ea\u542f\u52a8<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div><span style=\"font-size: 22px; font-weight: bold;\">\u5b9e\u62181\uff1a\u624b\u52a8\u540c\u6b65NTP\u65f6\u95f4\u670d\u52a1\u5668<\/span><\/div>\n<\/div>\n<div>\n<p>1\uff09\u5728lin_S\u670d\u52a1\u5668\u4e0a\u67e5\u770b\u53ef\u7528\u7684NTP\u65f6\u95f4\u670d\u52a1\u5668<\/p>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# vi \/etc\/ntp.conf \r\n2 # Use public servers from the pool.ntp.org project.\r\n3 # Please consider joining the pool (http:\/\/www.pool.ntp.org\/join.html).\r\n4 server 0.rhel.pool.ntp.org iburst       #\u627e\u4e00\u4e2a\u53ef\u4ee5\u4f7f\u7528\u7684NTP\u65f6\u95f4\u670d\u52a1\u5668\r\n5 server 1.rhel.pool.ntp.org iburst\r\n6 server 2.rhel.pool.ntp.org iburst\r\n7 server 3.rhel.pool.ntp.org iburst<\/pre>\n<\/div>\n<\/div>\n<div>\n<p>2\uff09\u5728lin_C\u5ba2\u6237\u7aef\u4e0a\u4e0eNTP\u65f6\u95f4\u670d\u52a1\u5668\u8fdb\u884c\u540c\u6b65<\/p>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_C ~]# ntpdate 0.rhel.pool.ntp.org\r\n2 22 May 22:04:41 ntpdate[5733]: adjust time server 202.118.1.130 offset 0.027428 sec<\/pre>\n<\/div>\n<\/div>\n<div>\n<div><em>\u62d3\u5c55\uff1a<\/em><\/div>\n<\/div>\n<div><em>\u5728lin_S\u670d\u52a1\u7aef\uff08\u5df2\u542f\u52a8NTP\u670d\u52a1\uff09\u4e0eNTP\u65f6\u95f4\u670d\u52a1\u5668\u8fdb\u884c\u540c\u6b65\u4f1a\u62a5\u9519\u3002<\/em><\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# ntpdate 0.rhel.pool.ntp.org\r\n2 22 May 22:06:17 ntpdate[2464]: the NTP socket is in use, exiting<\/pre>\n<\/div>\n<\/div>\n<div>\n<div>\u95ee\u9898\u5206\u6790\uff1a<\/div>\n<\/div>\n<div>\u51fa\u73b0\u8be5\u9519\u8bef\u7684\u539f\u56e0\u662flin_S\u670d\u52a1\u5668\u6b63\u5728\u8fd0\u884cntpd\u670d\u52a1\uff0c\u5c31\u4e0d\u80fd\u7528ntpdate\u6765\u624b\u52a8\u66f4\u65b0\u65f6\u95f4\u4e86\u3002<\/div>\n<div>\u89e3\u51b3\u65b9\u6cd5\uff1a<\/div>\n<div>\u5173\u95edntpd\u670d\u52a1<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# service ntpd stop\r\n2 Shutting down ntpd:                                        [  OK  ]\r\n3 [root@linl_S ~]# ntpdate 0.rhel.pool.ntp.org\r\n4 22 May 22:13:27 ntpdate[2495]: adjust time server 202.118.1.130 offset -0.068183 sec<\/pre>\n<\/div>\n<\/div>\n<div>\n<div><\/div>\n<\/div>\n<div>\n<h3>\u5b9e\u62182\uff1a\u642d\u5efa\u5185\u7f51NTP\u670d\u52a1\u5668\uff0c\u5185\u7f51\u670d\u52a1\u5668\u901a\u8fc7\u6b64NTP\u670d\u52a1\u5668\u8fdb\u884c\u65f6\u95f4\u540c\u6b65<\/h3>\n<\/div>\n<div>1\uff09\u4fee\u6539NTP\u914d\u7f6e\u6587\u4ef6<\/div>\n<div>\n<p>\u00a0 \u00a0 \u00a0\u00a0\u84dd\u8272\u5e95\u7eb9\u90e8\u5206\u4e3a\u589e\u52a0\u9879<\/p>\n<div class=\"cnblogs_code\">\n<pre> 1 [root@linl_S ~]# vi \/etc\/ntp.conf \r\n 2 # Permit all access over the loopback interface.  This could\r\n 3 # be tightened as well, but to do so would effect some of\r\n 4 # the administrative functions.\r\n 5 restrict 127.0.0.1\r\n 6 restrict -6 ::1\r\n 7 restrict 10.0.0.0 mask 255.255.255.0       #\u5141\u8bb810.0.0.0 \u7f51\u6bb5\u4e2d\u7684\u670d\u52a1\u5668\u8bbf\u95ee\u672cntp\u670d\u52a1\u5668\u8fdb\u884c\u65f6\u95f4\u540c\u6b65\r\n 8 restrict 10.0.0.16                         #\u5141\u8bb8\u5355\u4e2aIP\u5730\u5740\u8bbf\u95ee\u672cntp\u670d\u52a1\u5668\r\n 9 # Use public servers from the pool.ntp.org project.\r\n10 # Please consider joining the pool (http:\/\/www.pool.ntp.org\/join.html).\r\n11 server 210.72.145.44    #\u6307\u5b9a\u672cntp\u670d\u52a1\u5668\u7684\u4e0a\u6e38ntp\u670d\u52a1\u5668\u4e3a210.72.145.44\uff0c\u5e76\u4e14\u8bbe\u7f6e\u4e3a\u9996\u5148\u670d\u52a1\u5668\u3002\u540c\u6b65\u65f6\u95f4\u4e3a\uff1a\u4ece\u4e0a\u5230\u4e0b\uff0c\u5199\u7684\u8d8a\u9760\u4e0a\uff0c\u4f18\u5148\u7ea7\u8d8a\u9ad8\u3002\uff08\u6b64\u670d\u52a1\u5668\u540c\u6b65\u4e0d\u4e86\u65f6\u95f4\uff0c\u5bfb\u627e\u4e0b\u4e00\u4e2antp\u670d\u52a1\u5668\uff09\u3002\u6b64IP\u5730\u5740\u662f\u4e2d\u56fd\u56fd\u5bb6\u6388\u65f6\u4e2d\u5fc3ntp\u670d\u52a1\u5668\u3002                    \r\n12 server 133.100.11.8     #\u5f53\u4e0a\u9762\u670d\u52a1\u5668\u540c\u6b65\u4e0d\u4e86\uff0c\u5219\u5bfb\u627e\u7b2c\u4e8c\u4e2a\u3002\u6b64IP\u5730\u5740\u662f\u65e5\u672c\u798f\u5188\u5927\u5b66ntp\u670d\u52a1\u5668\u3002\r\n13 server 0.rhel.pool.ntp.org iburst\r\n14 server 1.rhel.pool.ntp.org iburst\r\n15 server 2.rhel.pool.ntp.org iburst\r\n16 server 3.rhel.pool.ntp.org iburst\r\n17 server 127.127.1.0      \u3000\u3000\u3000\u3000 #local clock \u5982\u679c\u4e0a\u9762\u7684\u670d\u52a1\u5668\u90fd\u65e0\u6cd5\u540c\u6b65\u65f6\u95f4\uff0c\u5c31\u548c\u672c\u5730\u7cfb\u7edf\u65f6\u95f4\u540c\u6b65\u3002127.127.1.0\u5728\u8fd9\u91cc\u662f\u4e00\u4e2aIP\u5730\u5740\uff0c\u4e0d\u662f\u7f51\u6bb5\u3002\r\n18 fudge 127.127.1.0 stratum 10    #127.127.1.0 \u4e3a\u7b2c10\u5c42\u3002ntp \u548c127.127.1.0\u540c\u6b65\u5b8c\u540e\uff0c\u5c31\u53d8\u6210\u4e8611\u5c42\u3002  ntp\u662f\u5c42\u6b21\u9636\u7ea7\u7684\u3002\u540c\u6b65\u4e0a\u5c42\u670d\u52a1\u5668\u7684stratum \u5927\u5c0f\u4e0d\u80fd\u8d85\u8fc7\u6216\u7b49\u4e8e16\u3002<\/pre>\n<\/div>\n<\/div>\n<div>\n<p>2\uff09\u542f\u52a8ntpd\u670d\u52a1<\/p>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# \/etc\/init.d\/ntpd start\r\n2 Starting ntpd:                                             [  OK  ]\r\n3 [root@linl_S ~]# netstat -ln |grep 123\r\n4 udp        0      0 10.0.0.15:123               0.0.0.0:*                               \r\n5 udp        0      0 127.0.0.1:123               0.0.0.0:*                               \r\n6 udp        0      0 0.0.0.0:123                 0.0.0.0:*                               \r\n7 udp        0      0 fe80::20c:29ff:fea9:c1ae:123 :::*                                    \r\n8 udp        0      0 ::1:123                     :::*                                    \r\n9 udp        0      0 :::123                      :::*<\/pre>\n<div class=\"cnblogs_code_toolbar\">3\uff09\u67e5\u770bntpd\u670d\u52a1\u72b6\u6001<\/div>\n<\/div>\n<\/div>\n<div>\n<div>\n<div><span data-wiz-span=\"data-wiz-span\">\u6307\u4ee4\u201cntpq -p\u201d\u53ef\u4ee5\u5217\u51fa\u76ee\u524d\u6211\u4eec\u7684NTP\u4e0e\u76f8\u5173\u7684\u4e0a\u5c42NTP\u7684\u72b6\u6001\uff0c\u4ee5\u4e0a\u7684\u51e0\u4e2a\u5b57\u6bb5\u7684\u610f\u4e49\u5982\u4e0b\uff1a<\/span><\/div>\n<div><span data-wiz-span=\"data-wiz-span\">remote\uff1a\u5373remote &#8211; \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\u3002<\/span><\/div>\n<div><span data-wiz-span=\"data-wiz-span\">refid\uff1a\u53c2\u8003\u7684\u4e0a\u4e00\u5c42NTP\u4e3b\u673a\u7684\u5730\u5740<\/span><\/div>\n<div><span data-wiz-span=\"data-wiz-span\">st\uff1a\u5373stratum\u9636\u5c42<\/span><\/div>\n<div><span data-wiz-span=\"data-wiz-span\">poll\uff1a\u4e0b\u6b21\u66f4\u65b0\u5728\u51e0\u79d2\u4e4b\u540e<\/span><\/div>\n<div>\n<p><span data-wiz-span=\"data-wiz-span\">offset\uff1a\u65f6\u95f4\u8865\u507f\u7684\u7ed3\u679c<\/span><\/p>\n<div class=\"cnblogs_code\">\n<pre> 1 [root@linl_S ~]# ntpq -p         #\u5217\u51fa\u672cNTP\u670d\u52a1\u5668\u4e0e\u4e0a\u6e38\u670d\u52a1\u5668\u7684\u8fde\u63a5\u72b6\u6001\r\n 2      remote           refid      st t when poll reach   delay   offset  jitter\r\n 3 ==============================================================================\r\n 4  210.72.145.44   .INIT.          16 u    -   64    0    0.000    0.000   0.000\r\n 5  133.100.11.8    .INIT.          16 u    -   64    0    0.000    0.000   0.000\r\n 6 *dns1.synet.edu. 202.118.1.47     2 u   32   64    3   60.058    7.261   6.860\r\n 7  news.neu.edu.cn .INIT.          16 u    -   64    0    0.000    0.000   0.000\r\n 8  202.118.1.130   .INIT.          16 u    -   64    0    0.000    0.000   0.000\r\n 9  42.96.167.209   .INIT.          16 u    -   64    0    0.000    0.000   0.000\r\n10  LOCAL(0)        .LOCL.          10 l   96   64    2    0.000    0.000   0.000\r\n11 [root@linl_S ~]# ntpstat         #\u5217\u51fa\u662f\u5426\u4e0e\u4e0a\u6e38\u670d\u52a1\u5668\u8fde\u63a5\u3002\u9700\u8981\u8fc75\u5206\u949f\r\n12 synchronised to NTP server (202.112.29.82) at stratum 3     #\u53ef\u4ee5\u770b\u5230\u6211\u4eec\u5f53\u524d\u57283\u5c42\r\n13    time correct to within 257 ms    #ms \u6beb\u79d2\u662f\u4e00\u79cd\u8f83\u4e3a\u5fae\u5c0f\u7684\u65f6\u95f4\u5355\u4f4d\uff0c\u662f\u4e00\u79d2\u7684\u5343\u5206\u4e4b\u4e00\u3002\r\n14    polling server every 64 s<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<p>4\uff09\u5ba2\u6237\u7aef\u540c\u6b65\u65f6\u95f4<\/p>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_C ~]# date -s \"2015-5-23 11:30\"    #\u5148\u8bbe\u7f6e\u4e00\u4e2a\u9519\u8bef\u7684\u65f6\u95f4\u70b9\r\n2 Sat May 23 11:30:00 CST 2015\r\n3 [root@linl_C ~]# ntpdate lin_S    #\u8fdb\u884cntp\u65f6\u95f4\u540c\u6b65\r\n4 23 May 11:34:10 ntpdate[6686]: step time server 10.0.0.15 offset 31622622.275270 sec\r\n5 [root@linl_C ~]# date             \r\n6 Mon May 23 11:34:16 CST 2016      #\u65f6\u95f4\u540c\u6b65\u6210\u529f<\/pre>\n<\/div>\n<\/div>\n<div>\n<div>\u5e38\u89c1\u9519\u8bef\uff1a\u5982\u4e0b\u6240\u793a\u3002<\/div>\n<div><span data-wiz-span=\"data-wiz-span\">\u5176\u5b9e\uff0c\u8fd9\u4e0d\u662f\u4e00\u4e2a\u9519\u8bef\u3002\u800c\u662f\u7531\u4e8e\u6bcf\u6b21\u91cd\u542fNTP\u670d\u52a1\u5668\u4e4b\u540e\u5927\u7ea6\u89813-5\u5206\u949f\u5ba2\u6237\u7aef\u624d\u80fd\u4e0eserver\u5efa\u7acb\u6b63\u5e38\u7684\u901a\u8baf\u8fde\u63a5\u3002\u5f53\u6b64\u65f6\u7528\u5ba2\u6237\u7aef\u8fde\u63a5\u670d\u52a1\u7aef\u5c31\u4f1a\u62a5\u8fd9\u6837\u7684\u4fe1\u606f\u3002\u4e00\u822c\u7b49\u5f85\u51e0\u5206\u949f\u5c31\u53ef\u4ee5\u4e86\u3002<\/span><\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_C ~]# ntpdate lin_S\r\n2 23 May 11:38:02 ntpdate[6694]: no server suitable for synchronization found<\/pre>\n<\/div>\n<\/div>\n<div>\n<div>5\uff09\u548cNTP\u76f8\u5173\u7684\u914d\u7f6e\u6587\u4ef6<\/div>\n<\/div>\n<div>\/etc\/sysconfig\/clock\u00a0 \u00a0\u00a0\u00a0 \u00a0 #\u8fd9\u4e2a\u662flinux \u7684\u4e3b\u8981\u65f6\u533a\u8bbe\u5b9a\u6587\u4ef6\u3002\u6bcf\u6b21\u5f00\u673a\u540e\uff0cLinux\u4f1a\u81ea\u52a8\u7684\u8bfb\u53d6\u8fd9\u4e2a\u6587\u4ef6\u6765\u8bbe\u5b9a\u81ea\u5df1\u7cfb\u7edf\u6240\u9ed8\u8ba4\u8981\u663e\u793a\u7684\u65f6\u95f4\u3002<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_S ~]# cat \/etc\/sysconfig\/clock\r\n2 # The time zone of the system is defined by the contents of \/etc\/localtime.\r\n3 # This file is only for evaluation by system-config-date, do not rely on its\r\n4 # contents elsewhere.\r\n5 ZONE=\"Asia\/Shanghai\"<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div><\/div>\n<div><em>\u62d3\u5c551\uff1a<\/em><em>linux\u7cfb\u7edf\u65f6\u95f4\u548cBIOS\u65f6\u95f4\u662f\u4e0d\u662f\u4e00\u5b9a\u4e00\u6837\uff1f<\/em><\/div>\n<div>\u67e5\u770b\u786c\u4ef6BIOS\u65f6\u95f4\uff1a<\/div>\n<div><span data-wiz-span=\"data-wiz-span\">hwclock -r \u00a0 \u00a0\u8bfb\u51faBIOS\u7684\u65f6\u95f4\u53c2\u6570<\/span><\/div>\n<div><span data-wiz-span=\"data-wiz-span\">hwclock -w \u00a0 \u00a0\u5c06\u5f53\u524d\u7cfb\u7edf\u65f6\u95f4\u5199\u5165BIOS\u4e2d<\/span><\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_C ~]# date -s \"2016-5-22 13:50\"\r\n2 Sun May 22 13:50:00 CST 2016\r\n3 [root@linl_C ~]# hwclock -r\r\n4 Mon 23 May 2016 01:53:50 PM CST  -0.110948 seconds\r\n5 [root@linl_C ~]# hwclock -w\r\n6 [root@linl_C ~]# hwclock -r\r\n7 Sun 22 May 2016 01:50:48 PM CST  -0.783098 seconds     #\u5df2\u5c06\u7cfb\u7edfdate\u65f6\u95f4\u5199\u5165\u5230BIOS\u65f6\u95f4<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div><em>\u62d3\u5c552\uff1a<\/em><em>\u4e0d\u540c\u673a\u5668\u4e4b\u95f4\u7684\u65f6\u95f4\u540c\u6b65<\/em><\/div>\n<\/div>\n<div>\u4e3a\u4e86\u907f\u514d\u4e3b\u673a\u65f6\u95f4\u56e0\u4e3a\u957f\u671f\u8fd0\u4f5c\u4e0b\u6240\u5bfc\u81f4\u7684\u65f6\u95f4\u504f\u5dee\uff0c\u8fdb\u884c\u65f6\u95f4\u540c\u6b65(synchronize)\u7684\u5de5\u4f5c\u662f\u975e\u5e38\u5fc5\u8981\u7684\u3002<\/div>\n<div>\u540c\u6b65\u65f6\u95f4\uff0c\u53ef\u4ee5\u4f7f\u7528ntpdate\u547d\u4ee4\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528ntp\u670d\u52a1\u3002<\/div>\n<div>\u65b9\u6cd5\u4e00\uff1a\u4f7f\u7528ntpdate \u6bd4\u8f83\u7b80\u5355\u3002\u683c\u5f0f\u5982\u4e0b\uff1a<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_C ~]# ntpdate lin_S\r\n2 23 May 19:50:44 ntpdate[7507]: step time server 10.0.0.15 offset 1.239826 sec<\/pre>\n<\/div>\n<\/div>\n<div>\n<div>\u4f46\u8fd9\u6837\u7684\u540c\u6b65\uff0c\u53ea\u662f\u5f3a\u5236\u6027\u7684\u5c06\u7cfb\u7edf\u65f6\u95f4\u8bbe\u7f6e\u4e3antp \u670d\u52a1\u5668\u65f6\u95f4\u3002\u53ea\u662f\u6cbb\u6807\u4e0d\u6cbb\u672c\u3002\u6240\u4ee5\uff0c\u4e00\u822c\u914d\u5408cron\u547d\u4ee4\uff0c\u6765\u8fdb\u884c\u5b9a\u671f\u540c\u6b65\u8bbe\u7f6e\u3002\u6bd4\u5982\uff0c\u5728crontab \u4e2d\u6dfb\u52a0\uff1a<\/div>\n<div>\n<div class=\"cnblogs_code\">\n<pre>1 [root@linl_C ~]# crontab -e\r\n2 0 12 * * * \/usr\/sbin\/ntpdate lin_S<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div>\n<div>\u65b9\u6cd5\u4e8c\uff1a\u4f7f\u7528ntpd \u670d\u52a1\u8fdb\u884c\u540c\u6b65\u3002<\/div>\n<\/div>\n<div>\u8981\u6ce8\u610f\u7684\u662f\uff0cntpd \u6709\u4e00\u4e2a\u81ea\u6211\u4fdd\u62a4\u8bbe\u7f6e\uff1a\u5982\u679c\u672c\u673a\u4e0e\u4e0a\u6e90\u65f6\u95f4\u76f8\u5dee\u592a\u5927\uff0cntpd \u4e0d\u8fd0\u884c\u3002\u6240\u4ee5\u65b0\u8bbe\u7f6e\u7684\u65f6\u95f4\u670d\u52a1\u5668\u4e00\u5b9a\u8981\u5148ntpdate \u4ece\u4e0a\u6e90\u53d6\u5f97\u65f6\u95f4\u521d\u503c\u3002\u7136\u540e\u542f\u52a8ntpd \u670d\u52a1\u3002<\/div>\n<div><\/div>\n<div>\u8f6c\u8f7d\u81ea\uff1ahttps:\/\/www.cnblogs.com\/shanhua-fu\/p\/9281040.html<\/div>\n","protected":false},"excerpt":{"rendered":"<p>NTP\u670d\u52a1\u7aef\uff1alinl_S \u00a0 \u00a0IP\uff1a10.0.0.15 NTP\u5ba2\u6237\u7aef\uff1alin_C \u00a0 \u00a0IP\uff1a10.0.0 &hellip; <a href=\"https:\/\/www.llku.com\/?p=1625\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">ntp\u670d\u52a1\u5668\u540c\u6b65\u65f6\u95f4\u8be6\u7ec6\u914d\u7f6e\uff08\u8f6c\u8f7d\uff09<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[68],"tags":[252],"_links":{"self":[{"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/posts\/1625"}],"collection":[{"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.llku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1625"}],"version-history":[{"count":3,"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/posts\/1625\/revisions"}],"predecessor-version":[{"id":1628,"href":"https:\/\/www.llku.com\/index.php?rest_route=\/wp\/v2\/posts\/1625\/revisions\/1628"}],"wp:attachment":[{"href":"https:\/\/www.llku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.llku.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.llku.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}