{"id":112,"date":"2023-10-22T15:29:48","date_gmt":"2023-10-22T13:29:48","guid":{"rendered":"http:\/\/it4home.dk\/?p=112"},"modified":"2023-10-22T15:33:17","modified_gmt":"2023-10-22T13:33:17","slug":"configuring-ntp-servers-in-dhcpcd-conf-for-time-synchronization","status":"publish","type":"post","link":"https:\/\/it4home.dk\/index.php\/2023\/10\/22\/configuring-ntp-servers-in-dhcpcd-conf-for-time-synchronization\/","title":{"rendered":"Setting Up NTP on Raspberry Pi &#8220;Bookworm&#8221; for Accurate Timekeeping"},"content":{"rendered":"<div class=\"pdfprnt-buttons pdfprnt-buttons-post pdfprnt-top-right\"><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/112?print=pdf\" class=\"pdfprnt-button pdfprnt-button-pdf\" target=\"_blank\" ><\/a><a href=\"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/112?print=print\" class=\"pdfprnt-button pdfprnt-button-print\" target=\"_blank\" ><img decoding=\"async\" src=\"https:\/\/it4home.dk\/wp-content\/plugins\/pdf-print\/images\/print.png\" alt=\"image_print\" title=\"Print Content\" \/><\/a><\/div>\n<h3 class=\"wp-block-heading\">Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Accurate timekeeping is essential for various applications, from logging to scheduling tasks. While there are numerous public NTP servers, setting up your own NTP server offers more control and can be quite satisfying. In this blog post, we&#8217;ll explore how to configure a Raspberry Pi, affectionately named &#8220;Bookworm,&#8221; to sync time using an NTP server.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Why Raspberry Pi?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">The Raspberry Pi is a versatile and affordable piece of hardware that can handle a variety of tasks, including acting as an NTP client. Its low power consumption and ease of use make it an ideal choice for this purpose.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Prerequisites<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A Raspberry Pi running a compatible Linux distribution (e.g., Raspbian)<\/li>\n\n\n\n<li>Basic knowledge of Linux commands and <code>vi<\/code> text editor<\/li>\n\n\n\n<li>Access to an NTP server (In this example, we use <code>192.168.0.1<\/code>)<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Step-by-Step Guide<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Check Current Time Sync Status<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   timedatectl show-timesync --all<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This command will display detailed information about the current time synchronization status on your Raspberry Pi.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li><strong>Edit the Configuration File<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   sudo vi \/etc\/systemd\/timesyncd.conf<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open the <code>timesyncd.conf<\/code> file using the <code>vi<\/code> text editor with superuser permissions.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li><strong>Set the NTP Server<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   NTP=192.168.0.1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add this line to the <code>timesyncd.conf<\/code> file to specify the NTP server you want to use. Save and exit the file.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li><strong>Restart the Time Sync Service<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   sudo systemctl restart systemd-timesyncd<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the <code>systemd-timesyncd<\/code> service to apply the changes.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li><strong>Verify the Changes<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   timedatectl show-timesync --all<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run this command again to confirm that the NTP server is now set to <code>192.168.0.1<\/code>.<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"6\">\n<li><strong>Check the System Time<\/strong><\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>   date<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, use the <code>date<\/code> command to display the current system time, ensuring that it is accurate.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Conclusion<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Configuring your Raspberry Pi &#8220;Bookworm&#8221; to use a specific NTP server is a straightforward process that ensures accurate timekeeping. This setup is particularly useful for networks where precise time is crucial. With these simple steps, you can achieve better control and reliability in time synchronization.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I hope you find this guide useful for setting up NTP on your Raspberry Pi &#8220;Bookworm.&#8221; Feel free to adapt these steps according to your specific needs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Accurate timekeeping is essential for various applications, from logging to scheduling tasks. While there are numerous public NTP servers, setting up your own NTP server offers more control and can be quite satisfying.&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":361,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[5,7],"tags":[35],"class_list":["post-112","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-raspberry","tag-ok"],"_links":{"self":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/112","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/comments?post=112"}],"version-history":[{"count":3,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/112\/revisions"}],"predecessor-version":[{"id":360,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/posts\/112\/revisions\/360"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media\/361"}],"wp:attachment":[{"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/media?parent=112"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/categories?post=112"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/it4home.dk\/index.php\/wp-json\/wp\/v2\/tags?post=112"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}