{"id":1527,"date":"2024-06-30T01:20:31","date_gmt":"2024-06-30T01:20:31","guid":{"rendered":"http:\/\/shijuvarghese.com\/?p=1527"},"modified":"2025-05-23T18:23:53","modified_gmt":"2025-05-23T18:23:53","slug":"time-date-and-timesync-using-chronyd","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=1527","title":{"rendered":"Time Date and Timesync using Chronyd"},"content":{"rendered":"<p>Every system has a clock and is a critical component of the Operating System. It keep the time, which is used for various proposes such as:<\/p>\n<ul>\n<li>Running automated jobs as configured intervals<\/li>\n<li>Marking timestamp on file properties<\/li>\n<li>Keeping track of when certain operations were made, and marking\u00a0the time on entries in the log file related to it.<\/li>\n<li>Ensuring synchronous activities between systems are managed properly<\/li>\n<li>etc. &#8230;<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>The commonly command and its switches used to view and manage the time configured in a system are as follows:<\/p>\n<p><strong>[root@centos9vm ~]#<\/strong> timedatectl<br \/>\n<em>=========<\/em><br \/>\n<em> Local time: Sun 2024-06-30 06:48:38 IST<\/em><br \/>\n<em> Universal time: Sun 2024-06-30 01:18:38 UTC<\/em><br \/>\n<em> RTC time: Sun 2024-06-30 01:18:38<\/em><br \/>\n<em> Time zone: Asia\/Kolkata (IST, +0530)<\/em><br \/>\n<em>System clock synchronized: yes<\/em><br \/>\n<em> NTP service: active<\/em><br \/>\n<em> RTC in local TZ: no<\/em><br \/>\n<em>==========<\/em><\/p>\n<p>The below command will help to identify the Time Zones that can be configured on this system<\/p>\n<p><strong>[root@centos9vm ~]#<\/strong> tzselect<\/p>\n<p><em>===== ===<\/em><br \/>\n<em>Please identify a location so that time zone rules can be set correctly.<\/em><br \/>\n<em>Please select a continent, ocean, &#8220;coord&#8221;, or &#8220;TZ&#8221;.<\/em><br \/>\n<em>1) Africa\u00a02) Americas 3)&#8230;&#8230;<\/em><\/p>\n<p><em>Enter the selection: 2<\/em><br \/>\n<em>Please select a country whose clocks agree with yours.<\/em><br \/>\n<em>1) Anguilla\u00a0 2)&#8230;.\u00a049) United States<\/em><\/p>\n<p><em>Enter the selection:\u00a049<\/em><br \/>\n<em>Please select one of the following timezones.<\/em><br \/>\n<em>1) Eastern (most areas)\u00a0 &#8230;.\u00a0\u00a029) Hawaii<\/em><\/p>\n<p><em>Enter the selection: 1<\/em><br \/>\n<em>The following information has been given:<\/em><\/p>\n<p><em>United States<\/em><br \/>\n<em> Eastern (most areas)<\/em><br \/>\n<em>Therefore TZ=&#8217;America\/New_York&#8217; will be used.<\/em><br \/>\n<em>===== ==<\/em><\/p>\n<p>Now let us configure a new TimeZone using the timedatectl command<\/p>\n<p><strong>[root@centos9vm ~]#<\/strong> timedatectl set-timezone America\/New_York<\/p>\n<p>If the\u00a0<strong>timedatectl<\/strong> command shows a line as below, that means NTP time synchronization is enabled<\/p>\n<p><em>NTP service: active<\/em><\/p>\n<p>Now let us try to change the date configured in the system. For this we will have to disable NTP time synchronization first<\/p>\n<p><strong>[root@centos9vm ~]#<\/strong> timedatectl set-ntp false<br \/>\n<strong>[root@centos9vm ~]#<\/strong> timedatectl set-time 2022-10-22<\/p>\n<p><strong>[root@centos9vm ~]#<\/strong> timedatectl<br \/>\n<em>Local time: Sat 2022-10-22 00:00:09 EDT<\/em><br \/>\n<em>&#8230;&#8230;&#8230;<\/em><br \/>\n<em>==== ==<\/em><\/p>\n<p><strong>[root@centos9vm ~]#<\/strong> timedatectl set-ntp true<br \/>\n<strong>[root@centos9vm ~]#<\/strong> timedatectl<br \/>\n<em>Local time: Sun 2024-06-30 05:21:27 EDT<\/em><br \/>\n<em>====== ===<\/em><\/p>\n<p>As the NTP is enabled, let us see the NTP server that is used<\/p>\n<p><strong>[root@centos9vm ~]#<\/strong> chronyc sources -v<\/p>\n<p><em>====== ===<\/em><br \/>\n<em>MS Name\/IP address Stratum Poll Reach LastRx Last sample<\/em><\/p>\n<p><em>^+ time.cloudflare.com 3 6 377 35 -3621us[-3542us] +\/- 48ms<\/em><br \/>\n<em>^- ntp.qntmnet.com 2 6 377 37 -7921us[-7843us] +\/- 104ms<\/em><br \/>\n<em>===== ==<\/em><\/p>\n<p>The NTP server is configured in the file\u00a0<em>\/etc\/chrony.conf<\/em><\/p>\n<p>[root@centos9vm ~]# cat \/etc\/chrony.conf<\/p>\n<p><em>=====<\/em><br \/>\n<em>pool 2.centos.pool.ntp.org &nbsp;&nbsp;&nbsp; <strong>iburst<\/strong><\/em><br \/>\n<em>=======<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Every system has a clock and is a critical component of the Operating System. It keep the time, which is used for various proposes such <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=1527\" title=\"Time Date and Timesync using Chronyd\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":1791,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[],"class_list":["post-1527","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-rhel-9"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/1527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1527"}],"version-history":[{"count":8,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/1527\/revisions"}],"predecessor-version":[{"id":1536,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/1527\/revisions\/1536"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/1791"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1527"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}