<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>time sync - Hamradio.my</title>
	<atom:link href="https://hamradio.my/tag/time-sync/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>Amateur Radio, Tech Insights and Product Reviews</description>
	<lastBuildDate>Sun, 18 May 2025 14:29:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://hamradio.my/wp-content/uploads/2026/02/cropped-cropped-image-removebg-preview-3-32x32.png</url>
	<title>time sync - Hamradio.my</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to Set Up Chrony as a Local NTP Server Using Docker</title>
		<link>https://hamradio.my/2025/05/how-to-set-up-chrony-as-a-local-ntp-server-using-docker/</link>
					<comments>https://hamradio.my/2025/05/how-to-set-up-chrony-as-a-local-ntp-server-using-docker/#respond</comments>
		
		<dc:creator><![CDATA[9M2PJU]]></dc:creator>
		<pubDate>Sun, 18 May 2025 14:28:00 +0000</pubDate>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[docker]]></category>
		<category><![CDATA[network time protocol]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[chrony]]></category>
		<category><![CDATA[chronyd]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[ham radio tools]]></category>
		<category><![CDATA[homelab]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[local network]]></category>
		<category><![CDATA[networking]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[raspberry pi]]></category>
		<category><![CDATA[system admin]]></category>
		<category><![CDATA[time server]]></category>
		<category><![CDATA[time sync]]></category>
		<guid isPermaLink="false">https://hamradio.my/?p=7390</guid>

					<description><![CDATA[<p>In a local network where you want to keep your devices synchronized with accurate time, running a lightweight and efficient NTP server is essential. Chrony, a modern alternative to ntpd, is a great choice and in this guide, I’ll show you how to set it up inside a Docker container that fetches time from global [&#8230;]</p>
<p>The post <a href="https://hamradio.my/2025/05/how-to-set-up-chrony-as-a-local-ntp-server-using-docker/">How to Set Up Chrony as a Local NTP Server Using Docker</a> appeared on <a href="https://hamradio.my">Hamradio.my - Amateur Radio, Tech Insights and Product Reviews</a> by <a href="https://hamradio.my/author/9m2pju/">9M2PJU</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">In a local network where you want to keep your devices synchronized with accurate time, running a lightweight and efficient NTP server is essential. <strong>Chrony</strong>, a modern alternative to <code>ntpd</code>, is a great choice and in this guide, I’ll show you how to set it up inside a Docker container that fetches time from global sources and distributes it across your LAN.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading" id="h-why-chrony"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f680.png" alt="🚀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Why Chrony?</h3>



<p class="wp-block-paragraph">Chrony is:</p>



<ul class="wp-block-list">
<li>More accurate than <code>ntpd</code> in many conditions (especially with intermittent connectivity)</li>



<li>Lightweight and easy to configure</li>



<li>Ideal for both clients and servers</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h3 class="wp-block-heading" id="h-what-you-ll-set-up"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f433.png" alt="🐳" class="wp-smiley" style="height: 1em; max-height: 1em;" /> What You&#8217;ll Set Up</h3>



<ul class="wp-block-list">
<li>A <strong>Docker container</strong> running Chrony</li>



<li>Configured to <strong>sync with global NTP servers</strong></li>



<li>Act as a <strong>time server for your LAN</strong></li>



<li>With optional <strong>logging and control access</strong></li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-step-1-create-a-dockerfile-for-chrony"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9f1.png" alt="🧱" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 1: Create a Dockerfile for Chrony</h2>



<p class="wp-block-paragraph">Start by creating a simple <code>Dockerfile</code> to build a minimal Chrony container.</p>



<pre class="wp-block-code"><code># Dockerfile
FROM debian:stable-slim

RUN apt-get update &amp;&amp; \
    apt-get install -y chrony &amp;&amp; \
    apt-get clean &amp;&amp; \
    rm -rf /var/lib/apt/lists/*

COPY chrony.conf /etc/chrony/chrony.conf

EXPOSE 123/udp

CMD &#91;"chronyd", "-d", "-f", "/etc/chrony/chrony.conf"]
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-step-2-create-the-chrony-conf"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2699.png" alt="⚙" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 2: Create the <code>chrony.conf</code></h2>



<p class="wp-block-paragraph">Here’s a sample <code>chrony.conf</code> tailored for <strong>local server use</strong> and syncing with global time sources:</p>



<pre class="wp-block-code"><code># chrony.conf

# Time sources (use pool.ntp.org or your regional servers)
server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst
server 2.pool.ntp.org iburst

# Allow all clients on your LAN (edit this according to your subnet)
allow 192.168.1.0/24

# Local stratum fallback if Internet is down
local stratum 10

# Drift file to track clock error over time
driftfile /var/lib/chrony/chrony.drift

# Log tracking data
log tracking measurements statistics

# Log files location
logdir /var/log/chrony

# Optional: control access
cmdport 0  # Use 0 to disable remote control; use 323 if needed
</code></pre>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class="wp-block-paragraph">Replace <code>192.168.1.0/24</code> with your actual LAN subnet.</p>
</blockquote>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-step-3-build-and-run-the-docker-container"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9ea.png" alt="🧪" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 3: Build and Run the Docker Container</h2>



<pre class="wp-block-code"><code>docker build -t chrony-server .
</code></pre>



<p class="wp-block-paragraph">Now run the container with:</p>



<pre class="wp-block-code"><code>docker run -d \
  --name chrony \
  --restart unless-stopped \
  --network host \
  --cap-add=NET_BIND_SERVICE \
  chrony-server
</code></pre>



<h3 class="wp-block-heading" id="h-explanation"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Explanation:</h3>



<ul class="wp-block-list">
<li><code>--network host</code> allows the container to bind directly to port 123/UDP</li>



<li><code>--cap-add=NET_BIND_SERVICE</code> is required to bind to low-numbered ports like 123</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-step-4-test-your-ntp-server"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f50e.png" alt="🔎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Step 4: Test Your NTP Server</h2>



<p class="wp-block-paragraph">From a client machine on your LAN:</p>



<pre class="wp-block-code"><code>ntpdate -q &lt;chrony-server-ip&gt;
</code></pre>



<p class="wp-block-paragraph">or</p>



<pre class="wp-block-code"><code>chronyc sources -a
</code></pre>



<p class="wp-block-paragraph">You should see that the time is being served and synchronized.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-optional-run-as-a-local-time-authority"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4cc.png" alt="📌" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Optional: Run as a Local Time Authority</h2>



<p class="wp-block-paragraph">If you want to run <strong>fully offline</strong>, or ensure internal time continuity even without internet:</p>



<ol class="wp-block-list">
<li>Remove the <code>server</code> lines from <code>chrony.conf</code></li>



<li>Set: <code>local stratum 8</code></li>



<li>Start the server with a <strong>stable internal clock source</strong></li>
</ol>



<p class="wp-block-paragraph">This makes your Chrony instance a <strong>local time authority</strong> for your network.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-firewall-notes"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f510.png" alt="🔐" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Firewall Notes</h2>



<p class="wp-block-paragraph">Make sure UDP port <strong>123</strong> is allowed <strong>inbound</strong> from your LAN on your Docker host:</p>



<pre class="wp-block-code"><code>sudo ufw allow proto udp from 192.168.1.0/24 to any port 123
</code></pre>



<p class="wp-block-paragraph">Or for <code>iptables</code>:</p>



<pre class="wp-block-code"><code>iptables -A INPUT -p udp -s 192.168.1.0/24 --dport 123 -j ACCEPT
</code></pre>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<h2 class="wp-block-heading" id="h-conclusion"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4ce.png" alt="📎" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Conclusion</h2>



<p class="wp-block-paragraph">With this setup, you&#8217;ve created a <strong>portable, containerized NTP server</strong> using Chrony that:</p>



<ul class="wp-block-list">
<li>Syncs with global servers</li>



<li>Serves accurate time to all local devices</li>



<li>Works even if your external internet connection drops</li>
</ul>



<p class="wp-block-paragraph">Perfect for <strong>homelabs</strong>, <strong>IoT networks</strong>, or <strong>offline environments</strong>.</p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://hamradio.my/2025/05/how-to-set-up-chrony-as-a-local-ntp-server-using-docker/">How to Set Up Chrony as a Local NTP Server Using Docker</a> appeared on <a href="https://hamradio.my">Hamradio.my - Amateur Radio, Tech Insights and Product Reviews</a> by <a href="https://hamradio.my/author/9m2pju/">9M2PJU</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://hamradio.my/2025/05/how-to-set-up-chrony-as-a-local-ntp-server-using-docker/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
