{"id":321,"date":"2014-12-21T07:49:29","date_gmt":"2014-12-20T22:49:29","guid":{"rendered":"http:\/\/yokensaka.com\/centos\/?p=321"},"modified":"2015-01-04T20:44:11","modified_gmt":"2015-01-04T11:44:11","slug":"centos7-ntp%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bcchrony%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab","status":"publish","type":"post","link":"http:\/\/yokensaka.com\/centos\/?p=321","title":{"rendered":"CentOS 7 chrony\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb"},"content":{"rendered":"<p>NTP\u30b5\u30fc\u30d0\u30fc(chrony)<\/p>\n<p>CentOS7 \u306e\u6642\u523b\u540c\u671f\u306b\u95a2\u3057\u3066\u306f\u3001\u4eca\u307e\u3067\u4f7f\u308f\u308c\u3066\u304d\u305f\uff62ntpd\uff63\u306b\u4ee3\u308f\u3063\u3066\uff62chronyd\uff63\u304c\u6a19\u6e96\u3068\u306a\u3063\u305f\u3002<\/p>\n<p>\u25a0NTP\u30b5\u30fc\u30d0\u30fc\u505c\u6b62<br \/>\n\u4eca\u307e\u3067\u4f7f\u308f\u308c\u3066\u304d\u305f\uff62ntpd\uff63\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u505c\u6b62\u3059\u308b\u3002<\/p>\n<pre>[root@server1 ~]# systemctl stop ntpd\r\n[root@server1 ~]# systemctl disable ntpd\r\nrm '\/etc\/systemd\/system\/multi-user.target.wants\/ntpd.service'\r\n[root@server1 ~]# systemctl list-unit-files -t service | grep ntpd\r\nntpd.service                                disabled\r\nntpdate.service                             disabled<\/pre>\n<p>\u25a0Chrony\u30b5\u30fc\u30d0\u30fc\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u3059\u3067\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u306f\u305a\u3060\u304c\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u306a\u3051\u308c\u3070yum\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<pre>[root@server1 ~]# yum -y install chrony\r\n\u8aad\u307f\u8fbc\u3093\u3060\u30d7\u30e9\u30b0\u30a4\u30f3:fastestmirror, langpacks, priorities\r\nLoading mirror speeds from cached hostfile\r\n * base: ftp.riken.jp\r\n * centosplus: ftp.riken.jp\r\n * extras: mirror.nus.edu.sg\r\n * updates: mirror.nus.edu.sg\r\n\u30d1\u30c3\u30b1\u30fc\u30b8 chrony-1.29.1-1.el7.centos.x86_64 \u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u6e08\u307f\u304b\u6700\u65b0\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u3059\r\n\u4f55\u3082\u3057\u307e\u305b\u3093<\/pre>\n<p>\u25a0Chrony\u30b5\u30fc\u30d0\u30fc\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u7de8\u96c6<\/p>\n<pre>[root@server1 ~]# vi \/etc\/chrony.conf\r\n# Use public servers from the pool.ntp.org project.\r\n# Please consider joining the pool (http:\/\/www.pool.ntp.org\/join.html).\r\n#server 0.centos.pool.ntp.org iburst\u3000\u2190\u3000#\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\n#server 1.centos.pool.ntp.org iburst\u3000\u2190\u3000#\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\n#server 2.centos.pool.ntp.org iburst\u3000\u2190\u3000#\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\n#server 3.centos.pool.ntp.org iburst\u3000\u2190\u3000#\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\r\nserver ntp1.plala.or.jp\u3000\u2190\u3000server \u306b\u306f\u3001\u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u306eNTP\u30b5\u30fc\u30d0\u30fc\u3092\u8ffd\u52a0\r\nserver ntp2.plala.or.jp\u3000\u2190\u3000\u30bb\u30ab\u30f3\u30c0\u30ea\u306eNTP\u30b5\u30fc\u30d0\u30fc\u3082\u8ffd\u52a0\r\n\r\n# Ignore stratum in source selection.\r\nstratumweight 0\r\n\r\n# Record the rate at which the system clock gains\/losses time.\r\ndriftfile \/var\/lib\/chrony\/drift\r\n\r\n# Enable kernel RTC synchronization.\r\nrtcsync\r\n\r\n# In first three updates step the system clock instead of slew\r\n# if the adjustment is larger than 10 seconds.\r\nmakestep 10 3\r\n\r\n# Allow NTP client access from local network.\r\n#allow 192.168\/16\r\nallow 192.168.1.0\/24\u3000\u2190\u3000\u5185\u90e8\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u8a31\u53ef\r\n\r\n# Listen for commands only on localhost.\r\nbindcmdaddress 127.0.0.1\r\nbindcmdaddress ::1\r\n\r\n# Serve time even if not synchronized to any NTP server.\r\n#local stratum 10\r\n\r\nkeyfile \/etc\/chrony.keys\r\n\r\n# Specify the key used as password for chronyc.\r\ncommandkey 1\r\n\r\n# Generate command key if missing.\r\ngeneratecommandkey\r\n\r\n# Disable logging of client accesses.\r\nnoclientlog\r\n\r\n# Send a message to syslog if a clock adjustment is larger than 0.5 seconds.\r\nlogchange 0.5\r\n\r\nlogdir \/var\/log\/chrony\r\n#log measurements statistics tracking<\/pre>\n<p>\u25a0Chrony\u30b5\u30fc\u30d0\u30fc\u306e\u8d77\u52d5<br \/>\n\u3044\u3063\u305f\u3093\u3001\u624b\u52d5\u3067NTP\u30b5\u30fc\u30d0\u306e\u6642\u523b\u3068\u540c\u671f\u3055\u305b\u308b\u3002<\/p>\n<pre>[root@server1 ~]# ntpdate ntp1.plala.or.jp\r\n21 Dec 07:32:01 ntpdate[2323]: no server suitable for synchronization found<\/pre>\n<p>\u25a0Chrony\u30b5\u30fc\u30d0\u30fc\u518d\u8d77\u52d5<\/p>\n<pre>[root@server1 ~]# systemctl restart chronyd<\/pre>\n<p>\u25a0Chrony\u30b5\u30fc\u30d0\u30fc\u81ea\u52d5\u8d77\u52d5\u8a2d\u5b9a<\/p>\n<pre>[root@server1 ~]# systemctl enable chronyd\r\n[root@server1 ~]# systemctl list-unit-files -t service | grep chronyd\r\nchronyd.service                             enabled<\/pre>\n<p>\u25a0Chrony\u30b5\u30fc\u30d0\u30fc\u306e\u52d5\u4f5c\u78ba\u8a8d\u3002<\/p>\n<pre>[root@server1 ~]# chronyc sources\r\n210 Number of sources = 2\r\nMS Name\/IP address         Stratum Poll Reach LastRx Last sample\r\n===============================================================================\r\n^? ntp1.plala.or.jp              0   6     0   10y     +0ns[   +0ns] +\/-    0ns\r\n^? ntp2.plala.or.jp              0   6     0   10y     +0ns[   +0ns] +\/-    0ns<\/pre>\n<p>\u25a0\u7d0415\u5206\u5f8c\u3001\u518d\u5ea6Chrony\u30b5\u30fc\u30d0\u30fc\u306e\u52d5\u4f5c\u78ba\u8a8d\u3002<\/p>\n<pre>[root@server1 ~]# chronyc sources\r\n210 Number of sources = 2\r\nMS Name\/IP address         Stratum Poll Reach LastRx Last sample\r\n===============================================================================\r\n^+ ntp1.plala.or.jp              4   6     7     0   -198us[  -20ms] +\/-  103ms\r\n^* ntp2.plala.or.jp              4   6     7     0    +56us[  -20ms] +\/-  103ms\r\n\u6307\u5b9a\u3057\u305fNTP\u30b5\u30fc\u30d0\u306e\u524d\u306b*\u3084+\u304c\u8868\u793a\u3055\u308c\u305f\u6642\u306f\u540c\u671f\u5b8c\u4e86\u306e\u72b6\u614b\u3002<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>NTP\u30b5\u30fc\u30d0\u30fc(chrony) CentOS7 \u306e\u6642\u523b\u540c\u671f\u306b\u95a2\u3057\u3066\u306f\u3001\u4eca\u307e\u3067\u4f7f\u308f &hellip; <a href=\"http:\/\/yokensaka.com\/centos\/?p=321\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-321","post","type-post","status-publish","format-standard","hentry","category-ntpchrony"],"_links":{"self":[{"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=\/wp\/v2\/posts\/321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=321"}],"version-history":[{"count":5,"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions"}],"predecessor-version":[{"id":455,"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions\/455"}],"wp:attachment":[{"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yokensaka.com\/centos\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}