{"id":1556,"date":"2019-04-23T13:31:55","date_gmt":"2019-04-23T05:31:55","guid":{"rendered":"http:\/\/170.106.148.50\/?p=1556"},"modified":"2019-04-24T16:03:41","modified_gmt":"2019-04-24T08:03:41","slug":"centos-%e9%85%8d%e7%bd%ae-ntp-%e6%9c%8d%e5%8a%a1","status":"publish","type":"post","link":"https:\/\/www.195440.com\/1556","title":{"rendered":"centos \u914d\u7f6e NTP \u670d\u52a1"},"content":{"rendered":"

\u7b80\u4ecb<\/h4>\n

NTP\u662f\u7f51\u7edc\u65f6\u95f4\u540c\u6b65\u534f\u8bae\uff0c\u5c31\u662f\u7528\u6765\u540c\u6b65\u7f51\u7edc\u4e2d\u5404\u4e2a\u8ba1\u7b97\u673a\u7684\u65f6\u95f4\u7684\u534f\u8bae\u3002<\/p>\n

 <\/p>\n

NTP\u670d\u52a1\u7aef\u914d\u7f6e<\/h4>\n

1. \u68c0\u67e5\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u00a0ntp<\/span>\u00a0\u82e5\u672a\u5b89\u88c5\u4f7f\u7528yum\u8fdb\u884c\u5b89\u88c5<\/p>\n

\u67e5\u770b\u662f\u5426\u5b89\u88c5<\/p>\n

rpm -q ntp\u00a0<\/span><\/p>\n

\"\"<\/p>\n

yum\u5b89\u88c5\u547d\u4ee4<\/p>\n

yum \u2013y install ntp<\/span><\/p>\n

1.1 \u542f\u52a8\u670d\u52a1( \u5982\u51fa\u73b0\u5f02\u5e38, \u8bf7\u5148\u505c\u6b62\u670d\u52a1 )<\/p>\n

service ntpd start<\/span><\/p>\n

1.2 \u5f00\u653e\u7aef\u53e3 123<\/p>\n

\/sbin\/iptables -I INPUT -p tcp –dport 123 -j ACCEPT<\/span><\/p>\n

2. \u540c\u6b65\u65f6\u95f4<\/p>\n

ntpdate ntp.api.bz<\/span><\/p>\n

\"\"<\/p>\n

\u8fd4\u56de\u4e0e\u670d\u52a1\u5668\u76f8\u5dee\u65f6\u95f4, \u5373\u540c\u6b65\u6210\u529f\u3002<\/p>\n

3. \u540c\u6b65\u786c\u4ef6\u65f6\u95f4<\/p>\n

hwclock -w<\/span><\/p>\n

\u6267\u884c\u540e\u53ef\u6267\u884c<\/p>\n

date<\/span><\/p>\n

hwclock<\/span><\/p>\n

\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u7ed3\u679c<\/p>\n

\u6267\u884c\u4e0a\u8ff0\u547d\u4ee4\uff0c\u663e\u793a\u7684\u65f6\u95f4\u5e94\u4e00\u81f4\u3002<\/p>\n

4. \u5b9a\u65f6\u6267\u884c\u65f6\u95f4\u540c\u6b65\u4efb\u52a1\uff0c\u4f7f\u7528 crontab -e<\/span> \u6dfb\u52a0\u5b9a\u65f6\u4efb\u52a1<\/p>\n

\u6bcf12\u5c0f\u65f6\u540c\u6b65\u4e00\u6b21\u65f6\u95f4<\/p>\n

0 *\/12 * * * ntpdate ntp.api.bz;hwclock -w<\/span><\/p>\n

\"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

\u7b80\u4ecb NTP\u662f\u7f51\u7edc\u65f6\u95f4\u540c\u6b65\u534f\u8bae\uff0c\u5c31\u662f\u7528\u6765\u540c\u6b65\u7f51\u7edc\u4e2d\u5404\u4e2a\u8ba1\u7b97\u673a\u7684\u65f6\u95f4\u7684\u534f\u8bae\u3002   NTP\u670d\u52a1\u7aef\u914d\u7f6e 1. \u68c0\u67e5\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u00a0ntp\u00a0\u82e5\u672a\u5b89\u88c5\u4f7f\u7528yum\u8fdb\u884c\u5b89\u88c5 \u67e5\u770b\u662f\u5426\u5b89\u88c5 rpm -q ntp\u00a0 yum\u5b89\u88c5\u547d\u4ee4 yum \u2013y install ntp 1.1 \u542f\u52a8\u670d\u52a1( \u5982\u51fa\u73b0\u5f02\u5e38, \u8bf7\u5148\u505c\u6b62\u670d\u52a1 ) service ntpd start 1.2 \u5f00\u653e\u7aef\u53e3 123 \/sbin\/iptables -I INPUT -p tcp –dport 123 -j ACCEPT 2. \u540c\u6b65\u65f6\u95f4 ntpdate ntp.api.bz \u8fd4\u56de\u4e0e\u670d\u52a1\u5668\u76f8\u5dee\u65f6\u95f4, \u5373\u540c\u6b65\u6210\u529f\u3002 3. \u540c\u6b65\u786c\u4ef6\u65f6 …<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/posts\/1556"}],"collection":[{"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/comments?post=1556"}],"version-history":[{"count":8,"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/posts\/1556\/revisions"}],"predecessor-version":[{"id":1567,"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/posts\/1556\/revisions\/1567"}],"wp:attachment":[{"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/media?parent=1556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/categories?post=1556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.195440.com\/wp-json\/wp\/v2\/tags?post=1556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}