{"id":665,"date":"2018-08-15T12:51:55","date_gmt":"2018-08-15T12:51:55","guid":{"rendered":"http:\/\/camilalui.com\/?p=665"},"modified":"2018-08-16T08:35:10","modified_gmt":"2018-08-16T08:35:10","slug":"install-and-configure-chrony-centos7","status":"publish","type":"post","link":"https:\/\/camilalui.com\/?p=665","title":{"rendered":"Install and configure chrony &#8211; CentOS7"},"content":{"rendered":"<p><strong>What is Chrony ?<\/strong><br \/>\nChrony provides another implementation of NTP. It is designed for systems that are often powered down or disconnected from the network. The main configuration file is \/etc\/chrony.conf and the parameters are similar to those in the \/etc\/ntp.conf file. Chronyd is a daemon that runs in user space and also is a command-line program that provides a command prompt and a number of commands.<\/p>\n<p><strong>Examples:<\/strong><br \/>\n<strong>tracking:<\/strong> Displays system time information.<br \/>\n<strong>sources:<\/strong> Displays information about current sources.<\/p>\n<p>You can find more about here:<\/p>\n<p><a href=\"https:\/\/chrony.tuxfamily.org\/comparison.html\">https:\/\/chrony.tuxfamily.org\/comparison.html<\/a><\/p>\n<p>1. Make sure you have your hostnames and <strong>\/etc\/hosts<\/strong> file properly configured<\/p>\n<p><strong>Server<\/strong> (host1.localnet.com)<br \/>\n<strong>Client<\/strong> (host2.localnet.com)<\/p>\n<p>\/etc\/hosts file<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4\r\n::1 localhost localhost.localdomain localhost6 localhost6.localdomain6\r\n192.168.0.200 host2.localnet.com host2\r\n192.168.0.199 host1.localnet.com host1<\/pre>\n<p>2. Install chrony package on both the <strong>server<\/strong> and the <strong>client<\/strong> machine<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># yum install chrony<\/pre>\n<p>3. Start and enable the daemon on both the <strong>server and client <\/strong>machines<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># systemctl start chrony\r\n# systemctl enable chrony<\/pre>\n<p>4. At the <strong>server <\/strong>machine, edit the \/etc\/chrony.conf file and add your client network<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">## Allow NTP client access from local network.\r\nallow 192.168.0.0\/24<\/pre>\n<p>5. At the client machine, edit the \/etc\/chrony.conf and add your ntp server IP address<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># 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\r\n#server 1.centos.pool.ntp.org iburst\r\n#server 2.centos.pool.ntp.org iburst\r\n#server 3.centos.pool.ntp.org iburst\r\nserver 192.168.0.199 iburst<\/pre>\n<p>6. Restart chrony service on both machines<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># systemctl restart chrony<\/pre>\n<p>7. Make sure you allow ntp service in your firewall on both machines<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># firewall-cmd --permanent --zone=public --add-service ntp\r\n# firewall-cmd --reload\r\n# firewall-cmd --list-all | grep services<\/pre>\n<p>8. Verify your sources information<\/p>\n<p><strong>server<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># chronyc sources\r\n210 Number of sources = 4\r\nMS Name\/IP address Stratum Poll Reach LastRx Last sample\r\n===============================================================================\r\n^? t1.time.ir2.yahoo.com 0 6 0 - +0ns[ +0ns] +\/- 0ns\r\n^? bray.walcz.net 0 6 0 - +0ns[ +0ns] +\/- 0ns\r\n^? t1.time.ir2.yahoo.com 0 9 0 - +0ns[ +0ns] +\/- 0ns\r\n^? tshirt.heanet.ie 0 6 0 - +0ns[ +0ns] +\/- 0ns<\/pre>\n<p><strong>client<\/strong><br \/>\n<code><\/code><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># chronyc sources\r\n210 Number of sources = 1\r\nMS Name\/IP address Stratum Poll Reach LastRx Last sample\r\n===============================================================================\r\n^? host1.localnet.com 0 7 0 - +0ns[ +0ns] +\/- 0ns<\/pre>\n<p>9. Verify your system time information<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># chronyc tracking\r\nReference ID : 7F7F0101 ()\r\nStratum : 10\r\nRef time (UTC) : Wed Aug 15 12:16:29 2018\r\nSystem time : 0.000000020 seconds fast of NTP time\r\nLast offset : +0.000000000 seconds\r\nRMS offset : 0.000000000 seconds\r\nFrequency : 3.440 ppm fast\r\nResidual freq : +0.000 ppm\r\nSkew : 0.000 ppm\r\nRoot delay : 0.000000000 seconds\r\nRoot dispersion : 0.000000000 seconds\r\nUpdate interval : 0.0 seconds\r\nLeap status : Normal<\/pre>\n<p><strong>Some of the fields<\/strong><br \/>\n<strong>Reference ID:<\/strong>\u00a0 The Reference ID and the name or IP address (if available), of the server to which the computer is currently synchronized.<br \/>\n<strong>Stratum:<\/strong> The stratum indicates how many hops away from a computer with an attached reference clock you are.<br \/>\n<strong>Ref time:<\/strong> This is the time (UTC) at which the last measurement from the reference source was processed.<br \/>\n10. Verify your sources<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\"># chronyc sources -v\r\n210 Number of sources = 4\r\n.-- Source mode '^' = server, '=' = peer, '#' = local clock.\r\n\/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,\r\n| \/ '?' = unreachable, 'x' = time may be in error, '~' = time too variable.\r\n|| .- xxxx [ yyyy ] +\/- zzzz\r\n|| Reachability register (octal) -. | xxxx = adjusted offset,\r\n|| Log2(Polling interval) --. | | yyyy = measured offset,\r\n|| \\ | | zzzz = estimated error.\r\n|| | | \\\r\nMS Name\/IP address Stratum Poll Reach LastRx Last sample\r\n===============================================================================\r\n^? mail.thefrown.net 0 6 0 - +0ns[ +0ns] +\/- 0ns\r\n^? t2.time.ir2.yahoo.com 0 6 0 - +0ns[ +0ns] +\/- 0ns\r\n^? bray.walcz.net 0 9 0 - +0ns[ +0ns] +\/- 0ns\r\n^? 193.1.12.167 0 6 0 - +0ns[ +0ns] +\/- 0ns<\/pre>\n<p><strong>M:<\/strong> The mode of the source, where:<br \/>\n^ means a server<br \/>\n= means a peer<br \/>\n# indicates a locally connected reference clock.<\/p>\n<p><strong>S:<\/strong> The state of the sources, where:<\/p>\n<p>\u201c*\u201d indicates the source to which chronyd is currently synchronized.<br \/>\n\u201c+\u201d indicates acceptable sources that are combined with the selected source.<br \/>\n\u201c-\u201d indicates acceptable sources that are excluded by the combining algorithm.<br \/>\n\u201c?\u201d indicates sources to which connectivity has been lost or whose packets do not pass all tests.<br \/>\n\u201cx\u201d indicates a clock that chronyd thinks is a false ticker, that is, its time is inconsistent with a majority of other sources.<br \/>\n\u201c~\u201d indicates a source whose time appears to have too much variability.<br \/>\n\u201c?\u201d condition is also shown at start-up, until at least three samples have been gathered from it.<\/p>\n<p><strong>Name\/IP address:<\/strong> This shows the name or the IP address of the source, or reference ID for reference clocks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What is Chrony ? Chrony provides another implementation of NTP. It is designed for systems that are often powered down or disconnected from the network. The main configuration file is \/etc\/chrony.conf and the parameters are similar to those in the \/etc\/ntp.conf file. Chronyd is a daemon that runs in user space and also is a<a class=\"more-link\" href=\"https:\/\/camilalui.com\/?p=665\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_tec_slr_enabled":"","_tec_slr_layout":""},"categories":[30,29,28],"tags":[],"class_list":["post-665","post","type-post","status-publish","format-standard","hentry","category-linux","category-ntp","category-rhel"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9toiJ-aJ","jetpack_likes_enabled":true,"jetpack-related-posts":[],"ticketed":false,"_links":{"self":[{"href":"https:\/\/camilalui.com\/index.php?rest_route=\/wp\/v2\/posts\/665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/camilalui.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/camilalui.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/camilalui.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/camilalui.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=665"}],"version-history":[{"count":16,"href":"https:\/\/camilalui.com\/index.php?rest_route=\/wp\/v2\/posts\/665\/revisions"}],"predecessor-version":[{"id":707,"href":"https:\/\/camilalui.com\/index.php?rest_route=\/wp\/v2\/posts\/665\/revisions\/707"}],"wp:attachment":[{"href":"https:\/\/camilalui.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/camilalui.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/camilalui.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}