<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Insights (EN): IB Theis GmbH</title>
    <link>https://www.ib-theis.de/en/insights/</link>
    <description>Short technical articles and case studies from projects with Oracle, PostgreSQL, Kubernetes, Ansible, Kafka and RHEL: problem, fix, result. With RSS feed.</description>
    <language>en</language>
    <lastBuildDate>Sat, 14 Nov 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.ib-theis.de/en/insights/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>The tunnel that only came back on a new port</title>
      <link>https://www.ib-theis.de/en/insights/wireguard-tunnel-back-on-a-new-port/</link>
      <guid isPermaLink="true">https://www.ib-theis.de/en/insights/wireguard-tunnel-back-on-a-new-port/</guid>
      <pubDate>Sat, 14 Nov 2026 00:00:00 +0000</pubDate>
      <dc:creator>Gregor Theis, IB Theis GmbH</dc:creator>
      <category>vpn</category>
      <category>networking</category>
      <category>linux</category>
      <description>After patching the main server our WireGuard tunnel stayed down: handshakes left the remote site, nothing came back — until the source port changed.</description>
      <content:encoded><![CDATA[<h2 id="problem">Problem</h2>
<p>This is a follow-up to <a href="https://www.ib-theis.de/en/insights/wireguard-site-to-site-with-fritzos/">WireGuard site-to-site behind a FRITZ!Box</a>.
That article closes with the advice to set <code>PersistentKeepalive</code> on the dialling side, because an idle UDP flow
through a consumer router (a FRITZ!Box 6690 Cable) is a flow that may quietly disappear. It turns out that a
keepalive protects a running tunnel, not one whose peer goes away for a few minutes.</p>
<figure class="figure-svg">
<svg xmlns="http://www.w3.org/2000/svg" class="netmap" viewBox="0 0 960 400" width="960" height="400"
     role="img" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
     aria-label="Site-to-site WireGuard: a FRITZ!Box and a Raspberry Pi at the remote site, a gateway VM and Proxmox at the main site, connected over the internet">
  <!-- Beschriftung bewusst als aria-label statt <title>: ein zweites <title> im Dokument verletzt Regel 13 in check.py -->
  <!-- Netzplan zum Artikel. Linien in currentColor (Dark Mode), Markenrot nur fuer den Tunnel.
       Keine style-Attribute (CSP), alles als Praesentationsattribut. -->

  <g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    <!-- Standort: Remote Location -->
    <rect x="20" y="44" width="300" height="296"/>
    <!-- Standort: Main Location -->
    <rect x="640" y="44" width="300" height="296"/>

    <!-- Geraete am entfernten Standort -->
    <rect x="44" y="116" width="252" height="64"/>
    <rect x="44" y="236" width="252" height="80"/>
    <path d="M170 180 V236"/>

    <!-- Geraete am Hauptstandort -->
    <rect x="664" y="116" width="252" height="84"/>
    <rect x="664" y="236" width="252" height="80"/>
    <path d="M790 200 V236"/>

    <!-- Internet-Wolke -->
    <path d="M424 176 a30 30 0 0 1 10 -57 a38 38 0 0 1 70 -16 a32 32 0 0 1 48 20 a28 28 0 0 1 -4 53 Z"/>

    <!-- Physischer Weg: FRITZ!Box zur Wolke, Wolke zur Gateway-VM -->
    <path d="M296 148 H424"/>
    <path d="M548 148 H664"/>

    <!-- DNS-Rueckfall ins offene Internet, wenn der Hauptstandort nicht erreichbar ist -->
    <path d="M296 262 C 360 262, 380 200, 430 178" stroke-dasharray="4 6"/>
  </g>

  <!-- Tunnel: Markenrot, immer vom entfernten Standort aufgebaut -->
  <g fill="none" stroke="#FF0000" stroke-width="3" stroke-linecap="round">
    <path d="M296 290 C 430 326, 560 300, 664 184"/>
  </g>
  <path d="M664 184 L647 186 L656 197 Z" fill="#FF0000"/>

  <g fill="currentColor" font-size="17">
    <!-- Ueberschriften der Standorte -->
    <text x="36" y="74" font-weight="700">Remote Location</text>
    <text x="36" y="97" font-size="13" opacity="0.75">192.168.178.0/24</text>
    <text x="656" y="74" font-weight="700">Main Location</text>
    <text x="656" y="97" font-size="13" opacity="0.75">192.168.1.0/24, 192.168.253.0/24</text>

    <!-- Remote Location -->
    <text x="60" y="144" font-weight="700">FRITZ!Box Cable 6690</text>
    <text x="60" y="166" font-size="15" opacity="0.75">dynamic IPv4</text>
    <text x="60" y="264" font-weight="700">Raspberry Pi 5</text>
    <text x="60" y="286" font-size="15" opacity="0.75">WireGuard endpoint</text>
    <text x="60" y="306" font-size="15" opacity="0.75">Unbound resolver</text>

    <!-- Main Location -->
    <text x="680" y="144" font-weight="700">Gateway VM</text>
    <text x="680" y="166" font-size="15" opacity="0.75">firewall, WireGuard</text>
    <text x="680" y="186" font-size="15" opacity="0.75">185.6.68.20, static</text>
    <text x="680" y="264" font-weight="700">Proxmox</text>
    <text x="680" y="286" font-size="15" opacity="0.75">Backup Server, services</text>
    <text x="680" y="306" font-size="15" opacity="0.75">internal resolver</text>

    <!-- Wolke und Strecken -->
    <text x="452" y="155" font-size="15">Internet</text>
    <text x="348" y="270" font-size="14" opacity="0.75">DNS fallback</text>
  </g>

  <g fill="#FF0000" font-size="15" font-weight="700">
    <text x="396" y="338">WireGuard, UDP, MTU 1420</text>
  </g>
  <g fill="currentColor" font-size="14" opacity="0.75">
    <text x="396" y="358">10.254.0.0/30, always dialled from the remote site</text>
  </g>
</svg>

  <figcaption class="figure-svg__caption">The same two sites as in the first article. This time only one thing matters: the single UDP flow that the Raspberry Pi builds through the FRITZ!Box to the gateway VM — and the state the FRITZ!Box keeps for it.</figcaption>
</figure>

<p>We patched the main server and rebooted it on 14 November 2026, a normal maintenance window — the latest Ubuntu
and Debian kernel patches are the kind of update that needs one (I think I am spending too much time patching
systems lately, crazy time). Everything came back after some time, since I patched the Proxmox host as well as
the gateway VM, and a host restart takes a while with all the hardware reinitialization. Everything except the
site-to-site tunnel. The Remote Location lost the networks of the Main Location: no backups to the Proxmox
Backup Server, no name resolution across the link, the laptop test from the first article failing again.</p>
<p>The Nagios server noticed the missing tunnel quickly. That is where the search started; ten minutes later the
tunnel was up again.</p>
<h2 id="analysis">Analysis</h2>
<p>Working on the Pi at all was only possible because the Remote Location has a second way in from the outside,
over a port forwarded on the FRITZ!Box straight to the Raspberry Pi. Without it there would have been no way to
reach the Pi while the tunnel was down, and the analysis would have started with a drive to the Remote Location.</p>
<p><code>wg</code> on the Raspberry Pi showed the shape of the problem in one screen: no handshake, bytes going out, nothing
coming in. The retry every five seconds is WireGuard&rsquo;s handshake interval, not the keepalive — the keepalive only
runs once a session exists.</p>
<p>Remote Location:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">root@vpn-remote:/var/log# wg show
</span></span><span class="line"><span class="cl">interface: wg0
</span></span><span class="line"><span class="cl">  public key: &lt;public key of the Raspberry Pi&gt;
</span></span><span class="line"><span class="cl">  private key: (hidden)
</span></span><span class="line"><span class="cl">  listening port: 51820
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">peer: &lt;public key of the gateway VM&gt;
</span></span><span class="line"><span class="cl">  endpoint: 185.6.68.20:51820
</span></span><span class="line"><span class="cl">  allowed ips: 192.168.1.0/24, 192.168.253.0/24, 192.168.254.0/24, 10.254.0.1/32
</span></span><span class="line"><span class="cl">  transfer: 0 B received, 19.37 KiB sent
</span></span><span class="line"><span class="cl">  persistent keepalive: every 25 seconds
</span></span></code></pre></div><p>Main Location:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">root@gateway:~# wg show
</span></span><span class="line"><span class="cl">interface: wg0
</span></span><span class="line"><span class="cl">  public key: &lt;public key of the gateway VM&gt;
</span></span><span class="line"><span class="cl">  private key: (hidden)
</span></span><span class="line"><span class="cl">  listening port: 51820
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">peer: &lt;public key of the Raspberry Pi&gt;
</span></span><span class="line"><span class="cl">  endpoint: 82.115.124.36:51820
</span></span><span class="line"><span class="cl">  allowed ips: 10.254.0.2/32, 192.168.178.0/24
</span></span><span class="line"><span class="cl">  transfer: 12.57 KiB received, 15.62 KiB sent
</span></span><span class="line"><span class="cl">  persistent keepalive: every 25 seconds
</span></span><span class="line"><span class="cl">...
</span></span></code></pre></div><p>I learned that I should have checked for the &ldquo;latest handshake:&rdquo; line. It is missing in both outputs, and I read
past it at first. Both sides show the same picture from their own end: the Pi sends and gets nothing back, the
gateway receives and answers with 15.62 KiB. So the gateway was answering all along.</p>
<p>Then <code>tcpdump</code> on the Pi. The handshake initiations left the Remote Location every five seconds, and nothing came
back:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">root@vpn-remote:/var/log# tcpdump -ni eth0 udp port 51820
</span></span><span class="line"><span class="cl">tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
</span></span><span class="line"><span class="cl">listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
</span></span><span class="line"><span class="cl">11:21:32.617964 IP 192.168.178.3.51820 &gt; 185.6.68.20.51820: UDP, length 148
</span></span><span class="line"><span class="cl">11:21:37.737952 IP 192.168.178.3.51820 &gt; 185.6.68.20.51820: UDP, length 148
</span></span><span class="line"><span class="cl">^C
</span></span><span class="line"><span class="cl">2 packets captured
</span></span><span class="line"><span class="cl">2 packets received by filter
</span></span><span class="line"><span class="cl">0 packets dropped by kernel
</span></span></code></pre></div><p>Connection tracking on the gateway still had the flow, with 115 seconds left on its timer and marked <code>[ASSURED]</code>,
which the kernel only sets once it has seen packets in both directions:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">root@gateway:~# conntrack -L -p udp | grep 51820
</span></span><span class="line"><span class="cl">udp      17 115 src=82.115.124.36 dst=185.6.68.20 sport=51820 dport=51820 src=185.6.68.20 dst=82.115.124.36 sport=51820 dport=51820 [ASSURED] mark=0 use=1
</span></span><span class="line"><span class="cl">conntrack v1.4.8 (conntrack-tools): 169 flow entries have been shown.
</span></span></code></pre></div><p>Two different sources, one conclusion: the server side was healthy and replying — the packets died on the way
back.</p>
<p>That narrows the path down to exactly one stateful device we do not control from the inside: the FRITZ!Box at
the Remote Location, which source-NATs the Pi&rsquo;s UDP flow to the internet.</p>
<p>The test that decided it: we changed the listening port on the Pi, the side that dials.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">root@vpn-remote:/var/log# wg set wg0 listen-port 51821
</span></span><span class="line"><span class="cl">root@vpn-remote:/var/log# tcpdump -ni eth0 udp port 51821
</span></span><span class="line"><span class="cl">tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
</span></span><span class="line"><span class="cl">listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes
</span></span><span class="line"><span class="cl">11:21:51.725672 IP 185.6.68.20.51820 &gt; 192.168.178.3.51821: UDP, length 128
</span></span><span class="line"><span class="cl">11:21:51.726179 IP 192.168.178.3.51821 &gt; 185.6.68.20.51820: UDP, length 128
</span></span><span class="line"><span class="cl">11:21:51.727640 IP 185.6.68.20.51820 &gt; 192.168.178.3.51821: UDP, length 96
</span></span><span class="line"><span class="cl">11:21:51.727683 IP 192.168.178.3.51821 &gt; 185.6.68.20.51820: UDP, length 96
</span></span><span class="line"><span class="cl">11:21:51.748370 IP 185.6.68.20.51820 &gt; 192.168.178.3.51821: UDP, length 96
</span></span><span class="line"><span class="cl">11:21:51.748547 IP 185.6.68.20.51820 &gt; 192.168.178.3.51821: UDP, length 1452
</span></span><span class="line"><span class="cl">11:21:51.748548 IP 185.6.68.20.51820 &gt; 192.168.178.3.51821: UDP, length 368
</span></span><span class="line"><span class="cl">11:21:51.748625 IP 192.168.178.3.51821 &gt; 185.6.68.20.51820: UDP, length 96
</span></span><span class="line"><span class="cl">...
</span></span></code></pre></div><p>The handshake completed in the first second: the last fruitless attempt is logged at 11:21:37, the working one at
11:21:51. Fourteen seconds between &ldquo;nothing moves at all&rdquo; and a running tunnel. Same keys, same configuration,
same firewall rules, same endpoint — only a different source port. The FRITZ!Box keeps the source port unchanged
(no PAT), so the only thing it rewrites is the address. What it keeps on top of that is state.</p>
<h3 id="working-hypothesis">Working hypothesis</h3>
<p>The FRITZ!Box no longer delivered the return packets of that one UDP flow. While the main server was rebooting,
nothing came back for several minutes; whatever state the box kept for the flow ended up unusable, and it stayed
unusable even after the server was answering again. A new source port means a new connection tracking entry, and
the new entry works.</p>
<p>We cannot prove it. A FRITZ!Box offers no shell, no view of its connection tracking table and no counter for
return packets it drops, so the hypothesis rests on the symptom and on the fact that a fresh source port cures it
instantly.</p>
<p>There is no second candidate. The FRITZ!Box at the Remote Location holds a real public IPv4 address, so there
is no carrier-grade NAT behind it that could have lost the flow instead. Everything between the two WireGuard
interfaces is routing; the one place that keeps per-flow state is that box.</p>
<p>One observation supports the theory from the other side. The second way in that we used throughout is a static
port forward in that same FRITZ!Box — it has nothing to do with the tunnel, which the box only ever sees as a flow
built from the inside out. That static rule kept working through the reboot and through the entire outage. It
survived what the dynamically created entry did not, which is at least an argument for putting the tunnel on a
static rule as well.</p>
<h2 id="fix">Fix</h2>
<p>There is no fix yet, only a workaround that works reliably: give the tunnel a new source port, with the <code>wg set</code>
from the analysis above.</p>
<p><code>wg set</code> changes the running interface only. <code>wg-quick</code> reads <code>ListenPort</code> from <code>/etc/wireguard/wg0.conf</code>, so
the config file needs the same value if the change is supposed to survive a restart of the interface or a reboot
of the Pi.</p>
<p>Two things we did not do. Restarting the Pi is the obvious reflex, and it has cured this once before without any
analysis at all — that reboot doubled as a good moment for the patches that were waiting anyway. Today the same
restart did not help. The likely reason is timing: the entry in the FRITZ!Box only disappears when nothing is
sent for long enough, and a Raspberry Pi on an NVMe is back up in well under a minute. The earlier outage
apparently kept the tunnel down longer than whatever timer the box uses. Rebooting the FRITZ!Box would almost
certainly clear the state, but it is also our only way in. If it did not come back, the next step would be the car.</p>
<p>A word on that reflex. As a UNIX and Linux person I normally do not like &ldquo;just reboot it first&rdquo; — it throws away
the very state you need to understand the problem, and here it would have thrown away the hanging flow together
with the evidence. But it has worked for me a few times lately, without any analysis at all. So apparently one
can learn something from Windows ;-).</p>
<p>The plan for the next maintenance window is therefore to avoid the stale connection tracking entry instead of
repairing it: stop the tunnel on the Pi before the main server goes down, and bring it up afterwards — with a
changed port if it still refuses.</p>
<p>A self-healing timer on the Pi would be the only candidate that works without me: check
<code>wg show wg0 latest-handshakes</code>, rotate the listening port when the last handshake is too old. I have thought
about it and do not trust it yet. A script that changes the port of a working tunnel because of a badly chosen
threshold is a new source of outages, and this is the link the backups run over.</p>
<p>Turning the direction around would be the other way to reach a static rule. The Remote Location has a MyFRITZ
name, so the gateway could be the one that dials, and the incoming flow would meet a port forward instead of
dynamic state. I do not want a DNS name in a VPN config, though. WireGuard resolves <code>Endpoint</code> once, when the
interface comes up — a name that fails to resolve at boot, or changes later, needs yet another timer to re-resolve
it, which is the same kind of moving part I just turned down. And there is a reason &ldquo;it was DNS&rdquo; is a T-shirt —
Jeff Geerling sells a good one, <a href="https://www.jeffgeerling.com/blog/2022/it-was-dns-t-shirt-on-redshirtjeffcom/">the story behind
it</a> and
<a href="https://www.redshirtjeff.com/">the shirt</a>. DNS debugging is wild.</p>
<p>So for now the manual fix stays. The tunnel has been up since the beginning of the year, and this is the first
time it needed more than a restart. The outage cost ten minutes, the repair is one command, and every permanent
candidate either adds a moving part or a dependency I do not want on this link. A permanent fix becomes worth it
when the problem shows up more often than this.</p>
<p>If it does, the first thing to try is a fixed listening port on the Pi plus a UDP port forward for it in the
FRITZ!Box. That is also the experiment that answers the open question: does FRITZ!OS use a static rule for the
return path of a flow that was built from the inside out? The <code>tcpdump</code> on the gateway VM shows it, in the source
port of the arriving packets.</p>
<h2 id="takeaway">Takeaway</h2>
<p>A keepalive keeps a living flow alive. It does nothing for a flow whose far end disappears for the length of a
reboot, and that is exactly when a consumer router is most likely to lose track of it.</p>
<p>When the far end answers and the near end never hears the answer, stop debugging the endpoints. Both of ours
were fine the whole time; everything we needed to see was in one <code>tcpdump</code> on the near end and in the connection
tracking table on the far end.</p>
<p>Give every remote device a way in that does not depend on the thing you may have to debug. Ours is a forwarded
port on the FRITZ!Box, and it is the only reason I could run this analysis from a keyboard instead of hopping
into my car.</p>
<p>Changing the source port is a diagnosis and a cure in one move. If a new port connects instantly, the old flow
was the problem — not the keys, not the firewall, not WireGuard.</p>
<p>And a box you cannot query turns an analysis into a hypothesis. That is the real price of a consumer router in
an otherwise observable path.</p>
<p>Next time the order is clear. Read the <code>latest handshake</code> line first — if it is missing, there is no session and
everything else is noise. Then run <code>tcpdump</code> on the Pi, because the Pi is the side that has to build the
connection, and it is therefore the side that shows whether anything is coming back.</p>
<p>One thing is still missing, and this outage made it obvious: a way to force a hard reboot, a power cycle, on a
device that no longer answers at all. At the Main Location I am building that right now with Home Assistant and
switchable Zigbee sockets, for exactly this reason. At the Remote Location the first step is the devices behind
the FRITZ!Box — the VPN Raspberry Pi, the printer, whatever else sits there — and the way in we already have
covers those. The FRITZ!Box itself is the harder case, because a socket that hangs off the very router you want
to power-cycle is no help; that one would need an independent path, LoRaWAN perhaps. Not decided yet, and it will
be its own article.</p>]]></content:encoded>
    </item>
    <item>
      <title>You are not random enough</title>
      <link>https://www.ib-theis.de/en/insights/getrandom-hangs-on-rhel-8/</link>
      <guid isPermaLink="true">https://www.ib-theis.de/en/insights/getrandom-hangs-on-rhel-8/</guid>
      <pubDate>Thu, 15 Oct 2026 00:00:00 +0000</pubDate>
      <dc:creator>Gregor Theis, IB Theis GmbH</dc:creator>
      <category>rhel</category>
      <category>ansible</category>
      <category>linux</category>
      <description>Why an Ansible patch phase took 43 minutes instead of 12 seconds: scp stuck in getrandom() on RHEL 8 VMs with no entropy and no rngd running.</description>
      <content:encoded><![CDATA[<h2 id="problem">Problem</h2>
<p>At a customer site, we run patch management for the RHEL systems from Ansible playbooks. We air-gap the machines, point the YUM repos
at our internal RPM repository (JFrog Artifactory), patch the machines and generate patch reports, with some Checkmk downtime handling at
the beginning and the end. We patch in phases, database machines first, so that we get a sensible reboot order.</p>
<figure class="figure-svg">
<svg xmlns="http://www.w3.org/2000/svg" class="netmap" viewBox="0 0 960 290" width="960" height="290"
     role="img" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
     aria-label="Jenkins schedules a workflow in Ansible AWX, AWX runs the playbooks, Ansible builds a Python module and copies it to the RHEL 8 host over SFTP or SCP before running it over SSH. The copy step is the one that blocks.">
  <!-- Beschriftung bewusst als aria-label statt <title>: ein zweites <title> im Dokument verletzt Regel 13 in check.py -->
  <!-- Kette zum Artikel. Linien in currentColor (Dark Mode), Markenrot nur fuer die haengende Strecke.
       Keine style-Attribute (CSP), alles als Praesentationsattribut. -->

  <g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    <!-- die vier Stationen -->
    <rect x="15" y="80" width="160" height="110"/>
    <rect x="255" y="80" width="160" height="110"/>
    <rect x="495" y="80" width="170" height="110"/>
    <rect x="802" y="80" width="136" height="110"/>

    <!-- Hypervisor als Klammer um die Gast-VM: die Virtualisierung gehoert zum Problem -->
    <rect x="790" y="52" width="160" height="152" stroke-dasharray="5 4"/>

    <!-- Jenkins zu AWX, AWX zu Ansible -->
    <path d="M175 135 H245"/>
    <path d="M415 135 H485"/>

    <!-- zweite Strecke: Ausfuehrung ueber SSH -->
    <path d="M665 160 H796"/>
  </g>

  <!-- erste Strecke: Kopie ueber SFTP/SCP, hier bleibt es stehen -->
  <g fill="none" stroke="#FF0000" stroke-width="3" stroke-linecap="round">
    <path d="M665 112 H794"/>
  </g>
  <path d="M802 112 L786 105 L786 119 Z" fill="#FF0000"/>

  <g fill="currentColor">
    <path d="M251 135 L237 129 L237 141 Z"/>
    <path d="M491 135 L477 129 L477 141 Z"/>
    <path d="M802 160 L788 154 L788 166 Z"/>
  </g>

  <g fill="currentColor" font-size="15" font-weight="700">
    <text x="27" y="112">Jenkins</text>
    <text x="267" y="112">Ansible AWX</text>
    <text x="507" y="112">Ansible</text>
    <text x="814" y="112">RHEL 8 host</text>
  </g>

  <g fill="currentColor" font-size="12" opacity="0.75">
    <text x="798" y="72">Nutanix Hypervisor</text>
    <text x="27" y="136">Ansible Tower</text>
    <text x="27" y="154">plugin, scheduled</text>
    <text x="267" y="136">workflow and</text>
    <text x="267" y="154">job template</text>
    <text x="507" y="136">builds the Python</text>
    <text x="507" y="154">module payload</text>
    <text x="814" y="136">sshd and</text>
    <text x="814" y="154">sftp-server</text>
  </g>

  <g fill="currentColor" font-size="12" text-anchor="middle" opacity="0.75">
    <text x="210" y="124">schedules</text>
    <text x="450" y="124">runs</text>
    <text x="727" y="150">2 SSH: run it</text>
  </g>

  <g fill="#FF0000" font-size="12" font-weight="700" text-anchor="middle">
    <text x="727" y="100">1 SFTP/SCP: copy</text>
  </g>
  <g fill="#FF0000" font-size="13" text-anchor="middle">
    <text x="740" y="225">this leg blocks in getrandom()</text>
  </g>
</svg>

  <figcaption class="figure-svg__caption">The chain from the scheduled Jenkins job to the target host. Everything up to the copy is just orchestration; the hang happens on the last leg, where Ansible pushes its Python module over SFTP.</figcaption>
</figure>

<p>We were seeing strange runtimes for some of our patch phases:</p>
<img src="https://www.ib-theis.de/en/insights/getrandom-hangs-on-rhel-8/Jenkins_Prod_Patching_Strange_Times.png" alt="Jenkins stage view of the production patch pipeline: one phase takes 43 minutes, the next 9 minutes, the last one fails after 15 minutes" width="930" height="592" loading="lazy" decoding="async"><p>The playbooks were running slowly in some patch phases and on some machines. At first we suspected a networking problem.</p>
<h2 id="analysis">Analysis</h2>
<p>What follows is a short summary of the analysis. We had had this problem for months and expected it to be related
to a networking issue we are seeing (another article, maybe later). The analysis took the two of us, my friend Dariusz and me, 2.5 hours.
It was fun in the end, less so in the middle.</p>
<p>At some point we identified a patch phase that only had a few machines.</p>
<p>We ran the air-gapping job from AWX, and the first run in the morning was perfectly fine. That was confusing.</p>
<img src="https://www.ib-theis.de/en/insights/getrandom-hangs-on-rhel-8/awx_good_airgap_run.png" alt="AWX output of the first run: the whole playbook finishes in 12 seconds, every task in one or two seconds" width="1972" height="1222" loading="lazy" decoding="async"><p>For fun we ran the same job again, and the timings were bad. That was confusing as well.</p>
<img src="https://www.ib-theis.de/en/insights/getrandom-hangs-on-rhel-8/awx_bad_airgap_run.png" alt="AWX output of the second run: the same playbook takes 20 minutes 34 seconds, with single tasks at 266, 244, 243 and 216 seconds" width="2003" height="1338" loading="lazy" decoding="async"><p>We then ran the tasks from the Ansible development machine on the command line, to rule out AWX as the cause.</p>
<p>We learned quite a bit:</p>
<ul>
<li>Ansible builds a Python module that is copied to the remote machine and executed there</li>
<li>In our setup, SFTP is used to transfer it (this is configurable; we tried SCP as well)</li>
<li>sshd does not handle SFTP (or SCP, for that matter) itself; it forks a separate program</li>
<li>That scp or sftp process was the one hanging</li>
<li>We were able to reproduce the problem without Ansible with a simple scp</li>
<li>On the problematic machine multiple scp / sftp-server processes were hanging</li>
</ul>
<p>Eventually we traced &ldquo;our&rdquo; scp process on the server and found it hanging in <code>getrandom()</code>.</p>
<pre tabindex="0"><code>[root@xxxxx /etc/ssh]# ps -ef | grep scp
root      300309       1  0 12:56 ?        00:00:00 scp -f /etc/ssh/sshd_config
root      301205  284296  0 12:59 ?        00:00:00 scp -t /root/.ansible/tmp/ansible-tmp-1791975556.5008848-751264-111097114614797/AnsiballZ_setup.py
root      301557       1  0 13:00 ?        00:00:00 scp -v -f /etc/ssh/sshd_config
root      303385       1  0 13:05 ?        00:00:00 scp -v -f /etc/ssh/sshd_config
root      305692  305691  0 13:13 ?        00:00:00 scp -f /etc/ssh/sshd_config
root      306008  295457  0 13:14 pts/1    00:00:00 grep --color=auto scp
[root@xxxxx /etc/ssh]# strace -p 303385
strace: Process 303385 attached
getrandom(^Cstrace: Process 303385 detached
 &lt;detached ...&gt;
</code></pre><p>After a bit of reading, we found that the kernel did not have enough entropy:</p>
<pre tabindex="0"><code>[root@xxxxx /etc/ssh]# cat /proc/sys/kernel/random/entropy_avail
37
</code></pre><p><code>getrandom()</code> does not return as long as there is not enough entropy. We run VMs on Nutanix, and that setup does not seem to produce
enough entropy fast enough. So the server side of our copy was simply waiting.</p>
<p>Why does this hit SFTP and not an interactive login? The sshd listener is seeded once at boot, and the child
process per connection inherits that state. A fresh scp or sftp-server is a newly executed program: it
initialises its crypto library from scratch and asks the kernel for random bytes before it does anything else.
That call does come back — it just takes until the kernel has collected enough entropy, which on these VMs was
around 200 seconds. That is where the 266, 244, 243 and 216 seconds of the AWX tasks above come from, and a
patch phase with a handful of hosts adds up to 43 minutes.</p>
<p>We had the problem on RHEL 8 only, up to and including kernel 4.18.0-553.171.1.el8_10.x86_64.</p>
<p>In the end we found that out of about 80 VMs running on the Nutanix clusters in HQ, 6 were not running rngd.</p>
<p>Where rngd is running, there is always enough entropy:</p>
<pre tabindex="0"><code>[root@xxxxx ~]# cat /proc/sys/kernel/random/entropy_avail
4036
[root@xxxxx ~]#
</code></pre><h2 id="fix">Fix</h2>
<p>Install rng-tools and start the rngd service. We are running on newer hardware with a hardware random number generator in the CPUs,
and rngd feeds that data into the kernel pool. This seems to be the default on RHEL 9 and 10.</p>
<p>Running a small playbook against our servers solved the problem:</p>
<pre tabindex="0"><code>- name: Provide entropy via rngd on RHEL 8
  hosts: all
  # become: true
  remote_user: root

  tasks:
    - name: Skip hosts that are not RHEL 8
      meta: end_host
      when: not (ansible_facts[&#39;distribution&#39;] == &#39;RedHat&#39;
                 and ansible_facts[&#39;distribution_major_version&#39;] == &#39;8&#39;)

    - name: Refuse FIPS-mode hosts
      fail:
        msg: &#34;{{ inventory_hostname }} is in FIPS mode; rngd will not start there. Attach a virtio-rng device instead.&#34;
      when: ansible_facts[&#39;fips&#39;] | bool

    - name: Install rng-tools
      dnf:
        name: rng-tools
        state: present

    - name: Enable and start rngd
      systemd:
        name: rngd
        enabled: true
        state: started

    - name: Read available entropy
      ansible.builtin.slurp:
        src: /proc/sys/kernel/random/entropy_avail
      register: entropy

    - name: Report available entropy
      ansible.builtin.debug:
        msg: &#34;entropy_avail on {{ inventory_hostname }}: {{ entropy.content | b64decode | trim }} bits&#34;
</code></pre><h2 id="takeaway">Takeaway</h2>
<p>We had this problem only for RHEL 8 machines. RHEL 9 and 10 did not show this with the much newer kernels.</p>
<p>We still do not know why the problem showed up on one HQ Nutanix cluster only and not on our two local ones
(dev/test and prod, with different CPUs and different Nutanix versions). We do not run rngd on those two,
and we see no entropy problems there either.</p>
<p>I think it is time for the RHEL 8 upgrade project in 2027.</p>
<p>Once again, a deeper knowledge of sshd and Ansible would have made the debugging smoother.</p>
<p>And the old-fashioned tools like <code>strace</code> and <code>lsof</code> still work and still carry an analysis.</p>
<p>For an afternoon it was quite fun to tell my colleagues that they were &ldquo;not random enough&rdquo; :-). That
sparked several discussions.</p>]]></content:encoded>
    </item>
    <item>
      <title>WireGuard site-to-site behind a FRITZ!Box</title>
      <link>https://www.ib-theis.de/en/insights/wireguard-site-to-site-with-fritzos/</link>
      <guid isPermaLink="true">https://www.ib-theis.de/en/insights/wireguard-site-to-site-with-fritzos/</guid>
      <pubDate>Sat, 10 Oct 2026 00:00:00 +0000</pubDate>
      <dc:creator>Gregor Theis, IB Theis GmbH</dc:creator>
      <category>vpn</category>
      <category>networking</category>
      <description>A consumer router does WireGuard for clients, not for networks. A Raspberry Pi behind it joins the two sites, and FRITZ!OS 8.25 removed the last stalls.</description>
      <content:encoded><![CDATA[<h2 id="problem">Problem</h2>
<p>Two locations, one network:</p>
<ul>
<li>backups from the Remote Location to the Proxmox Backup Server at the Main Location</li>
<li>later a second step: replicate those backups from the Proxmox Backup Server at the Main Location to a
second one at the Remote Location, so the off-site copy runs in both directions</li>
<li>services reachable in both directions, name resolution that works on both ends</li>
<li>the test case that decides whether it is really one network: a laptop carried from the office to the Remote Location
should reach the CIFS filer the way it does at the desk. Same share, same path, no VPN client to start, no
drive letter to remap</li>
</ul>
<h3 id="infrastructure">Infrastructure</h3>
<p>The Remote Location sits behind a FRITZ!Box Cable 6690 on a cable connection with a dynamic address.</p>
<p>The Main Location has a business fibre connection with a static address from Händle &amp; Korte in Düsseldorf.
The internet firewall runs on a Proxmox VM.</p>
<p>I had a couple of Raspberry Pi 5s lying around, each with an NVMe SSD (NVMes are more reliable than SD cards)
and a proper enclosure (you can only ever have too few Raspis ;-)):</p>
<ul>
<li>Argon NEO 5 M.2 NVMe PCIe case (normally the fan is not running, no noise)</li>
<li>Samsung 990 EVO Plus, 1 TB NVMe M.2 SSD (I had a problem with some smaller no-name NVMes)</li>
</ul>
<h3 id="fritzos-and-site-to-site-vpn">FRITZ!OS and site-to-site VPN</h3>
<p>FRITZ!OS speaks WireGuard, so the obvious idea was to let the router do it. That is not what the feature is for.
WireGuard in FRITZ!OS is meant for client access, not for a site-to-site tunnel.</p>
<h2 id="analysis">Analysis</h2>
<p><strong>Client VPN is not a site-to-site VPN.</strong> WireGuard in FRITZ!OS is built for single devices dialling into the
home network: a laptop, a phone, one peer with one address. What a site coupling needs is a peer that carries a
whole subnet, routes it, and answers for it. The router does not do that, and bending it into shape would mean
fighting the product.</p>
<p>So the tunnel moved one hop inward: a <strong>Raspberry Pi 5</strong> on the LAN behind the FRITZ!Box terminates WireGuard and
routes the remote network. The FRITZ!Box stays what it is, a modem and a router, and forwards the tunnel.</p>
<figure class="figure-svg">
<svg xmlns="http://www.w3.org/2000/svg" class="netmap" viewBox="0 0 960 400" width="960" height="400"
     role="img" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
     aria-label="Site-to-site WireGuard: a FRITZ!Box and a Raspberry Pi at the remote site, a gateway VM and Proxmox at the main site, connected over the internet">
  <!-- Beschriftung bewusst als aria-label statt <title>: ein zweites <title> im Dokument verletzt Regel 13 in check.py -->
  <!-- Netzplan zum Artikel. Linien in currentColor (Dark Mode), Markenrot nur fuer den Tunnel.
       Keine style-Attribute (CSP), alles als Praesentationsattribut. -->

  <g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
    <!-- Standort: Remote Location -->
    <rect x="20" y="44" width="300" height="296"/>
    <!-- Standort: Main Location -->
    <rect x="640" y="44" width="300" height="296"/>

    <!-- Geraete am entfernten Standort -->
    <rect x="44" y="116" width="252" height="64"/>
    <rect x="44" y="236" width="252" height="80"/>
    <path d="M170 180 V236"/>

    <!-- Geraete am Hauptstandort -->
    <rect x="664" y="116" width="252" height="84"/>
    <rect x="664" y="236" width="252" height="80"/>
    <path d="M790 200 V236"/>

    <!-- Internet-Wolke -->
    <path d="M424 176 a30 30 0 0 1 10 -57 a38 38 0 0 1 70 -16 a32 32 0 0 1 48 20 a28 28 0 0 1 -4 53 Z"/>

    <!-- Physischer Weg: FRITZ!Box zur Wolke, Wolke zur Gateway-VM -->
    <path d="M296 148 H424"/>
    <path d="M548 148 H664"/>

    <!-- DNS-Rueckfall ins offene Internet, wenn der Hauptstandort nicht erreichbar ist -->
    <path d="M296 262 C 360 262, 380 200, 430 178" stroke-dasharray="4 6"/>
  </g>

  <!-- Tunnel: Markenrot, immer vom entfernten Standort aufgebaut -->
  <g fill="none" stroke="#FF0000" stroke-width="3" stroke-linecap="round">
    <path d="M296 290 C 430 326, 560 300, 664 184"/>
  </g>
  <path d="M664 184 L647 186 L656 197 Z" fill="#FF0000"/>

  <g fill="currentColor" font-size="17">
    <!-- Ueberschriften der Standorte -->
    <text x="36" y="74" font-weight="700">Remote Location</text>
    <text x="36" y="97" font-size="13" opacity="0.75">192.168.178.0/24</text>
    <text x="656" y="74" font-weight="700">Main Location</text>
    <text x="656" y="97" font-size="13" opacity="0.75">192.168.1.0/24, 192.168.253.0/24</text>

    <!-- Remote Location -->
    <text x="60" y="144" font-weight="700">FRITZ!Box Cable 6690</text>
    <text x="60" y="166" font-size="15" opacity="0.75">dynamic IPv4</text>
    <text x="60" y="264" font-weight="700">Raspberry Pi 5</text>
    <text x="60" y="286" font-size="15" opacity="0.75">WireGuard endpoint</text>
    <text x="60" y="306" font-size="15" opacity="0.75">Unbound resolver</text>

    <!-- Main Location -->
    <text x="680" y="144" font-weight="700">Gateway VM</text>
    <text x="680" y="166" font-size="15" opacity="0.75">firewall, WireGuard</text>
    <text x="680" y="186" font-size="15" opacity="0.75">185.6.68.20, static</text>
    <text x="680" y="264" font-weight="700">Proxmox</text>
    <text x="680" y="286" font-size="15" opacity="0.75">Backup Server, services</text>
    <text x="680" y="306" font-size="15" opacity="0.75">internal resolver</text>

    <!-- Wolke und Strecken -->
    <text x="452" y="155" font-size="15">Internet</text>
    <text x="348" y="270" font-size="14" opacity="0.75">DNS fallback</text>
  </g>

  <g fill="#FF0000" font-size="15" font-weight="700">
    <text x="396" y="338">WireGuard, UDP, MTU 1420</text>
  </g>
  <g fill="currentColor" font-size="14" opacity="0.75">
    <text x="396" y="358">10.254.0.0/30, always dialled from the remote site</text>
  </g>
</svg>

  <figcaption class="figure-svg__caption">Both sites in one picture: the FRITZ!Box routes, the Raspberry Pi carries the tunnel, and the gateway VM at the Main Location is the fixed endpoint.</figcaption>
</figure>

<p><strong>The subnets have to be different, and that is where most couplings die.</strong> Every FRITZ!Box leaves the
factory on 192.168.178.0/24, so two of them joined by a tunnel share a network and nothing routes.
On a FRITZ!Box the local network is changed in a minute, so fix it before you build the tunnel. At scale the
same problem gets expensive: when two companies merge and both run 10.0.0.0/8 with overlapping ranges, you end
up with NAT and PAT between the sites. Avoid that if you can. When Vodafone bought Kabel Deutschland, both
sides were running 10.0.0.0/8.</p>
<p>The Remote Location kept the default; the Main Location runs 192.168.1.0/24, 192.168.253.0/24 and
192.168.254.0/24 for roaming clients, and the tunnel itself sits in 10.254.0.0/30. No overlap anywhere, and the laptop from the
office keeps its CIFS share because the server address it knows exists only once in the whole setup. If both
ends do collide, renumber one site before you build the tunnel. NAT between the two would paper over it and
break every service that carries an address inside the protocol.</p>
<p><strong>Who dials whom follows from the addresses.</strong> The Main Location has the static address, so it is the
endpoint. The Remote Location has a dynamic one, so it is always the initiator. That also keeps IPv6 out of the picture, which was
a deliberate choice here: one address family, one set of rules, fewer things that can behave differently at three
in the morning.</p>
<p><strong>One thing I noticed on the side, and it is the reason for the thank-you note at the end.</strong> The link worked, but a
manual ping only tells you about the second you are looking at. Smokeping runs all day, from the Remote
Location to the Main Location, and plots latency and loss over weeks. In that graph a pattern showed up: short spikes with
occasional loss, clustered in periods when the link had been idle, and never while the backup was running.</p>
<img src="https://www.ib-theis.de/en/insights/wireguard-site-to-site-with-fritzos/smokeping_before_825.png" alt="Smokeping graph before FRITZ!OS 8.25: latency around 17 ms with wide grey jitter bands and a steady trickle of packet loss" width="725" height="447" loading="lazy" decoding="async"><p>Over that window the probe reported 0.15 percent average loss with peaks of 2.34 percent. Small enough to
miss, large enough to drop the first packet of a new SSH session.</p>
<p><strong>MTU turned out to be a non-issue.</strong> The tunnel runs at 1420 bytes, the usual value for WireGuard over a 1500
byte path, and nothing had to be clamped or tuned: the devices on both sides discover the path MTU and adapt.
Worth stating, because MTU is the first thing everyone blames when a tunnel feels slow. And MTU cannot
explain packet loss on small ICMP echo packets anyway.</p>
<p><strong>DNS deserved its own thought.</strong> Resolution must not depend on the tunnel being up. The Pi runs Unbound as the
resolver for the Remote Location. It forwards to the resolver at the Main Location over the tunnel, so internal
names resolve and answers are cached locally. If the Main Location is unreachable, it falls back to resolving from the public DNS on its
own. The site keeps working; only the internal names are gone, which is exactly what you want.</p>
<h2 id="fix">Fix</h2>
<h3 id="wireguard">WireGuard</h3>
<p>A running link seen from the gateway VM at the Main Location. Keys, the dynamic address and the port numbers are
redacted; the three <code>&lt;port&gt;</code> placeholders are not necessarily the same number:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">grethe@gateway:$ sudo wg show
</span></span><span class="line"><span class="cl">interface: wg0
</span></span><span class="line"><span class="cl">  public key: &lt;public key of the gateway VM&gt;
</span></span><span class="line"><span class="cl">  private key: (hidden)
</span></span><span class="line"><span class="cl">  listening port: &lt;port&gt;
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">peer: &lt;public key of the Raspberry Pi&gt;
</span></span><span class="line"><span class="cl">  endpoint: &lt;dynamic address of the remote site&gt;:&lt;port&gt;
</span></span><span class="line"><span class="cl">  allowed ips: 10.254.0.2/32, 192.168.178.0/24
</span></span><span class="line"><span class="cl">  latest handshake: 1 minute, 8 seconds ago
</span></span><span class="line"><span class="cl">  transfer: 1.32 GiB received, 101.97 MiB sent
</span></span><span class="line"><span class="cl">  persistent keepalive: every 25 seconds
</span></span></code></pre></div><p>The configuration on the Raspberry Pi, the side that dials:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-ini" data-lang="ini"><span class="line"><span class="cl"><span class="na">grethe@vpn-remote:~ $ sudo cat /etc/wireguard/wg0.conf</span>
</span></span><span class="line"><span class="cl"><span class="k">[Interface]</span>
</span></span><span class="line"><span class="cl"><span class="na">Address</span> <span class="o">=</span> <span class="s">10.254.0.2/30</span>
</span></span><span class="line"><span class="cl"><span class="na">PrivateKey</span> <span class="o">=</span> <span class="s">&lt;private key of the Raspberry Pi&gt;</span>
</span></span><span class="line"><span class="cl"><span class="na">ListenPort</span> <span class="o">=</span> <span class="s">&lt;port&gt;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">[Peer]</span>
</span></span><span class="line"><span class="cl"><span class="na">PublicKey</span> <span class="o">=</span> <span class="s">&lt;public key of the gateway VM&gt;</span>
</span></span><span class="line"><span class="cl"><span class="na">Endpoint</span> <span class="o">=</span> <span class="s">185.6.68.20:&lt;port&gt;</span>
</span></span><span class="line"><span class="cl"><span class="na">AllowedIPs</span> <span class="o">=</span> <span class="s">192.168.1.0/24, 192.168.253.0/24, 192.168.254.0/24, 10.254.0.1/32</span>
</span></span><span class="line"><span class="cl"><span class="na">PersistentKeepalive</span> <span class="o">=</span> <span class="s">25</span>
</span></span></code></pre></div><p>And the matching peer on the gateway VM, which has no <code>Endpoint</code> line because it only ever waits:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-ini" data-lang="ini"><span class="line"><span class="cl"><span class="c1"># Gateway VM at the Main Location: the endpoint</span>
</span></span><span class="line"><span class="cl"><span class="k">[Peer]</span>
</span></span><span class="line"><span class="cl"><span class="na">PublicKey</span>  <span class="o">=</span> <span class="s">&lt;public key of the Raspberry Pi&gt;</span>
</span></span><span class="line"><span class="cl"><span class="na">AllowedIPs</span> <span class="o">=</span> <span class="s">10.254.0.2/32, 192.168.178.0/24</span>
</span></span></code></pre></div><p>Three details matter more than the key exchange. <code>AllowedIPs</code> has to list the remote network, not just the
tunnel address, or packets are encrypted but never routed. Both sides need forwarding enabled and a route to the
other subnet, which on the FRITZ!Box side means a static route pointing at the Pi. And the initiator sets
<code>PersistentKeepalive</code>, because an idle UDP flow through a consumer router is a flow that may quietly disappear.
That last part turned out to be only half the truth — what happened after a reboot of the main server is in
<a href="https://www.ib-theis.de/en/insights/wireguard-tunnel-back-on-a-new-port/">The tunnel that only came back on a new port</a>.</p>
<h3 id="fritzbox-settings">FRITZ!Box settings</h3>
<p>Two settings in the FRITZ!Box do the rest. The static routes send the networks of the Main Location and
the tunnel network to the Raspberry Pi, so every device at the Remote Location reaches the other site without knowing about the
tunnel:</p>
<img src="https://www.ib-theis.de/en/insights/wireguard-site-to-site-with-fritzos/network_routes_fritz_remote.png" alt="FRITZ!Box static routes pointing the networks of the Main Location at the Raspberry Pi" width="1540" height="774" loading="lazy" decoding="async"><p>And the DHCP server hands out the Pi as the local DNS server, which is how Unbound ends up in front of every
client in the house:</p>
<img src="https://www.ib-theis.de/en/insights/wireguard-site-to-site-with-fritzos/dns_server_to_unbound_locally.png" alt="FRITZ!Box IPv4 settings: the local DNS server is set to the Raspberry Pi running Unbound" width="1550" height="976" loading="lazy" decoding="async"><p>The FRITZ!Box DHCP server hands out fritz.box as the DNS search path. For CIFS shares on a Windows laptop
that means mapping the share with an FQDN. Worst case, edit <code>C:\Windows\system32\drivers\etc\hosts</code> on the
client to work around it; filer addresses do not change that often. In general, FQDNs are your friend.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">C:\Users\grethe&gt;net use
</span></span><span class="line"><span class="cl">Neue Verbindungen werden gespeichert.
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Status       Lokal     Remote                    Netzwerk
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">-------------------------------------------------------------------------------
</span></span><span class="line"><span class="cl">OK           H:        \\diskserv.ib-theis.de\grethe
</span></span><span class="line"><span class="cl">                                                Microsoft Windows Network
</span></span><span class="line"><span class="cl">...
</span></span></code></pre></div><h3 id="unbound-settings">Unbound settings</h3>
<p>The Unbound settings took a little while to figure out. The FRITZ!Box did not like my first attempt at
forwarding, which <code>domain-insecure</code> sorted out. This is still kind of a hack, but it works.</p>
<p>The goal was a DNS server that resolves ib-theis.de and some reverse zones through the resolver at
the Main Location and sends everything else to the FRITZ!Box at the Remote Location, which serves fritz.box and the
192.168.178.0/24 reverse zone.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">grethe@vpn-remote:~ $ cat /etc/unbound/unbound.conf.d/vpn-forward.conf
</span></span><span class="line"><span class="cl">server:
</span></span><span class="line"><span class="cl">  interface: 0.0.0.0
</span></span><span class="line"><span class="cl">  port: 53
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  access-control: 127.0.0.1 allow
</span></span><span class="line"><span class="cl">  access-control: 192.168.178.0/24 allow
</span></span><span class="line"><span class="cl">  access-control: 192.168.1.0/24 allow
</span></span><span class="line"><span class="cl">  access-control: 192.168.253.0/24 allow
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  hide-identity: yes
</span></span><span class="line"><span class="cl">  hide-version: yes
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  cache-min-ttl: 300
</span></span><span class="line"><span class="cl">  cache-max-ttl: 86400
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  local-zone: &#34;168.192.in-addr.arpa.&#34; nodefault
</span></span><span class="line"><span class="cl">  local-zone: &#34;10.in-addr.arpa.&#34; nodefault
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  domain-insecure: &#34;fritz.box&#34;
</span></span><span class="line"><span class="cl">  domain-insecure: &#34;box&#34;
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">  verbosity: 4
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># Internal domain via the Main Location
</span></span><span class="line"><span class="cl">forward-zone:
</span></span><span class="line"><span class="cl">  name: &#34;ib-theis.de&#34;
</span></span><span class="line"><span class="cl">  forward-addr: 192.168.1.1
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># Reverse DNS via the Main Location
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># 192.168.1.0/24
</span></span><span class="line"><span class="cl">forward-zone:
</span></span><span class="line"><span class="cl">  name: &#34;1.168.192.in-addr.arpa&#34;
</span></span><span class="line"><span class="cl">  forward-addr: 192.168.1.1
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># 192.168.253.0/24
</span></span><span class="line"><span class="cl">forward-zone:
</span></span><span class="line"><span class="cl">  name: &#34;253.168.192.in-addr.arpa&#34;
</span></span><span class="line"><span class="cl">  forward-addr: 192.168.1.1
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># 192.168.254.0/24 (the roaming clients)
</span></span><span class="line"><span class="cl">forward-zone:
</span></span><span class="line"><span class="cl">  name: &#34;254.168.192.in-addr.arpa&#34;
</span></span><span class="line"><span class="cl">  forward-addr: 192.168.1.1
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># The site-to-site tunnel network
</span></span><span class="line"><span class="cl">forward-zone:
</span></span><span class="line"><span class="cl">  name: &#34;0.254.10.in-addr.arpa&#34;
</span></span><span class="line"><span class="cl">  forward-addr: 192.168.1.1
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"># Everything else: the FRITZ!Box at the Remote Location (fast local DNS)
</span></span><span class="line"><span class="cl">forward-zone:
</span></span><span class="line"><span class="cl">  name: &#34;.&#34;
</span></span><span class="line"><span class="cl">  forward-addr: 192.168.178.1
</span></span></code></pre></div><p>The <code>verbosity: 4</code> is on purpose: this part is still under observation and the log is where the answers
are. Turn it down to 1 once the setup has settled, otherwise the resolver writes more than anyone reads.</p>
<h3 id="fritzos-825-and-no-more-packet-loss">FRITZ!OS 8.25 and no more packet loss</h3>
<p>Then came <strong>FRITZ!OS 8.25</strong>, and the stalls stopped. The Smokeping graph is flat where it used to spike and
drop packets. Honesty requires saying what this is and is not: the symptom is gone, and I did not chase the cause further.
Something in the path handles idle connections better than before. The release notes from AVM mention network
improvements without going into detail, and the fix may well sit in the closed part of the firmware. I did not
dig any deeper.</p>
<p>Thank you, AVM.</p>
<img src="https://www.ib-theis.de/en/insights/wireguard-site-to-site-with-fritzos/smokeping_after_825.png" alt="Smokeping graph after FRITZ!OS 8.25: the same latency band, packet loss at zero across the whole window" width="733" height="441" loading="lazy" decoding="async"><p>Loss is 0.00 percent for average, maximum and current. The baseline latency differs between the two windows,
16.6 ms over weeks against 21.0 ms over an afternoon, so do not read a speed-up into the numbers. What changed
is the loss column.</p>
<h3 id="still-on-the-list">Still on the list</h3>
<p>Two gaps are open, both of the kind that only hurt when nobody is on site:</p>
<ul>
<li><strong>A UPS at the Remote Location</strong> for the FRITZ!Box and the Raspberry Pi. A short power cut currently takes out the
tunnel, the local resolver and the routing in one go, and nothing comes back before the cable modem has
synced again.</li>
<li><strong>A way to power cycle both devices remotely</strong>, planned as switchable Zigbee sockets driven by Home Assistant.
A hung FRITZ!Box or an unresponsive Pi should not need someone to drive to the house and pull a plug.</li>
</ul>
<h2 id="takeaway">Takeaway</h2>
<p>Measure continuously, or you will not know. The backup to the Proxmox Backup Server ran fine the whole time, and
daily work gave no reason to look; only a graph that had been running for weeks showed the weakness. And treat
the consumer router in the path as part of the system: it is not just a modem, its firmware belongs in the
maintenance window like everything else. Running something similar? <a href="https://www.ib-theis.de/en/contact/">Contact us</a>.</p>]]></content:encoded>
    </item>
  </channel>
</rss>
