{"id":4731,"date":"2019-08-01T19:15:36","date_gmt":"2019-08-01T22:15:36","guid":{"rendered":"https:\/\/blog.clusterweb.com.br\/?p=4731"},"modified":"2019-08-01T19:15:36","modified_gmt":"2019-08-01T22:15:36","slug":"configure-centos-to-sync-with-ntp-time-servers","status":"publish","type":"post","link":"https:\/\/blog.clusterweb.com.br\/?p=4731","title":{"rendered":"Configure CentOS to Sync with NTP Time Servers"},"content":{"rendered":"<p>Over the years, We\u2019ve encountered many questions on how to correctly configure our Linux hosts to sync time to our enterprise NTP Servers.<\/p>\n<p>So, We thought why not create an article that outlines in the simplest form possible the correct way to configure the NTP Client to synchronize with NTP Servers.<\/p>\n<h2>Sync CentOS with NTP Time Servers<\/h2>\n<p>First of all, we need to install the <strong><em>ntpd<\/em><\/strong> and <strong><em>ntpdate<\/em><\/strong> clients on our Linux host. I\u2019m using CentOS, but it\u2019s the same in Ubuntu and so forth.<\/p>\n<pre class=\"wp-block-code\"><code># yum install ntp ntpdate<\/code><\/pre>\n<pre class=\"wp-block-code\"><code># systemctl start ntpd<\/code><\/pre>\n<pre class=\"wp-block-code\"><code># systemctl enable ntpd<\/code><\/pre>\n<pre class=\"wp-block-code\"><code># systemctl status ntpd<\/code><\/pre>\n<p>Now let\u2019s run the following command to configure the NTP Servers.<\/p>\n<pre class=\"wp-block-code\"><code># ntpdate -u -s 0.centos.pool.ntp.org 1.centos.pool.ntp.org 2.centos.pool.ntp.org<\/code><\/pre>\n<p>What we\u2019re doing is telling the ntpdate to use an unprivileged port for outgoing packets with the <strong><em>-u<\/em><\/strong> switch and to write logging output to the system syslog facility using the <strong><em>-s<\/em><\/strong> switch.<\/p>\n<p>Next let\u2019s restart the <strong><em>ntpd<\/em><\/strong> daemon.<\/p>\n<pre class=\"wp-block-code\"><code># systemctl restart ntpd<\/code><\/pre>\n<p>Now let\u2019s check if NTP synchronization is enabled and running.<\/p>\n<pre class=\"wp-block-code\"><code># timedatectl<\/code><\/pre>\n<p>And for the last, we will set the hardware clock to the current system time using the -w switch.<\/p>\n<pre class=\"wp-block-code\"><code># hwclock -w<\/code><\/pre>\n<p>Congratulations! You\u2019ve now successfully set your NTP client on CentOS.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the years, We\u2019ve encountered many questions on how to correctly configure our Linux hosts to sync time to our enterprise NTP Servers. So, We thought why not create an article that outlines in the simplest form possible the correct way to configure the NTP Client to synchronize with NTP Servers. Sync CentOS with NTP [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1082,730,1,42,51,495],"tags":[199,292,1380,1182,1379,1381,921,983],"class_list":["post-4731","post","type-post","status-publish","format-standard","hentry","category-centos-7-rhel-7","category-clusterweb","category-viazap","category-leitura-recomendada","category-linux-linuxrs","category-profissional-de-ti","tag-centos","tag-configure","tag-ntp","tag-servers","tag-sync","tag-time","tag-to","tag-with"],"_links":{"self":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4731"}],"version-history":[{"count":1,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4731\/revisions"}],"predecessor-version":[{"id":4732,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=\/wp\/v2\/posts\/4731\/revisions\/4732"}],"wp:attachment":[{"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.clusterweb.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}