{"id":14895,"date":"2022-11-15T20:08:43","date_gmt":"2022-11-15T17:08:43","guid":{"rendered":"https:\/\/kifarunix.com\/?p=14895"},"modified":"2024-03-09T23:11:41","modified_gmt":"2024-03-09T20:11:41","slug":"setup-ntp-client-using-chrony-on-rocky-oracle-linux","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/setup-ntp-client-using-chrony-on-rocky-oracle-linux\/","title":{"rendered":"Setup NTP Client using Chrony on Rocky\/Oracle Linux"},"content":{"rendered":"\n

In this tutorial, you will learn setup NTP client using Chrony on Rocky\/Oracle Linux. Clock synchronization is one of the ISO 27001<\/a> requirements for logging and monitoring. The clocks of all relevant information processing systems within an organization or security domain shall be synchronized with an agreed accurate time source<\/em>.<\/p>\n\n\n\n

Configuring NTP Client using Chrony on Rocky\/Oracle Linux<\/h2>\n\n\n\n

If you want your servers to use a centralized time server, then you can setup your NTP server and install NTP clients such chrony to enable you to synchronize time between the time server and your server.<\/p>\n\n\n\n

You can check the link below on how to install and setup NTP server on Linux;<\/p>\n\n\n\n

Install and configure NTP server on Linux<\/a><\/p>\n\n\n\n

In our demo environment, our NTP server using Chrony installed on Rocky\/Oracle Linux.<\/p>\n\n\n\n

If you have other systems on the network running on Rocky\/Oracle Linux and want to setup NTP client on them, proceed as follows;<\/p>\n\n\n\n

Install Chrony on Rocky\/Oracle Linux<\/h3>\n\n\n\n

Check if Chrony is installed;<\/p>\n\n\n\n

rpm -q chrony<\/code><\/pre>\n\n\n\n
chrony-4.1-3.0.1.el9.x86_64<\/code><\/pre>\n\n\n\n

Configure NTP Client to Query Time from NTP Server<\/h3>\n\n\n\n

Setting NTP client on Rocky\/Oracle Linux is the same as setting the NTP server as described above except that the client doesn\u2019t have access permissions set hence no server can query time information from it.<\/p>\n\n\n\n

Open the configuration file and set the NTP server as shown below;<\/p>\n\n\n\n

vim \/etc\/chrony.conf<\/code><\/pre>\n\n\n\n

Set your NTP Server;<\/p>\n\n\n\n

# Use public servers from the pool.ntp.org project.\n# Please consider joining the pool (http:\/\/www.pool.ntp.org\/join.html).\n#pool 2.centos.pool.ntp.org iburst\nserver ntp.kifarunix-demo.com iburst<\/strong><\/code><\/pre>\n\n\n\n

Ensure that the hostname of the NTP server is resolvable, otherwise use IP address.<\/p>\n\n\n\n

Verify NTP Client Connection to NTP Server UDP Port 123<\/h4>\n\n\n\n

To verify that there is a connection from the NTP client to NTP server on UDP port 123, simply use netcat command as shown below;<\/p>\n\n\n\n

dnf install nc -y<\/code><\/pre>\n\n\n\n

To verify connection to UDP port 123;<\/p>\n\n\n\n

nc -uzv ntp.kifarunix-demo.com 123<\/code><\/pre>\n\n\n\n
Connection to ntp.kifarunix-demo.com (192.168.100.152) 123 port [udp\/ntp] succeeded!<\/code><\/pre>\n\n\n\n

Great. You can now proceed to restart and enable chronyd<\/strong> to run on system boot.<\/p>\n\n\n\n

systemctl restart chronyd<\/code><\/pre>\n\n\n\n
systemctl enable chronyd<\/code><\/pre>\n\n\n\n

Check NTP Client time synchronization<\/h3>\n\n\n\n

To verify that time synchronization is working, you can use the tracking<\/strong> or sources<\/strong> command with chronyc<\/strong> command as shown below;<\/p>\n\n\n\n

chronyc tracking<\/code><\/pre>\n\n\n\n
Reference ID    : C0A86498 (ntp.kifarunix-demo.com)<\/strong>\nStratum         : 4\nRef time (UTC)  : Tue Nov 15 16:50:03 2022\nSystem time     : 0.000000045 seconds fast of NTP time\nLast offset     : -0.000046803 seconds\nRMS offset      : 0.000046803 seconds\nFrequency       : 5.280 ppm slow\nResidual freq   : -8.241 ppm\nSkew            : 2.680 ppm\nRoot delay      : 0.178974032 seconds\nRoot dispersion : 0.024439137 seconds\nUpdate interval : 2.0 seconds\nLeap status     : Normal\n<\/code><\/pre>\n\n\n\n

Using the sources command;<\/p>\n\n\n\n

chronyc sources<\/code><\/pre>\n\n\n\n
MS Name\/IP address         Stratum Poll Reach LastRx Last sample               \n===============================================================================\n^* ntp.kifarunix-demo.com        3   6    17    52    -26us[  -73us] +\/-  114ms<\/strong><\/code><\/pre>\n\n\n\n

Check sources statistics<\/p>\n\n\n\n

chronyc sourcestats<\/code><\/pre>\n\n\n\n
Name\/IP Address            NP  NR  Span  Frequency  Freq Skew  Offset  Std Dev\n==============================================================================\nntp.kifarunix-demo.com      5   4    71     +0.602      4.314  +2482ns    25us<\/code><\/pre>\n\n\n\n

The NTP client is now synchronized with our NTP server.<\/p>\n\n\n\n

Confirm the date;<\/p>\n\n\n\n

timedatectl<\/code><\/pre>\n\n\n\n
\n               Local time: Tue 2022-11-15 20:59:20 +04\n           Universal time: Tue 2022-11-15 16:59:20 UTC\n                 RTC time: Tue 2022-11-15 16:59:20\n                Time zone: Asia\/Dubai (+04, +0400)\nSystem clock synchronized: yes\n              NTP service: active\n          RTC in local TZ: no\n<\/code><\/pre>\n\n\n\n

Related Tutorials<\/h3>\n\n\n\n

Install and Configure NTP Client on Ubuntu\/Debian systems<\/a><\/p>\n\n\n\n

Install and Setup NTP Server on Ubuntu 22.04\/Debian 11<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"

In this tutorial, you will learn setup NTP client using Chrony on Rocky\/Oracle Linux. Clock synchronization is one of the ISO 27001 requirements for logging<\/p>\n","protected":false},"author":1,"featured_media":12756,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,931,236],"tags":[6118,6117,6116,6114,6115],"class_list":["post-14895","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-chrony","category-ntp","tag-chrony-ntp-client","tag-linux-ntp-client","tag-oracle-linux-ntp-client","tag-setup-ntp-client-on-oracle-linux","tag-setup-ntp-client-on-rocky-linux","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/14895"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=14895"}],"version-history":[{"count":4,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/14895\/revisions"}],"predecessor-version":[{"id":20647,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/14895\/revisions\/20647"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/12756"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=14895"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=14895"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=14895"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}