<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[sysxplore]]></title><description><![CDATA[Download my Bash Scripting Handbook on newsletter signup for FREE]]></description><link>https://blog.sysxplore.com</link><image><url>https://substackcdn.com/image/fetch/$s_!dg1-!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F03f31e36-0026-4079-91a9-cceae57906b1_1280x1280.png</url><title>sysxplore</title><link>https://blog.sysxplore.com</link></image><generator>Substack</generator><lastBuildDate>Mon, 26 Oct 2026 03:59:54 GMT</lastBuildDate><atom:link href="https://blog.sysxplore.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[TRÄW🤟]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[sysxplore@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[sysxplore@substack.com]]></itunes:email><itunes:name><![CDATA[TRÄW🤟]]></itunes:name></itunes:owner><itunes:author><![CDATA[TRÄW🤟]]></itunes:author><googleplay:owner><![CDATA[sysxplore@substack.com]]></googleplay:owner><googleplay:email><![CDATA[sysxplore@substack.com]]></googleplay:email><googleplay:author><![CDATA[TRÄW🤟]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[EP5: Networking in Linux - A Detailed Guide to VPN Kill Switches]]></title><description><![CDATA[In the previous article, we followed a packet through a VPN tunnel and saw how WireGuard encrypts and encapsulates our traffic before sending it over the physical network.]]></description><link>https://blog.sysxplore.com/p/ep4-networking-in-linux-a-detailed-guide-on-vpn-killswitches</link><guid isPermaLink="false">https://blog.sysxplore.com/p/ep4-networking-in-linux-a-detailed-guide-on-vpn-killswitches</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Tue, 20 Oct 2026 16:26:52 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c98a33c7-4547-4d21-8f6e-1ad6562954d2_2000x800.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the <a href="https://blog.sysxplore.com/p/ep4-networking-in-linux-life-of-a-packet-through-a-vpn">previous article</a>, we followed a packet through a VPN tunnel and saw how WireGuard encrypts and encapsulates our traffic before sending it over the physical network.</p><p>But there&#8217;s one question we left unanswered.</p><p>What happens if the VPN connection suddenly goes down?</p><p>Under normal circumstances, Linux can reach the internet through our physical network interface. If the VPN tunnel disappears, what&#8217;s stopping Linux from simply using that interface again and sending our traffic outside the VPN?</p><p>That&#8217;s the problem a VPN kill switch is designed to solve.</p><p>In this final part of our Networking in Linux series, we&#8217;re going to investigate how Proton VPN&#8217;s Standard Kill Switch works under the hood.</p><p>We&#8217;ll look at what happens when the VPN server becomes unreachable, when the tunnel interface disappears unexpectedly, and when we deliberately disconnect from the VPN.</p><p>Along the way, we&#8217;ll examine a few Linux routing tables and network interfaces to understand how the kill switch prevents our internet traffic from falling back to the physical network.</p><p>Let&#8217;s get started.</p><h2>The Kill Switch Interface</h2><p>We&#8217;re using Proton VPN on Fedora Linux, with the Standard Kill Switch enabled. If you haven&#8217;t installed Proton VPN yet, you can <a href="https://go.getproton.me/aff_ad?campaign_id=3559&amp;aff_id=20104">download it here</a>.</p><p>Let&#8217;s start by looking at the network interfaces on our machine.</p><pre><code><code>$ ip -br addr
enp2s0        UP       172.16.1.14/24
wlp3s0        UP       192.168.8.53/24
proton0       UNKNOWN  10.2.0.2/32
pvpnksintrf0  UNKNOWN  100.85.0.1/24</code></code></pre><p>We already know <code>proton0</code> from our previous articles. It&#8217;s the WireGuard tunnel interface through which our VPN traffic travels.</p><p>But there&#8217;s another interface here: <code>pvpnksintrf0</code>.</p><p>This is a dummy interface created by Proton VPN&#8217;s kill switch. Unlike our Ethernet interface or WireGuard tunnel, it doesn&#8217;t provide a path to another network. It&#8217;s effectively a dead end for packets routed through it.</p><p>Why would we want that?</p><p>Let&#8217;s look at our routing table.</p><pre><code><code>$ ip route
default via 100.85.0.1 dev pvpnksintrf0 metric 98
default via 172.16.1.1 dev enp2s0 metric 100
default via 192.168.8.1 dev wlp3s0 metric 600</code></code></pre><p>Notice something interesting.</p><p>Our Ethernet and Wi-Fi connections both have valid default routes to the internet. But Proton VPN has installed another default route through <code>pvpnksintrf0</code>, with a metric of <strong>98</strong>.</p><p>Linux prefers the default route with the lowest metric, so this dummy route takes priority over Ethernet (100) and Wi-Fi (600).</p><p>Does that mean our internet traffic is being discarded even while the VPN is connected?</p><p>Not quite.</p><p>As we explored in the first article, Proton VPN also uses policy routing to direct ordinary internet traffic through <code>proton0</code>. That routing decision happens before the system falls back to the default route through our dummy interface.</p><p>We can confirm this:</p><pre><code><code>$ ip route get 1.1.1.1
1.1.1.1 dev proton0 table 245447468 src 10.2.0.2</code></code></pre><p>Our packet is still going through the VPN tunnel.</p><p>The dummy interface is there as a safety net. If the VPN tunnel disappears and its policy routes are removed, the preferred default route still points to <code>pvpnksintrf0</code> rather than our physical network.</p><p>Instead of sending ordinary internet traffic directly through Ethernet, Linux sends it into a dead end.</p><p>That&#8217;s the basic idea behind the Standard Kill Switch on our Linux system.</p><h2>A quick word From our Sponsor</h2><p>This article is made possible by Proton VPN.</p><p>Proton VPN has apps for Linux, Windows, macOS, Android, iOS, and more, plus a Linux CLI for those who prefer the terminal. Its apps are open source and independently audited, and it supports multiple VPN protocols, including WireGuard, OpenVPN, and its own Stealth protocol.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YSDN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YSDN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 424w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 848w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1272w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png" width="975" height="408" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:408,&quot;width&quot;:975,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:295364,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:&quot;&quot;,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!YSDN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 424w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 848w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1272w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Proton has also provided an exclusive discount for SYSXPLORE readers:<strong>65% off the 2-year VPN Plus plan </strong>or <strong>55% off the 1-year VPN Plus plan </strong>when you sign up through the link below.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://go.getproton.me/aff_ad?campaign_id=3559&amp;aff_id=20104&quot;,&quot;text&quot;:&quot;Try Proton VPN&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://go.getproton.me/aff_ad?campaign_id=3559&amp;aff_id=20104"><span>Try Proton VPN</span></a></p><p><em><strong>If the link doesn&#8217;t open, your ad blocker may be blocking it. Temporarily disable it and try again.</strong></em></p><p>Now, let&#8217;s see what happens when things start going wrong.</p><h2>What Happens When the VPN Server Becomes Unreachable?</h2><p>Let&#8217;s start with a common failure scenario.</p><p>Our VPN is connected, everything is working normally, and then the VPN server suddenly stops responding.</p><p>You might expect Linux to notice the connection failure, abandon the tunnel, and start sending traffic through Ethernet.</p><p>But that&#8217;s not what happens.</p><p>To simulate this, we can temporarily block outgoing WireGuard traffic to our VPN server using an <code>nftables</code> rule.</p><pre><code><code>sudo nft add table inet vpn_test
sudo nft 'add chain inet vpn_test output { type filter hook output priority 0; policy accept; }'
sudo nft add rule inet vpn_test output ip daddr 31.13.189.226 udp dport 443 drop</code></code></pre><p>This prevents our machine from reaching the VPN server (<code>31.13.189.226</code>) over its WireGuard transport connection, without deliberately disconnecting the VPN.</p><p>Now, here&#8217;s the interesting part.</p><p>Even though the server is unreachable, the <code>proton0</code> interface remains available, and Linux continues routing ordinary internet traffic through it.</p><pre><code><code>$ ip route get 1.1.1.1
1.1.1.1 dev proton0 table 245447468 src 10.2.0.2</code></code></pre><p>From Linux&#8217;s perspective, the route still exists. WireGuard continues accepting packets, encrypting them, and attempting to send them through the tunnel.</p><p>But because communication with the server is blocked, those packets cannot reach their destination.</p><p>The result? Our internet connection stops working.</p><p>Importantly, Linux doesn&#8217;t automatically switch to the Ethernet default route simply because the VPN server isn&#8217;t responding.</p><p>And that&#8217;s an important distinction: <strong>a VPN server becoming unreachable isn&#8217;t the same thing as the VPN interface disappearing.</strong></p><p>In this scenario, the tunnel remains configured, so our traffic continues to follow the VPN route, even though the connection is effectively broken.</p><p>But what happens if the VPN connection itself is deactivated and its routes disappear?</p><p>That&#8217;s where our dummy interface becomes particularly useful.</p><h2>When the VPN Connection Disappears</h2><p>Now let&#8217;s take things a step further.</p><p>Instead of making the VPN server unreachable, what happens if the VPN connection itself is deactivated?</p><p>To find out, we can use NetworkManager to bring down the WireGuard connection without issuing a normal disconnect command through Proton VPN.</p><pre><code><code>sudo nmcli connection down proton0</code></code></pre><p>This removes the active VPN connection, including the routing rules that previously directed our internet traffic through <code>proton0</code>.</p><p>Under normal circumstances, Linux would fall back to another available default route, such as the one through <code>enp2s0</code>.</p><p>But remember the dummy interface we discovered earlier?</p><p>Let&#8217;s see where Linux sends our traffic now.</p><pre><code><code>$ ip route get 1.1.1.1
1.1.1.1 via 100.85.0.1 dev pvpnksintrf0</code></code></pre><p>There it is.</p><p>With the VPN routing rules gone, Linux consults its main routing table. And because the dummy interface has a lower default-route metric than Ethernet or Wi-Fi, it becomes the preferred path.</p><p>But <code>pvpnksintrf0</code> doesn&#8217;t actually forward packets anywhere.</p><p>So what happens to the traffic?</p><p>Any ordinary internet traffic that would otherwise fall back to Ethernet or Wi-Fi is instead directed to <code>pvpnksintrf0</code>, where it gets dropped.</p><p>The same fallback protection applies to IPv6 traffic.</p><p>In other words, Linux still has working physical network connections and valid gateways, but ordinary internet traffic is being directed into an interface that can&#8217;t deliver it.</p><p>That&#8217;s the kill switch doing its job.</p><p>And notice that we don&#8217;t need to block every destination with individual firewall rules. In this implementation, Proton VPN uses Linux&#8217;s existing routing mechanisms to prevent ordinary internet traffic from falling back to the physical network.</p><p>As long as that dummy default route remains in place, losing the VPN tunnel doesn&#8217;t automatically mean losing the protection.</p><p>But what if the WireGuard interface itself is deleted?</p><p>Let&#8217;s find out.</p><h2>What Happens If the VPN Interface Is Deleted?</h2><p>So far, we&#8217;ve seen what happens when the VPN server becomes unreachable and when the VPN connection is deactivated.</p><p>But let&#8217;s try something different.</p><p>What if the WireGuard interface itself suddenly disappears?</p><p>We can simulate this by deleting <code>proton0</code> directly:</p><pre><code><code>sudo ip link delete proton0</code></code></pre><p>Unlike the previous scenario, we&#8217;re not asking NetworkManager to deactivate the VPN connection. We&#8217;re removing the network interface underneath it.</p><p>You might expect the VPN to remain broken until we manually reconnect.</p><p>But something interesting happens.</p><p>NetworkManager detects that the interface has disappeared and automatically recreates <code>proton0</code>.</p><p>During that brief interruption, traffic that would otherwise fall back to our physical network is directed to the dummy interface, where it gets dropped.</p><p>Here&#8217;s how it works:</p><ol><li><p>The <code>proton0</code> interface disappears.</p></li><li><p>Traffic temporarily loses its route through the VPN tunnel.</p></li><li><p>The dummy interface catches packets during the interruption.</p></li><li><p>NetworkManager recreates <code>proton0</code>, restoring the VPN route.</p></li></ol><p>The important part isn&#8217;t how quickly NetworkManager recreates the interface.</p><p>It&#8217;s what happens <strong>between the interface disappearing and coming back</strong>.</p><p>Our ordinary internet traffic doesn&#8217;t fall back to Ethernet. The dummy route provides a dead end while the VPN connection is being restored.</p><p>This is exactly the kind of unexpected interruption a kill switch is designed to handle.</p><p>But there&#8217;s one final scenario we haven&#8217;t explored.</p><p>What happens when we intentionally disconnect from Proton VPN?</p><p>Does the kill switch continue blocking our internet connection?</p><h2>What Happens When We Disconnect Intentionally?</h2><p>There&#8217;s one important distinction we need to make.</p><p>So far, we&#8217;ve been looking at unexpected VPN connection failures.</p><p>But what happens when we disconnect normally?</p><p>Let&#8217;s try it using Proton VPN&#8217;s CLI.</p><pre><code><code>protonvpn disconnect</code></code></pre><p>This time, the behavior is different.</p><p>Proton VPN removes the WireGuard connection and the dummy interface used by its Standard Kill Switch.</p><p>With <code>proton0</code> and <code>pvpnksintrf0</code> gone, Linux can once again use the default route through our physical network interface.</p><pre><code><code>$ ip route get 1.1.1.1
1.1.1.1 via 172.16.1.1 dev enp2s0</code></code></pre><p>Our normal internet connectivity is restored.</p><p>And that&#8217;s intentional.</p><p>Proton VPN&#8217;s Standard Kill Switch is designed to prevent accidental exposure when the VPN connection fails unexpectedly. It isn&#8217;t meant to keep your internet connection blocked after you&#8217;ve deliberately disconnected from the VPN.</p><p>Proton VPN also offers an <strong>Advanced Kill Switch</strong>, which can continue blocking internet access even when the VPN is manually disconnected. That provides a different level of protection, but it&#8217;s beyond the scope of this guide.</p><p>And with that, we&#8217;ve seen how the Standard Kill Switch behaves across several different scenarios: a healthy VPN connection, an unreachable server, a deactivated tunnel, a deleted interface, and finally, an intentional disconnect.</p><h2>Putting It All Together</h2><p>So, what have we learned?</p><p>A VPN kill switch doesn&#8217;t necessarily need to inspect every packet or block traffic using firewall rules.</p><p>As we&#8217;ve seen with Proton VPN&#8217;s Standard Kill Switch on Linux, routing alone can provide an effective way to prevent ordinary internet traffic from escaping when the VPN connection fails.</p><p>When the VPN is connected, policy routing directs our traffic through <code>proton0</code>. If the VPN server becomes unreachable, that traffic continues following the tunnel route rather than automatically switching to Ethernet.</p><p>And if the VPN connection disappears entirely, the dummy interface <code>pvpnksintrf0</code> provides a fallback route that leads nowhere.</p><p>That&#8217;s the clever part.</p><p><strong>Instead of removing our physical internet connection, the kill switch changes where Linux tries to send our traffic.</strong></p><p>Our Ethernet and Wi-Fi interfaces can remain connected, and their gateways can still be reachable. But ordinary internet traffic won&#8217;t simply fall back to those interfaces when the VPN fails.</p><p>And when we intentionally disconnect, Proton VPN removes the Standard Kill Switch and restores normal routing.</p><p>Of course, this doesn&#8217;t mean every VPN implements its kill switch in exactly the same way. Some rely on firewall rules, while others use routing mechanisms or a combination of both.</p><p>But the underlying goal remains the same: prevent traffic that should travel through the VPN from accidentally leaving through an unprotected connection.</p><p>And that brings us to the end of our three-part <em>VPNs In Linux</em> series.</p><p>We started by exploring how VPN tunnels work, followed a packet through the tunnel to understand encapsulation and encryption, and finally investigated what happens when that tunnel fails.</p><p>Hopefully, the next time you connect to a VPN, you&#8217;ll have a much clearer picture of what&#8217;s happening underneath.</p><p>Thanks for reading, and keep exploring!</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[EP4: Networking in Linux - Life of a Packet Through a VPN]]></title><description><![CDATA[In the previous article, we followed our Internet traffic as far as proton0.]]></description><link>https://blog.sysxplore.com/p/ep4-networking-in-linux-life-of-a-packet-through-a-vpn</link><guid isPermaLink="false">https://blog.sysxplore.com/p/ep4-networking-in-linux-life-of-a-packet-through-a-vpn</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Thu, 08 Oct 2026 15:43:37 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0fe9ff3d-063f-4496-ba0e-bd081602940e_2000x800.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><a href="https://blog.sysxplore.com/p/ep3-networking-in-linux-how-vpns">In the previous article</a>, we followed our Internet traffic as far as <code>proton0</code>.</p><p>Linux had made its routing decision:</p><pre><code><code>1.1.1.1 dev proton0 table 245447468 src 10.2.0.2</code></code></pre><p>This time, we&#8217;re going to continue from there.</p><p>We&#8217;ll follow that traffic through the WireGuard tunnel and examine what happens along the way. We&#8217;ll look at encryption and encapsulation, break apart the inner and outer IP packets, and capture traffic on both <code>proton0</code> and our physical <code>enp2s0</code> interface to see what each side of the tunnel actually looks like.</p><p>We&#8217;ll also finally come back to these two rules:</p><pre><code><code>31618:  from all lookup main suppress_prefixlength 0
31619:  not from all fwmark 0xea13b2c lookup 245447468</code></code></pre><p>We deliberately left them partially unexplained before because their purpose becomes much clearer once we can see the packet that WireGuard creates.</p><p>So let&#8217;s continue our investigation and see what happens after a packet enters <code>proton0</code>.</p><h2>Looking Inside <code>proton0</code></h2><p>We know Linux has selected <code>proton0</code> for our packet. So let&#8217;s take a closer look at what is actually behind this interface.</p><p>Since <code>proton0</code> is a WireGuard interface, we can inspect it using:</p><pre><code><code>$ sudo wg show</code></code></pre><p>On my machine, this gives us:</p><pre><code><code>interface: proton0
  public key:[redacted]
  private key: (hidden)
  listening port: 38001
  fwmark: 0xea13b2c

peer:[redacted]
  endpoint: 62.93.176.129:443
  allowed ips: 0.0.0.0/0, ::/0
  latest handshake: 18 seconds ago
  transfer: 2.22 GiB received, 172.72 MiB sent</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!urpq!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!urpq!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png 424w, https://substackcdn.com/image/fetch/$s_!urpq!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png 848w, https://substackcdn.com/image/fetch/$s_!urpq!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png 1272w, https://substackcdn.com/image/fetch/$s_!urpq!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!urpq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png" width="1456" height="746" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:746,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:101040,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!urpq!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png 424w, https://substackcdn.com/image/fetch/$s_!urpq!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png 848w, https://substackcdn.com/image/fetch/$s_!urpq!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png 1272w, https://substackcdn.com/image/fetch/$s_!urpq!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4c04a4c9-042f-417a-890b-b92ce81ca835_1600x820.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>There are a few interesting things here.</p><p>First, we can see that <code>proton0</code> is indeed being handled by WireGuard.</p><p>We also have a peer, and that peer has an endpoint:</p><pre><code><code>endpoint: 62.93.176.129:443</code></code></pre><p>That gives us something we didn&#8217;t have before: an actual IP address on the physical Internet that WireGuard is communicating with.</p><p>We can also see the same <code>fwmark</code> that appeared in our policy-routing rules:</p><pre><code><code>fwmark: 0xea13b2c</code></code></pre><p>Remember this value. We&#8217;re going to come back to it shortly.</p><p>For now, though, the endpoint gives us a more immediate question.</p><p>Our original packet is destined for <code>1.1.1.1</code>, but WireGuard is communicating with <code>62.93.176.129</code>.</p><p>So why are there suddenly <strong>two different destinations involved?</strong></p><p>To answer that, we need to look at the packet that enters the tunnel.</p><h2>A quick word From our Sponsor</h2><p>This article is made possible by Proton VPN.</p><p>Proton VPN has apps for Linux, Windows, macOS, Android, iOS, and more, plus a Linux CLI for those who prefer the terminal. Its apps are open source and independently audited, and it supports multiple VPN protocols, including WireGuard, OpenVPN, and its own Stealth protocol.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YSDN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YSDN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 424w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 848w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1272w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png" width="975" height="408" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:408,&quot;width&quot;:975,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:295364,&quot;alt&quot;:&quot;&quot;,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" title="" srcset="https://substackcdn.com/image/fetch/$s_!YSDN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 424w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 848w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1272w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Proton has also provided an exclusive discount for SYSXPLORE readers:<strong>65% off the 2-year VPN Plus plan </strong>or <strong>55% off the 1-year VPN Plus plan </strong>when you sign up through the link below.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://go.getproton.me/aff_ad?campaign_id=3559&amp;aff_id=20104&quot;,&quot;text&quot;:&quot;Try Proton VPN&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://go.getproton.me/aff_ad?campaign_id=3559&amp;aff_id=20104"><span>Try Proton VPN</span></a></p><p><em><strong>If the link doesn&#8217;t open, your ad blocker may be blocking it. Temporarily disable it and try again.</strong></em></p><p></p><p>Now, back to where we left off.</p><h2>The Packet That Enters the Tunnel</h2><p>Let&#8217;s start with the packet Linux is sending into <code>proton0</code>.</p><p>From our earlier route lookup, Linux told us:</p><pre><code><code>1.1.1.1 dev proton0 table 245447468 src 10.2.0.2</code></code></pre><p>So, focusing only on the IP header for now, our packet has these two important addresses:</p><pre><code><code>Source:      10.2.0.2
Destination: 1.1.1.1</code></code></pre><p>This is the packet our application ultimately wants to send.</p><p>At this point, <code>1.1.1.1</code> is still the destination. Connecting to the VPN hasn&#8217;t changed where the traffic is trying to go. What has changed is the path Linux uses to get it there.</p><p>We can visualize the packet entering <code>proton0</code> like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AXXh!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AXXh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png 424w, https://substackcdn.com/image/fetch/$s_!AXXh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png 848w, https://substackcdn.com/image/fetch/$s_!AXXh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png 1272w, https://substackcdn.com/image/fetch/$s_!AXXh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AXXh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png" width="1456" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:53105,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AXXh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png 424w, https://substackcdn.com/image/fetch/$s_!AXXh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png 848w, https://substackcdn.com/image/fetch/$s_!AXXh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png 1272w, https://substackcdn.com/image/fetch/$s_!AXXh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbeea9c1-4faf-4fae-8d38-0eb3013053e0_1600x690.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We&#8217;ll refer to this as the <strong>inner packet</strong>.</p><p>That word will become important shortly because this packet isn&#8217;t what our physical <code>enp2s0</code> interface is ultimately going to transmit across the network.</p><p>WireGuard first has some work to do.</p><p>And that&#8217;s where the second destination we discovered earlier comes into the picture:</p><pre><code><code>62.93.176.129</code></code></pre><p>To understand why, we need to look at <strong>encryption and encapsulation</strong>.</p><h2>Encryption and Encapsulation</h2><p>When our packet enters <code>proton0</code>, WireGuard needs to transport it to the VPN peer we discovered earlier:</p><pre><code><code>endpoint: 62.93.176.129:443</code></code></pre><p>But the original packet is still:</p><pre><code><code>Source:      10.2.0.2
Destination: 1.1.1.1</code></code></pre><p>WireGuard handles this through two important processes: <strong>encryption</strong> and <strong>encapsulation</strong>.</p><p>First, WireGuard encrypts the original IP packet. This protects the contents of the packet, including its original IP header, so that it cannot simply be inspected while travelling across the network between our machine and the VPN endpoint.</p><p>But encryption alone doesn&#8217;t give the encrypted data a path across the Internet.</p><p>The physical network underneath the VPN still needs an IP packet it can actually route toward the WireGuard peer.</p><p>This is where <strong>encapsulation</strong> comes in.</p><p>WireGuard carries the encrypted data inside a new UDP packet, which is then carried inside a new IP packet. That new IP header contains addresses that belong to the physical network path.</p><p>For our connection, we now have something conceptually like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2WNx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2WNx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png 424w, https://substackcdn.com/image/fetch/$s_!2WNx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png 848w, https://substackcdn.com/image/fetch/$s_!2WNx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png 1272w, https://substackcdn.com/image/fetch/$s_!2WNx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2WNx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png" width="1456" height="710" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:710,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:114362,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2WNx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png 424w, https://substackcdn.com/image/fetch/$s_!2WNx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png 848w, https://substackcdn.com/image/fetch/$s_!2WNx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png 1272w, https://substackcdn.com/image/fetch/$s_!2WNx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4fb1613d-cc8f-483f-a7f0-aa70d5ecd6e9_1600x780.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><strong>NOTE:</strong> The inner packet is shown inside the encrypted WireGuard data so we can understand what is being carried. On the physical network, that original packet isn&#8217;t sitting there in readable form inside the outer packet. It is protected by WireGuard encryption.</p></blockquote><p>Now the two destinations we saw earlier start to make sense.</p><p><code>1.1.1.1</code> is the destination of the <strong>inner packet</strong>. It is where our original traffic is ultimately intended to go.</p><p><code>62.93.176.129</code> is the destination of the <strong>outer packet</strong>. It is the WireGuard endpoint that the encrypted VPN traffic needs to reach across the physical network.</p><p>In other words, we now have two network paths to think about:</p><p><strong>Overlay:</strong></p><pre><code><code>10.2.0.2 &#8594; 1.1.1.1</code></code></pre><p><strong>Underlay:</strong></p><pre><code><code>172.16.1.17 &#8594; 62.93.176.129</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!k1LJ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!k1LJ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png 424w, https://substackcdn.com/image/fetch/$s_!k1LJ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png 848w, https://substackcdn.com/image/fetch/$s_!k1LJ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png 1272w, https://substackcdn.com/image/fetch/$s_!k1LJ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!k1LJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png" width="1456" height="684" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/372bb887-c2dd-4be3-a599-738b34141798_1600x752.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:684,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:62850,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!k1LJ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png 424w, https://substackcdn.com/image/fetch/$s_!k1LJ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png 848w, https://substackcdn.com/image/fetch/$s_!k1LJ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png 1272w, https://substackcdn.com/image/fetch/$s_!k1LJ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F372bb887-c2dd-4be3-a599-738b34141798_1600x752.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And that creates another interesting routing problem.</p><p>We already know ordinary Internet traffic destined for <code>1.1.1.1</code> gets sent into <code>proton0</code>.</p><p>But the outer packet destined for <code>62.93.176.129</code> needs to leave through our physical network so that it can actually reach the Proton VPN server.</p><p>So what stops Linux from sending <strong>that packet straight back into </strong><code>proton0</code><strong> too?</strong></p><h2>Solving the Routing Recursion Problem</h2><p>We ended the previous section with an interesting problem.</p><p>The outer WireGuard packet needs to reach:</p><pre><code><code>62.93.176.129</code></code></pre><p>At this point, you might expect Linux to route that address through our physical <code>enp2s0</code> interface. After all, <code>62.93.176.129</code> is the WireGuard endpoint on the physical Internet, and the VPN tunnel depends on our underlay to reach it.</p><p>That&#8217;s what I expected too.</p><p>But let&#8217;s ask Linux instead of assuming:</p><pre><code><code>$ ip route get 62.93.176.129</code></code></pre><p>Here&#8217;s what we get:</p><pre><code><code>62.93.176.129 dev proton0 table 245447468 src 10.2.0.2 uid 1000
    cache</code></code></pre><p>Interesting.</p><p>Linux selects <code>proton0</code>.</p><p>But that&#8217;s a problem.</p><p><code>62.93.176.129</code> is the WireGuard endpoint that the tunnel itself needs to reach. If WireGuard&#8217;s outer packet were treated like our ordinary Internet traffic, Linux would send it straight back into the same tunnel:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!oa0e!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!oa0e!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png 424w, https://substackcdn.com/image/fetch/$s_!oa0e!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png 848w, https://substackcdn.com/image/fetch/$s_!oa0e!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png 1272w, https://substackcdn.com/image/fetch/$s_!oa0e!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!oa0e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png" width="1456" height="737" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dd241513-1caa-425b-9f35-b6aeab872186_1600x810.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:737,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:84267,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!oa0e!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png 424w, https://substackcdn.com/image/fetch/$s_!oa0e!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png 848w, https://substackcdn.com/image/fetch/$s_!oa0e!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png 1272w, https://substackcdn.com/image/fetch/$s_!oa0e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd241513-1caa-425b-9f35-b6aeab872186_1600x810.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>We would end up with a <strong>recursive routing loop</strong>. The packet that is supposed to carry our VPN traffic to the WireGuard endpoint would itself be routed back into the VPN, producing another outer packet that would again need to be routed, and so on.</p><p>Our VPN traffic would never make it out through the physical network to reach the WireGuard endpoint.</p><p>The tunnel needs a way out.</p><p>And this is where that <code>fwmark</code> we&#8217;ve been deliberately ignoring finally becomes important.</p><p>Earlier, <code>wg show</code> gave us:</p><pre><code><code>interface: proton0
  listening port: 38001
  fwmark: 0xea13b2c</code></code></pre><p>And our policy-routing rules contain that exact same value:</p><pre><code><code>31618:  from all lookup main suppress_prefixlength 0
31619:  not from all fwmark 0xea13b2c lookup 245447468</code></code></pre><p>WireGuard marks its own transport packets with <code>0xea13b2c</code>.</p><p>We can ask Linux to perform the same route lookup again, but this time include that mark:</p><pre><code><code>$ ip route get 62.93.176.129 mark 0xea13b2c</code></code></pre><p>Now look at what happens:</p><pre><code><code>62.93.176.129 via 172.16.1.1 dev enp2s0 src 172.16.1.17 mark 0xea13b2c uid 1000
    cache</code></code></pre><p>There it is.</p><p>Instead of sending the packet into <code>proton0</code>, Linux selects our physical Ethernet interface, <code>enp2s0</code>, and sends the packet toward our physical default gateway at <code>172.16.1.1</code>.</p><p>The reason becomes clearer when we read this rule carefully:</p><pre><code><code>31619:  not from all fwmark 0xea13b2c lookup 245447468</code></code></pre><p>Traffic that does <strong>not</strong> carry the mark <code>0xea13b2c</code> can use routing table <code>245447468</code>, whose default route points into <code>proton0</code>.</p><p>WireGuard&#8217;s own transport traffic carries that mark, so it does not match this rule. It avoids being sent straight back into the VPN routing table.</p><p>That solves one half of the puzzle.</p><p>But there&#8217;s still another strange-looking rule sitting directly above it:</p><pre><code><code>31618:  from all lookup main suppress_prefixlength 0</code></code></pre><p>What exactly is <code>suppress_prefixlength 0</code> doing, and why do we need it?</p><h2>What Does <code>suppress_prefixlength 0</code> Do?</h2><p>Let&#8217;s bring the two policy-routing rules back one more time:</p><pre><code><code>31618:  from all lookup main suppress_prefixlength 0
31619:  not from all fwmark 0xea13b2c lookup 245447468</code></code></pre><p>We&#8217;ve figured out what the second rule is doing.</p><p>But Linux evaluates policy-routing rules in priority order, and <code>31618</code> comes first:</p><pre><code><code>31618:  from all lookup main suppress_prefixlength 0</code></code></pre><p>At first glance, this is a little confusing.</p><p>The rule tells Linux to look in the <code>main</code> routing table, which still contains our normal default route:</p><pre><code><code>default via 172.16.1.1 dev enp2s0</code></code></pre><p>If Linux simply used that default route for ordinary Internet traffic, it would never continue to the next rule and our traffic wouldn&#8217;t be sent through <code>proton0</code>.</p><p>That&#8217;s where:</p><pre><code><code>suppress_prefixlength 0</code></code></pre><p>comes in.</p><p>A prefix length of <code>0</code> refers to a default route:</p><pre><code><code>0.0.0.0/0</code></code></pre><p>With <code>suppress_prefixlength 0</code>, routes with a prefix length of <code>0</code> are suppressed from the result of this lookup.</p><p>In other words, Linux can consult the <code>main</code> table, but the default route isn&#8217;t allowed to satisfy this particular rule.</p><p>More-specific routes can still be used.</p><p>For example, our directly connected network:</p><pre><code><code>172.16.1.0/24 dev enp2s0</code></code></pre><p>is more specific than <code>/0</code>, so it isn&#8217;t suppressed.</p><p>That distinction is important.</p><p>The rule doesn&#8217;t simply tell Linux to ignore the entire <code>main</code> table. It lets Linux use more-specific routes from <code>main</code> while preventing its ordinary default route from taking over traffic that should continue through the VPN policy.</p><p>For a remote Internet destination such as <code>1.1.1.1</code>, the lookup in <code>main</code> would otherwise fall back to:</p><pre><code><code>default via 172.16.1.1 dev enp2s0</code></code></pre><p>But that <code>/0</code> route is suppressed, so Linux continues evaluating the policy-routing rules.</p><p>It can then reach:</p><pre><code><code>31619:  not from all fwmark 0xea13b2c lookup 245447468</code></code></pre><p>For ordinary, unmarked traffic, that rule directs the lookup to table <code>245447468</code>, where we already found:</p><pre><code><code>default dev proton0</code></code></pre><p>Put the two rules together and the behavior starts to make sense.</p><p>Ordinary Internet traffic can continue past the suppressed physical default route and reach the VPN routing table.</p><p>WireGuard&#8217;s own transport traffic carries <code>0xea13b2c</code>, so it doesn&#8217;t match the rule that would send it back into <code>proton0</code>. Since it doesn&#8217;t match any of the preceding rules, the lookup can continue down the rule set until it reaches the normal <code>main</code> table lookup, where the physical default route sends the packet through <code>enp2s0</code>.</p><p>That&#8217;s how Linux can maintain both paths at the same time: one for the traffic <strong>inside the VPN</strong>, and another for the VPN traffic that actually carries it across the physical network. The below diagram sum it all:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!aLKy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!aLKy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png 424w, https://substackcdn.com/image/fetch/$s_!aLKy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png 848w, https://substackcdn.com/image/fetch/$s_!aLKy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png 1272w, https://substackcdn.com/image/fetch/$s_!aLKy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!aLKy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png" width="1456" height="743" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:743,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:136276,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!aLKy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png 424w, https://substackcdn.com/image/fetch/$s_!aLKy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png 848w, https://substackcdn.com/image/fetch/$s_!aLKy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png 1272w, https://substackcdn.com/image/fetch/$s_!aLKy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9ee03524-606a-4d66-a0ed-8965fd8f077b_1600x816.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Watching the Packet on <code>proton0</code></h2><p>We&#8217;ve spent quite a bit of time reasoning about what should happen to our packet.</p><p>Now let&#8217;s actually watch it.</p><p>We&#8217;ll start on <code>proton0</code>, the interface Linux selected for our traffic to <code>1.1.1.1</code>.</p><p>In one terminal, I started a packet capture and filtered specifically for ICMP traffic:</p><pre><code><code>$ sudo tcpdump -ni proton0 icmp</code></code></pre><p>Then, from another terminal, I sent four ICMP echo requests to <code>1.1.1.1</code>:</p><pre><code><code>$ ping -c 4 1.1.1.1</code></code></pre><p>Here&#8217;s what appeared on <code>proton0</code>:</p><pre><code><code>18:26:10.635453 IP 10.2.0.2 &gt; 1.1.1.1: ICMP echo request, id 41858, seq 1, length 64
18:26:10.903398 IP 1.1.1.1 &gt; 10.2.0.2: ICMP echo reply, id 41858, seq 1, length 64

18:26:11.636282 IP 10.2.0.2 &gt; 1.1.1.1: ICMP echo request, id 41858, seq 2, length 64
18:26:11.902512 IP 1.1.1.1 &gt; 10.2.0.2: ICMP echo reply, id 41858, seq 2, length 64</code></code></pre><p>There it is.</p><p>The packet we have been following throughout this article is visible directly on <code>proton0</code>:</p><pre><code><code>10.2.0.2 &#8594; 1.1.1.1</code></code></pre><p>And the replies travel in the opposite direction:</p><pre><code><code>1.1.1.1 &#8594; 10.2.0.2</code></code></pre><p>Notice what we can see here.</p><p>We can see the original destination, <code>1.1.1.1</code>.</p><p>We can see the VPN-assigned source address, <code>10.2.0.2</code>.</p><p>We can even see that the traffic is ICMP and that these are echo requests and replies.</p><p>In other words, on <code>proton0</code>, we&#8217;re looking at the <strong>inner packet</strong>.</p><p>This is the packet before WireGuard carries it across the physical network.</p><p>But according to the model we built earlier, this isn&#8217;t what <code>enp2s0</code> should see.</p><p>By the time the traffic reaches our physical interface, the inner packet should be protected inside WireGuard traffic destined for:</p><pre><code><code>62.93.176.129</code></code></pre><p>So let&#8217;s move our packet capture from the <strong>overlay</strong> to the <strong>underlay</strong> and see if that&#8217;s actually what happens.</p><h2>Watching the Packet on <code>enp2s0</code></h2><p>Now let&#8217;s move our capture from the VPN interface to the physical interface underneath it.</p><p>Earlier, when we captured traffic on <code>proton0</code>, we could clearly see our original packet:</p><pre><code><code>10.2.0.2 &gt; 1.1.1.1: ICMP echo request</code></code></pre><p>We could identify the source and destination addresses, the protocol, and even see that the packet was an ICMP echo request.</p><p>This time, we&#8217;ll capture the traffic leaving through our physical <code>enp2s0</code> interface.</p><p>From <code>wg show</code>, we already know that our WireGuard endpoint is <code>62.93.176.129:443</code>, so we can narrow the capture to UDP traffic involving that endpoint:</p><pre><code><code>$ sudo tcpdump -nni enp2s0 'host 62.93.176.129 and udp port 443' -w /tmp/enp2s0.pcap</code></code></pre><p>The <code>-w</code> option writes the captured packets directly to <code>/tmp/enp2s0.pcap</code> rather than displaying them in the terminal. This gives us a capture file that we can open in Wireshark and inspect in more detail.</p><p>And when we do that, we get a very different view from what we saw on <code>proton0</code>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Ww-K!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Ww-K!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png 424w, https://substackcdn.com/image/fetch/$s_!Ww-K!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png 848w, https://substackcdn.com/image/fetch/$s_!Ww-K!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png 1272w, https://substackcdn.com/image/fetch/$s_!Ww-K!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Ww-K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png" width="1280" height="1001" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1001,&quot;width&quot;:1280,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:538029,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Ww-K!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png 424w, https://substackcdn.com/image/fetch/$s_!Ww-K!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png 848w, https://substackcdn.com/image/fetch/$s_!Ww-K!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png 1272w, https://substackcdn.com/image/fetch/$s_!Ww-K!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8ae8392f-be1d-47ea-a66e-c5c16a1f18d2_1280x1001.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Instead of seeing <code>10.2.0.2</code> communicating with <code>1.1.1.1</code>, Wireshark shows traffic between our physical IP address and the WireGuard endpoint:</p><pre><code><code>Source:      172.16.1.17
Destination: 62.93.176.129
Protocol:    WireGuard</code></code></pre><p>If we expand one of those packets, we can see exactly how the outer packet is constructed:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_QdE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_QdE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png 424w, https://substackcdn.com/image/fetch/$s_!_QdE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png 848w, https://substackcdn.com/image/fetch/$s_!_QdE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png 1272w, https://substackcdn.com/image/fetch/$s_!_QdE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_QdE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png" width="1191" height="465" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:465,&quot;width&quot;:1191,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:148612,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_QdE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png 424w, https://substackcdn.com/image/fetch/$s_!_QdE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png 848w, https://substackcdn.com/image/fetch/$s_!_QdE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png 1272w, https://substackcdn.com/image/fetch/$s_!_QdE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2dd5d492-f40b-49d9-95ad-6933695b4780_1191x465.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>That&#8217;s the packet structure we drew earlier, now visible in an actual packet capture.</p><p>And there&#8217;s something else worth noticing.</p><p>From this side of the tunnel, <strong>we can&#8217;t tell which type of traffic is being carried inside each WireGuard packet</strong>.</p><p>Our capture contains thousands of WireGuard packets going back and forth between the same two addresses. They all appear as WireGuard transport traffic on the physical interface.</p><p>We can&#8217;t look at one of these packets and determine from the encrypted payload whether it contains an ICMP echo request, a TCP segment from a web connection, a DNS query, or some other traffic.</p><p>We also can&#8217;t see the original destination <code>1.1.1.1</code> in the outer IP header.</p><p>Those details belong to the inner packet, and that packet is now protected inside WireGuard&#8217;s encrypted transport data.</p><p>And now we have actually observed both sides of the tunnel.</p><p>On the virtual interface, we see the <strong>inner packet</strong>.</p><p>On the physical interface, we see the <strong>outer WireGuard packet carrying encrypted data</strong>.</p><p>That also tells us something important about what the network between us and the Proton VPN server can see.</p><h2>What Can the ISP Actually See?</h2><p>Our capture on <code>enp2s0</code> also helps answer an important question:</p><p><strong>What can the ISP actually see?</strong></p><p>The VPN connection itself isn&#8217;t invisible. As the WireGuard traffic crosses the Internet, the ISP can still see that our public IP address is communicating with a VPN endpoint. It can also observe metadata such as packet sizes, timing, direction, and the amount of traffic being exchanged.</p><p>What it can&#8217;t directly inspect is the protected inner traffic.</p><p>In our capture on <code>proton0</code>, we could see the original destination <code>1.1.1.1</code> and identify the traffic as ICMP. Once that packet was encrypted and carried by WireGuard across the physical network, those details were no longer visible in the outer packet.</p><p>So a VPN doesn&#8217;t make your traffic invisible to your ISP. It changes <strong>what your ISP can see</strong>.</p><p>The ISP can see the encrypted VPN connection and its associated metadata, but it can&#8217;t directly read the protected inner packets being carried through the tunnel.</p><p>Now our encrypted packet has made it across the underlay to the Proton VPN server.</p><p>What happens when it gets there?</p><h2>What Happens When the Packet Reaches the Proton VPN Server?</h2><p>Our outer packet has now travelled across the physical network and reached the WireGuard endpoint at <code>62.93.176.129</code>.</p><p>At the other end of the tunnel, the process we observed on our machine happens in reverse.</p><p>WireGuard processes the incoming transport packet, authenticates and decrypts it, and removes the outer UDP/IP encapsulation. What remains is the inner packet that entered <code>proton0</code> earlier:</p><pre><code><code>Source:      10.2.0.2
Destination: 1.1.1.1</code></code></pre><p>But <code>10.2.0.2</code> is an internal VPN address. It isn&#8217;t the address that <code>1.1.1.1</code> will ultimately see.</p><p>Proton&#8217;s WireGuard implementation uses double NAT to handle this. <a href="https://protonvpn.com/support/wireguard-privacy">Proton documents this as a two-stage process</a>: the first NAT translates <code>10.2.0.2</code> to a random but unique internal IP address assigned to the VPN session. The second NAT then translates that session address to the VPN server&#8217;s public IP address before the traffic is sent toward its destination.</p><p>Conceptually:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!WoO6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!WoO6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png 424w, https://substackcdn.com/image/fetch/$s_!WoO6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png 848w, https://substackcdn.com/image/fetch/$s_!WoO6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png 1272w, https://substackcdn.com/image/fetch/$s_!WoO6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!WoO6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png" width="1456" height="804" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:804,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:111542,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!WoO6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png 424w, https://substackcdn.com/image/fetch/$s_!WoO6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png 848w, https://substackcdn.com/image/fetch/$s_!WoO6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png 1272w, https://substackcdn.com/image/fetch/$s_!WoO6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fea33e0fd-5fa7-4604-b214-42e20966c6be_1600x884.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In our connection, we&#8217;ve actually encountered <strong>two different public Proton IP addresses</strong> that serve different purposes.</p><p>The first is:</p><pre><code><code>62.93.176.129</code></code></pre><p>This is the <strong>WireGuard endpoint</strong>. It&#8217;s the public address our machine sends the encrypted WireGuard transport traffic to.</p><p>The Proton CLI also gave us:</p><pre><code><code>159.26.101.55</code></code></pre><p>This is the <strong>public VPN address</strong> for our connection. It&#8217;s the address presented to destinations on the Internet after our traffic leaves Proton&#8217;s VPN infrastructure.</p><p>So these addresses shouldn&#8217;t be confused:</p><pre><code><code>10.2.0.2        &#8594; address inside our VPN tunnel
62.93.176.129   &#8594; public WireGuard endpoint
159.26.101.55   &#8594; public VPN/exit address</code></code></pre><p>The original destination is still <code>1.1.1.1</code>. What changes before the packet is sent onward is its source address.</p><p>Putting everything together conceptually:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wX88!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wX88!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png 424w, https://substackcdn.com/image/fetch/$s_!wX88!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png 848w, https://substackcdn.com/image/fetch/$s_!wX88!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png 1272w, https://substackcdn.com/image/fetch/$s_!wX88!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wX88!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png" width="1456" height="692" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:692,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:65033,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/218947473?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wX88!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png 424w, https://substackcdn.com/image/fetch/$s_!wX88!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png 848w, https://substackcdn.com/image/fetch/$s_!wX88!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png 1272w, https://substackcdn.com/image/fetch/$s_!wX88!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc24cbddb-4d71-45c8-83a7-319b1ffe5bac_1600x760.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The packet can now continue toward <code>1.1.1.1</code>, but as far as the destination is concerned, the connection is coming from Proton&#8217;s public VPN address rather than our original Internet connection.</p><p>And once <code>1.1.1.1</code> replies, the entire journey has to happen again in reverse.</p><h2>Wrapping Up</h2><p>We started with a simple question: what actually happens after Linux sends a packet into <code>proton0</code>?</p><p>By following that packet, we saw how WireGuard creates an encrypted path across the physical network underneath it, why Linux needs separate routing behavior for the inner and outer traffic, and what changes as the packet moves from our machine to the Proton VPN server.</p><p>More importantly, we didn&#8217;t just describe the tunnel. We watched it happen using Linux&#8217;s routing tables, policy rules, WireGuard state, and packet captures.</p><p>But everything we&#8217;ve seen depends on that tunnel remaining available.</p><p><strong>What happens if the VPN suddenly goes down?</strong></p><p>That&#8217;s what we&#8217;ll investigate next when we look at how VPN kill switches actually work in Linux.</p><p>Until then, keep exploring and subscribe to get notified when new guides are published.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[EP3: Networking in Linux: How VPNs Actually Work?]]></title><description><![CDATA[In the previous article in our Networking in Linux series, we took a deep dive into routing and looked at how the Linux kernel decides where packets should go.]]></description><link>https://blog.sysxplore.com/p/ep3-networking-in-linux-how-vpns</link><guid isPermaLink="false">https://blog.sysxplore.com/p/ep3-networking-in-linux-how-vpns</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 28 Sep 2026 16:11:14 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/6d1ea5d6-b9d2-4172-95f0-33f1978abaf7_2000x800.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the <a href="https://blog.sysxplore.com/p/ep2-networking-in-linux-routing-deep-dive">previous article</a> in our Networking in Linux series, we took a deep dive into routing and looked at how the Linux kernel decides where packets should go.</p><p>When an application wants to communicate with another host, the kernel looks at the available routing information, determines the best path to the destination, and sends the packet through the appropriate network interface.</p><p>For a typical Linux machine connected to a local network, that path might look something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!4RQB!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!4RQB!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png 424w, https://substackcdn.com/image/fetch/$s_!4RQB!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png 848w, https://substackcdn.com/image/fetch/$s_!4RQB!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png 1272w, https://substackcdn.com/image/fetch/$s_!4RQB!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!4RQB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png" width="1456" height="637" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:81788,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!4RQB!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png 424w, https://substackcdn.com/image/fetch/$s_!4RQB!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png 848w, https://substackcdn.com/image/fetch/$s_!4RQB!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png 1272w, https://substackcdn.com/image/fetch/$s_!4RQB!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7f6f444-a786-4786-b6e6-8924f170f44c_1600x700.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But what happens to this path when you connect to a VPN?</p><p>Suddenly, there is another interface in the picture. The routing configuration changes. Traffic that previously left your machine through <code>eth0</code> or <code>wlan0</code> is now being directed through a VPN tunnel, yet somehow those packets still have to leave through the physical network interface to reach the VPN server.</p><p>So what exactly is happening behind the scenes?</p><p>That is what we are going to explore in this article.</p><p>Rather than spending much time on what a VPN is or why you might use one, we are going to look at it from a networking perspective. We&#8217;ll inspect the interfaces, routing tables, and policy-routing rules before and after connecting to a VPN and see exactly how the path Linux chooses for our Internet traffic changes.</p><p>This article is sponsored by <a href="https://go.getproton.me/aff_ad?campaign_id=3559&amp;aff_id=20104">Proton VPN</a>, and throughout the article I will be using Proton VPN on Linux as our real-world implementation while we investigate what is happening underneath.</p><p>Before we connect to it, though, we need a baseline.</p><p>Let&#8217;s see what our network looks like without a VPN.</p><h2>Before We Connect the VPN</h2><p>Before connecting to Proton VPN, let&#8217;s establish what our network currently looks like.</p><p>We already know from our previous discussion on Linux routing that when an application sends traffic to a remote destination, the Linux kernel needs to determine where that traffic should go. It does this using the routing information available on the system.</p><p>Right now, there is no VPN involved, so let&#8217;s first look at the interfaces available on our machine:</p><pre><code><code>$ ip -c addr</code></code></pre><p>The output is quite long, so I&#8217;ve trimmed it down to the parts we&#8217;re interested in:</p><pre><code><code>2: enp2s0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 ...
    link/ether c8:53:09:8c:57:a9 brd ff:ff:ff:ff:ff:ff
    inet 172.16.1.17/24 brd 172.16.1.255 scope global dynamic noprefixroute enp2s0

3: wlp3s0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 ...
    link/ether 7e:01:79:88:e9:4a brd ff:ff:ff:ff:ff:ff
    inet 192.168.8.53/24 brd 192.168.8.255 scope global dynamic noprefixroute wlp3s0</code></code></pre><p>There are two active network interfaces on this machine.</p><p><code>enp2s0</code> is our Ethernet interface and has been assigned <code>172.16.1.17/24</code>, while <code>wlp3s0</code> is our wireless interface and has been assigned <code>192.168.8.53/24</code>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!HNr9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!HNr9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png 424w, https://substackcdn.com/image/fetch/$s_!HNr9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png 848w, https://substackcdn.com/image/fetch/$s_!HNr9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png 1272w, https://substackcdn.com/image/fetch/$s_!HNr9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!HNr9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png" width="1456" height="728" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:728,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:85291,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!HNr9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png 424w, https://substackcdn.com/image/fetch/$s_!HNr9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png 848w, https://substackcdn.com/image/fetch/$s_!HNr9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png 1272w, https://substackcdn.com/image/fetch/$s_!HNr9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F88469ce8-bf94-4753-88b7-ef44be5b2200_1600x800.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Both interfaces are up and connected to different networks.</p><p>This makes our example a little more interesting because Linux potentially has two ways to reach the Internet.</p><p>Let&#8217;s look at the routing table:</p><pre><code><code>$ ip route</code></code></pre><pre><code><code>default via 172.16.1.1 dev enp2s0 proto dhcp src 172.16.1.17 metric 100
default via 192.168.8.1 dev wlp3s0 proto dhcp src 192.168.8.53 metric 600

172.16.1.0/24 dev enp2s0 proto kernel scope link src 172.16.1.17 metric 100
192.168.8.0/24 dev wlp3s0 proto kernel scope link src 192.168.8.53 metric 600</code></code></pre><p>Notice that we don&#8217;t have just one default route. We have two:</p><pre><code><code>default via 172.16.1.1 dev enp2s0 metric 100
default via 192.168.8.1 dev wlp3s0 metric 600</code></code></pre><p>Both match destinations for which Linux doesn&#8217;t have a more specific route, but the kernel still needs to choose between them.</p><p>Since these routes have the same prefix length, their metrics help determine which one is preferred. A lower metric represents the preferred route.</p><p>In our case:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!J8nv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!J8nv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png 424w, https://substackcdn.com/image/fetch/$s_!J8nv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png 848w, https://substackcdn.com/image/fetch/$s_!J8nv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png 1272w, https://substackcdn.com/image/fetch/$s_!J8nv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!J8nv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png" width="1456" height="637" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:94148,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!J8nv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png 424w, https://substackcdn.com/image/fetch/$s_!J8nv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png 848w, https://substackcdn.com/image/fetch/$s_!J8nv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png 1272w, https://substackcdn.com/image/fetch/$s_!J8nv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda8c3f12-bbb5-4a87-b06a-e79db7873445_1600x700.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So we expect Linux to prefer <code>enp2s0</code> when sending ordinary Internet traffic.</p><p>If you want a deeper explanation of how Linux evaluates routes, route specificity, metrics, routing tables and policy-based routing, I covered those in <a href="https://blog.sysxplore.com/p/ep2-networking-in-linux-routing-deep-dive">Networking in Linux: Routing Deep Dive</a>.</p><p>For now, we don&#8217;t have to rely on our interpretation of the routing table. We can simply ask the kernel which route it would use to reach a specific destination:</p><pre><code><code>$ ip route get 1.1.1.1</code></code></pre><p>And sure enough:</p><pre><code><code>1.1.1.1 via 172.16.1.1 dev enp2s0 src 172.16.1.17 uid 1000
    cache</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!H9z1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!H9z1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png 424w, https://substackcdn.com/image/fetch/$s_!H9z1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png 848w, https://substackcdn.com/image/fetch/$s_!H9z1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png 1272w, https://substackcdn.com/image/fetch/$s_!H9z1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!H9z1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png" width="1456" height="637" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:79721,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!H9z1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png 424w, https://substackcdn.com/image/fetch/$s_!H9z1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png 848w, https://substackcdn.com/image/fetch/$s_!H9z1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png 1272w, https://substackcdn.com/image/fetch/$s_!H9z1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd20ca47d-4cc3-4dea-b213-a8a24d5819a9_1600x700.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Linux has selected the Ethernet path:</p><p>The destination is <code>1.1.1.1</code>, the next hop is <code>172.16.1.1</code>, the packet will leave through <code>enp2s0</code>, and Linux has selected <code>172.16.1.17</code> as the source address for this route.</p><p>So before connecting the VPN, our packet path looks roughly like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VUVD!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VUVD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png 424w, https://substackcdn.com/image/fetch/$s_!VUVD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png 848w, https://substackcdn.com/image/fetch/$s_!VUVD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png 1272w, https://substackcdn.com/image/fetch/$s_!VUVD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VUVD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png" width="1456" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:78970,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VUVD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png 424w, https://substackcdn.com/image/fetch/$s_!VUVD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png 848w, https://substackcdn.com/image/fetch/$s_!VUVD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png 1272w, https://substackcdn.com/image/fetch/$s_!VUVD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fed8b9b26-2159-4f13-a17e-57dca2b03581_1600x690.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>At the IP layer, a packet destined for <code>1.1.1.1</code> would therefore look something like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xe4g!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xe4g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png 424w, https://substackcdn.com/image/fetch/$s_!xe4g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png 848w, https://substackcdn.com/image/fetch/$s_!xe4g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png 1272w, https://substackcdn.com/image/fetch/$s_!xe4g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!xe4g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png" width="1456" height="546" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:546,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:46123,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xe4g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png 424w, https://substackcdn.com/image/fetch/$s_!xe4g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png 848w, https://substackcdn.com/image/fetch/$s_!xe4g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png 1272w, https://substackcdn.com/image/fetch/$s_!xe4g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8da86dcc-5891-467c-a27f-b5e181d8fb1b_1600x600.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><strong>NOTE:</strong>This is intentionally simplified. There is more involved when the packet is actually transmitted, including Ethernet frame headers, the FCS, and other details. For now, we&#8217;re focusing only on the IP-layer information relevant to our investigation.</p></blockquote><p>There is one more thing we want to record before connecting the VPN: the policy routing rules.</p><pre><code><code>$ ip rule</code></code></pre><p>Our system currently has:</p><pre><code><code>0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default</code></code></pre><p>These are the standard rules telling Linux which routing tables to consult. The numbers on the left are priorities, with lower values evaluated first.</p><p>We already covered routing rules and policy-based routing in <a href="https://blog.sysxplore.com/p/ep2-networking-in-linux-routing-deep-dive">Networking in Linux: Routing Deep Dive</a>, so we won&#8217;t go through them again here. For now, we simply want to record the rules that exist before connecting to the VPN. Later, we&#8217;ll run the same command again and see whether anything has changed.</p><p>We have two active physical interfaces, two possible default routes, and Linux currently prefers the Ethernet connection. Traffic toward <code>1.1.1.1</code> is sent through <code>enp2s0</code> to <code>172.16.1.1</code>, using <code>172.16.1.17</code> as the source address.</p><p>That&#8217;s our baseline.</p><p>Now let&#8217;s connect to Proton VPN and run these commands again.</p><p>Things are about to get more interesting.</p><h2>Connect the VPN: What Changed?</h2><p>We now have a pretty good picture of how traffic leaves our Linux machine without a VPN. I&#8217;m going to connect to a Proton VPN server and then run some of the same commands again.</p><p>I&#8217;m a huge fan of the command line. If something can be done easily from the terminal, I&#8217;ll almost always choose the terminal over a GUI. Well, except for browsing the web and maybe watching a few videos.</p><p>So, to connect to Proton VPN, I&#8217;ll be using the Proton VPN CLI for Linux.</p><p>I&#8217;m not going to cover how to install or use the Proton VPN CLI in this article, since that&#8217;s not really what we&#8217;re here for. But if you&#8217;d like to follow along from the terminal, Proton has documentation that walks you through it: <a href="https://protonvpn.com/support/use-linux-cli">Using Proton VPN on Linux with the CLI</a>.</p><p>And if you prefer using the Proton VPN GUI, go for it. There&#8217;s no right or wrong way to connect here. What we&#8217;re interested in is what happens to our Linux networking configuration <strong>after</strong> that connection is established.</p><p>With that out of the way, let&#8217;s connect:</p><pre><code><code>$ protonvpn connect --country US

Connected to US-MA#127 in Boston, United States.

Your new IP address is 159.26.101.55.</code></code></pre><p>We&#8217;re connected.</p><p>Now let&#8217;s see what changed.</p><p>Let&#8217;s start by looking at our network interfaces again:</p><pre><code><code>$ ip -c addr</code></code></pre><p>Our Ethernet and Wi-Fi interfaces are still there with the same addresses, but there are now two interfaces that weren&#8217;t present before:</p><pre><code><code>5: proton0: &lt;POINTOPOINT,NOARP,UP,LOWER_UP&gt; mtu 1420 ...
    link/none
    inet 10.2.0.2/32 scope global noprefixroute proton0
    inet6 2a07:b944::2:2/128 scope global noprefixroute

6: ipv6leakintrf0: &lt;BROADCAST,NOARP,UP,LOWER_UP&gt; mtu 1500 ...
    link/ether 6a:4c:45:3b:bb:6f brd ff:ff:ff:ff:ff:ff
    inet6 fdeb:446c:912d:8da::/64 scope global noprefixroute</code></code></pre><p>Interesting.</p><p>Before connecting to Proton VPN, we had:</p><pre><code><code>lo
enp2s0
wlp3s0</code></code></pre><p>Now we have:</p><pre><code><code>lo
enp2s0
wlp3s0
proton0          &#8592; new
ipv6leakintrf0   &#8592; new</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!FhDO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FhDO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png 424w, https://substackcdn.com/image/fetch/$s_!FhDO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png 848w, https://substackcdn.com/image/fetch/$s_!FhDO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png 1272w, https://substackcdn.com/image/fetch/$s_!FhDO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!FhDO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png" width="1456" height="746" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:746,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:84303,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FhDO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png 424w, https://substackcdn.com/image/fetch/$s_!FhDO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png 848w, https://substackcdn.com/image/fetch/$s_!FhDO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png 1272w, https://substackcdn.com/image/fetch/$s_!FhDO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4aba73a3-01f7-4e10-a9d1-285b9169eb0c_1600x820.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><code>proton0</code> has also been assigned the IPv4 address <code>10.2.0.2/32</code>, along with an IPv6 address.</p><p>The second interface, <code>ipv6leakintrf0</code>, has also appeared. Its name already gives us a pretty good clue about why it exists, but let&#8217;s leave that one alone for now. We&#8217;ll come back to IPv6 leakage later.</p><p>For the moment, <code>proton0</code> is the interface we&#8217;re interested in.</p><p>But simply creating a new interface doesn&#8217;t automatically mean Linux will start sending Internet traffic through it. The kernel still needs routing information that tells it when to use that interface.</p><p>So let&#8217;s look at our routing table again:</p><pre><code><code>$ ip route</code></code></pre><pre><code><code>default via 172.16.1.1 dev enp2s0 proto dhcp src 172.16.1.17 metric 100
default via 192.168.8.1 dev wlp3s0 proto dhcp src 192.168.8.53 metric 600
172.16.1.0/24 dev enp2s0 proto kernel scope link src 172.16.1.17 metric 100
192.168.8.0/24 dev wlp3s0 proto kernel scope link src 192.168.8.53 metric 600</code></code></pre><p>Wait a minute.</p><p>That looks exactly like it did before we connected to the VPN.</p><p>Our preferred default route is still:</p><pre><code><code>default via 172.16.1.1 dev enp2s0 metric 100</code></code></pre><p>There isn&#8217;t even a route through <code>proton0</code> here.</p><p>If we only looked at the <code>main</code> routing table, we might reasonably wonder how our traffic is being sent through the VPN at all.</p><p>This is where the routing rules we recorded earlier become important.</p><p>Let&#8217;s look at them again:</p><pre><code><code>$ ip rule</code></code></pre><p>Before connecting to Proton VPN, we had:</p><pre><code><code>0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default</code></code></pre><p>After connecting, we have:</p><pre><code><code>0:      from all lookup local
31618:  from all lookup main suppress_prefixlength 0
31619:  not from all fwmark 0xea13b2c lookup 245447468
32766:  from all lookup main
32767:  from all lookup default</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!u2dT!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!u2dT!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png 424w, https://substackcdn.com/image/fetch/$s_!u2dT!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png 848w, https://substackcdn.com/image/fetch/$s_!u2dT!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png 1272w, https://substackcdn.com/image/fetch/$s_!u2dT!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!u2dT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png" width="1456" height="764" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:764,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:122666,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!u2dT!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png 424w, https://substackcdn.com/image/fetch/$s_!u2dT!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png 848w, https://substackcdn.com/image/fetch/$s_!u2dT!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png 1272w, https://substackcdn.com/image/fetch/$s_!u2dT!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa1f0eb4d-d80b-4dee-9eec-415c2f7c3304_1600x840.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Notice that the<code>local</code>rule is still sitting at the top:</p><pre><code><code>0: from all lookup local</code></code></pre><p>That rule handles traffic destined for the Linux machine itself, such as traffic to one of its own addresses or locally hosted services. Proton hasn&#8217;t changed its priority because that traffic shouldn&#8217;t be redirected into the VPN tunnel.</p><p>The interesting changes for us are the two new rules immediately below it.</p><p>Now we&#8217;re getting somewhere.</p><p>Proton has added two policy-routing rules:</p><pre><code><code>31618:  from all lookup main suppress_prefixlength 0
31619:  not from all fwmark 0xea13b2c lookup 245447468</code></code></pre><p>And one of those rules references a routing table we didn&#8217;t have to think about before:</p><pre><code><code>245447468</code></code></pre><p>Let&#8217;s see what&#8217;s inside it.</p><pre><code><code>$ ip route show table 245447468</code></code></pre><p>And there it is:</p><pre><code><code>default dev proton0 proto static scope link metric 50</code></code></pre><p>This is an important part of what Proton has changed.</p><p>Instead of replacing the default route in our <code>main</code> routing table, Proton has created a separate routing table containing a default route through <code>proton0</code>.</p><blockquote><p><strong>NOTE:</strong> You might also notice that the default route through <code>proton0</code> has a metric of <code>50</code>, which is lower than the metrics of <code>100</code> and <code>600</code> on our physical default routes. However, don&#8217;t conclude that <code>proton0</code> is selected simply because it has the lowest metric. These routes live in different routing tables. The policy-routing rules determine <strong>which table gets consulted</strong>, and then the routes within the relevant table participate in that lookup.</p></blockquote><p>We can visualize the relevant pieces like this:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GC_w!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GC_w!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png 424w, https://substackcdn.com/image/fetch/$s_!GC_w!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png 848w, https://substackcdn.com/image/fetch/$s_!GC_w!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png 1272w, https://substackcdn.com/image/fetch/$s_!GC_w!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GC_w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png" width="1456" height="746" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:746,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:121648,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GC_w!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png 424w, https://substackcdn.com/image/fetch/$s_!GC_w!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png 848w, https://substackcdn.com/image/fetch/$s_!GC_w!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png 1272w, https://substackcdn.com/image/fetch/$s_!GC_w!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4158ef6d-32cd-47e5-9605-865ddacc78bc_1600x820.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>A quick word about Proton VPN</h2><p>This article is made possible by Proton VPN.</p><p>Proton VPN has apps for Linux, Windows, macOS, Android, iOS, and more, plus a Linux CLI for those who prefer the terminal. Its apps are open source and independently audited, and it supports multiple VPN protocols, including WireGuard, OpenVPN, and its own Stealth protocol.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!YSDN!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YSDN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 424w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 848w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1272w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png" width="975" height="408" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:408,&quot;width&quot;:975,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:295364,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YSDN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 424w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 848w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1272w, https://substackcdn.com/image/fetch/$s_!YSDN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F872c2e3e-e911-4824-a6b1-8dbf32f3b10b_975x408.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Proton has also provided an exclusive discount for SYSXPLORE readers:<strong>65% off the 2-year VPN Plus plan </strong>or <strong>55% off the 1-year VPN Plus plan </strong>when you sign up through the link below.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://go.getproton.me/aff_ad?campaign_id=3559&amp;aff_id=20104&quot;,&quot;text&quot;:&quot;Try Proton VPN&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://go.getproton.me/aff_ad?campaign_id=3559&amp;aff_id=20104"><span>Try Proton VPN</span></a></p><p></p><p>Now, back to our routing table.</p><p>The policy-routing rules determine when Linux should consult that additional table.</p><p>There is another interesting detail in this rule:</p><pre><code><code>not from all fwmark 0xea13b2c lookup 245447468</code></code></pre><p>Linux packet marks, or <code>fwmark</code> (firewall marks), can be used together with policy routing to make different routing decisions for different packets.</p><p>In this case, traffic that does <strong>not</strong> carry the specified mark can be directed to table <code>245447468</code>, where the default route points to <code>proton0</code>.</p><p>We&#8217;ll come back to why some traffic needs to be treated differently in the next article. That detail becomes very important when we ask how the VPN tunnel itself reaches the Proton VPN server.</p><p>For now, let&#8217;s ask Linux the same question we asked before connecting:</p><pre><code><code>$ ip route get 1.1.1.1</code></code></pre><p>Before the VPN:</p><pre><code><code>1.1.1.1 via 172.16.1.1 dev enp2s0 src 172.16.1.17 uid 1000
    cache</code></code></pre><p>After connecting to Proton VPN:</p><pre><code><code>1.1.1.1 dev proton0 table 245447468 src 10.2.0.2 uid 1000
    cache</code></code></pre><p>There it is.</p><p>The destination hasn&#8217;t changed.</p><p>We&#8217;re still asking Linux how it would reach <code>1.1.1.1</code>.</p><p>But the routing decision has completely changed.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!6LGE!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!6LGE!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png 424w, https://substackcdn.com/image/fetch/$s_!6LGE!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png 848w, https://substackcdn.com/image/fetch/$s_!6LGE!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png 1272w, https://substackcdn.com/image/fetch/$s_!6LGE!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!6LGE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png" width="1456" height="737" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:737,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:86571,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!6LGE!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png 424w, https://substackcdn.com/image/fetch/$s_!6LGE!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png 848w, https://substackcdn.com/image/fetch/$s_!6LGE!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png 1272w, https://substackcdn.com/image/fetch/$s_!6LGE!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd17b4b18-d92b-4245-80ae-20b8672128dc_1600x810.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Before connecting to Proton VPN, Linux selected <code>enp2s0</code>, used <code>172.16.1.17</code> as the source address and sent the packet toward our physical default gateway at <code>172.16.1.1</code>.</p><p>After connecting, Linux selects <code>proton0</code> from routing table <code>245447468</code> and uses <code>10.2.0.2</code> as the source address.</p><p>But now we have a problem.</p><p><code>proton0</code> is not an Ethernet cable or a Wi-Fi adapter. There is no physical network connected to it.</p><p>And yet Linux is telling us to reach <code>1.1.1.1</code> go through <code>proton0</code></p><p>So what exactly is <code>proton0</code>?</p><p>And perhaps more importantly, if Linux sends our packet into this virtual interface, how does that packet eventually leave the computer through the physical <code>enp2s0</code> interface and travel across the Internet to the Proton VPN server?</p><p>That&#8217;s what we need to figure out next.</p><h2>The VPN Interface Is Not a Physical Interface</h2><p>We now know that after connecting to Proton VPN, Linux routes our traffic toward <code>proton0</code>.</p><pre><code><code>1.1.1.1 dev proton0 table 245447468 src 10.2.0.2</code></code></pre><p>But <code>proton0</code> is very different from the other interfaces on our machine.</p><p>Our Ethernet interface, <code>enp2s0</code>, represents actual network hardware. It connects our machine to the local network and ultimately gives us a path to the Internet through our default gateway.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!VIyH!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VIyH!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png 424w, https://substackcdn.com/image/fetch/$s_!VIyH!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png 848w, https://substackcdn.com/image/fetch/$s_!VIyH!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png 1272w, https://substackcdn.com/image/fetch/$s_!VIyH!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!VIyH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png" width="1456" height="637" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:637,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:90989,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VIyH!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png 424w, https://substackcdn.com/image/fetch/$s_!VIyH!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png 848w, https://substackcdn.com/image/fetch/$s_!VIyH!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png 1272w, https://substackcdn.com/image/fetch/$s_!VIyH!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F37ab707f-29d9-4052-a9ec-1daf4a4f5ca7_1600x700.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This physical network path already existed before we connected to Proton VPN. In VPN terminology, we can think of this existing network connectivity as the <strong>underlay</strong>.</p><p>The VPN tunnel is built on top of that connectivity.</p><p>One clue that <code>proton0</code> is different was sitting right in our <code>ip addr</code> output:</p><pre><code><code>5: proton0: &lt;POINTOPOINT,NOARP,UP,LOWER_UP&gt; mtu 1420 ...
    link/none
    inet 10.2.0.2/32 scope global noprefixroute proton0</code></code></pre><p>Compare that with our physical Ethernet interface:</p><pre><code><code>enp2s0
    link/ether c8:53:09:8c:57:a9</code></code></pre><p><code>enp2s0</code> has an Ethernet MAC address because it represents an Ethernet network interface.</p><p><code>proton0</code>, on the other hand, shows:</p><pre><code><code>link/none</code></code></pre><p>There is no Ethernet link behind it.</p><p><code>proton0</code>is the virtual WireGuard interface created for our Proton VPN connection.</p><p>Unlike<code>enp2s0</code>, it doesn&#8217;t represent a physical network adapter connected to a cable or wireless network. It exists in software and provides the Linux networking stack with an interface through which IP packets can enter the WireGuard tunnel.</p><p>You can think of the relationship between the two interfaces as an <strong>overlay running on top of an underlay:</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!gLMy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gLMy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png 424w, https://substackcdn.com/image/fetch/$s_!gLMy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png 848w, https://substackcdn.com/image/fetch/$s_!gLMy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png 1272w, https://substackcdn.com/image/fetch/$s_!gLMy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!gLMy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png" width="1456" height="783" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:783,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:105075,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/217851354?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gLMy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png 424w, https://substackcdn.com/image/fetch/$s_!gLMy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png 848w, https://substackcdn.com/image/fetch/$s_!gLMy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png 1272w, https://substackcdn.com/image/fetch/$s_!gLMy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79ff8d6f-c902-4561-a938-bcc91ef7f41e_1600x860.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The underlay gives us the network connectivity needed to reach the Proton VPN server.</p><p>The overlay gives our IP traffic a new logical path through the VPN.</p><p>This distinction is important because when Linux decides to send traffic destined for<code>1.1.1.1</code>through<code>proton0</code>, the packet does not somehow travel across the Internet through a physical<code>proton0</code>connection.</p><p>The VPN tunnel still depends on the physical network underneath it. Our machine needs<code>enp2s0</code>, our default gateway at<code>172.16.1.1</code>, and our existing Internet connection to communicate with the Proton VPN server.</p><p>And this brings us right back to the question we started with.</p><p>If Linux routes a packet destined for<code>1.1.1.1</code>into<code>proton0</code>, but the tunnel itself depends on the physical network to reach the Proton VPN server,<strong>how does the packet actually move between those two worlds?</strong></p><p>Answering that means going deeper into what happens to the packet itself: encryption, encapsulation, inner and outer IP headers, and how the overlay is carried across the underlay.</p><p>That&#8217;s where we&#8217;ll pick things up in the next article,<strong>Life of a Packet Through a VPN</strong>.</p><p>We&#8217;ll follow a single packet as it enters the VPN tunnel and see how the VPN traffic is carried across the physical network underneath it toward the Proton VPN server.</p><p>Along the way, we&#8217;ll finally unpack the encryption, encapsulation, inner and outer IP headers, and those routing details we deliberately left unexplained earlier.</p><pre><code><code>31618:  from all lookup main suppress_prefixlength 0
31619:  not from all fwmark 0xea13b2c lookup 245447468
</code></code></pre><p>For now, the important thing is that connecting to the VPN didn&#8217;t replace the physical network underneath our Linux machine.</p><p>It added a new logical path on top of it.</p><h2>Wrapping Up</h2><p>We started with a simple question:<strong>what happens to Linux networking when you connect to a VPN?</strong></p><p>As we&#8217;ve seen, quite a lot.</p><p>What appears to the user as a simple<strong>Connect</strong>button resulted in a new virtual WireGuard interface, a separate routing table, and new policy-routing rules that changed the path Linux chooses for our Internet traffic.</p><p>And we&#8217;ve only followed that path as far as<code>proton0</code>.</p><p>In the next article, we&#8217;ll step inside the tunnel and follow the packet the rest of the way.</p><p>Until then, keep exploring and subscribe to get notified when new guides are published.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Weekly Brief: Linux 7.3-rc5, Shared NVIDIA GPUs and Critical NetScaler Zero-Days]]></title><description><![CDATA[Linux 7.3 continues an unusually busy stabilization cycle, an experimental project brings shared NVIDIA acceleration to KVM, and administrators face two actively exploited NetScaler vulnerabilities.]]></description><link>https://blog.sysxplore.com/p/weekly-brief-linux-73-rc5-shared</link><guid isPermaLink="false">https://blog.sysxplore.com/p/weekly-brief-linux-73-rc5-shared</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 28 Sep 2026 12:43:38 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/5a877bb8-0fa3-46b1-a8ae-3fb7132a34a0_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Linux 7.3-rc5 remains unusually large</h2><p>Linux 7.3-rc5 was released on September 27 with another substantial collection of fixes.</p><p>Less than one-third of the changes involve drivers, while approximately one-quarter consists of self-tests. The remaining work includes KVM and architecture corrections, scheduler changes, BPF fixes and networking updates. Linus Torvalds described the distribution of changes as unusual, although not necessarily concerning.</p><p>Several memory-management fixes carry direct operational importance. One corrects an Arm64 DAMON bug capable of writing beyond a page-table page, potentially causing memory corruption or crashes. Another fixes an <code>mremap()</code>calculation problem that could panic x86-64 systems using huge pages.</p><p>Networking fixes cover Bluetooth, NFC and Netfilter, alongside corrections for IPv6 route leaks, VRF packet checksums, UDP socket handling and packet transmission.</p><p>The continued size of the release candidates means Linux 7.3 is still receiving meaningful corrections relatively late in its cycle. Administrators should therefore treat its early performance results as provisional and avoid planning production deployments around an expected release date alone. </p><h2>An experimental project shares NVIDIA GPUs between KVM guests</h2><p>A new project called <code>virtio-nvgpu</code> is experimenting with near-native NVIDIA GPU access inside Linux KVM virtual machines.</p><p>Instead of assigning the entire GPU to one VM through VFIO, the project keeps the card attached to the host and forwards NVIDIA driver operations across a virtio interface. Guests run NVIDIA&#8217;s existing user-space libraries, including Vulkan and NVENC components.</p><p>Testing on an RTX 3060 reportedly placed normal GPU-bound rendering within approximately 2% of bare-metal performance. The developers also demonstrated four guests rendering and encoding video simultaneously on one card.</p><p>The important limitation is isolation. Guests currently interact with the host NVIDIA driver without a separate IOMMU boundary. Some operations remain unfiltered, and the planned per-guest sandbox has not been implemented. The developers explicitly recommend VFIO or established vGPU technology when tenants do not trust one another.</p><p>This makes <code>virtio-nvgpu</code> technically interesting but unsuitable for production multi-tenant infrastructure today. Its larger significance is architectural: it suggests that inexpensive NVIDIA cards could eventually support efficient VM sharing without dedicating an entire GPU to every guest or requiring enterprise vGPU licensing. </p><h2>Critical NetScaler zero-days are being actively exploited</h2><p>CISA added two critical Citrix NetScaler ADC and Gateway vulnerabilities&#8212;CVE-2026-88771 and CVE-2026-88772&#8212;to its Known Exploited Vulnerabilities catalogue on September 27.</p><p>These appliances commonly sit at the edge of enterprise networks, providing VPN, authentication and application-delivery services. Successful compromise therefore gives attackers a valuable position before they encounter most internal security controls.</p><p>Administrators running affected NetScaler appliances should treat the vendor&#8217;s mitigations and updates as emergency work. Internet-facing management interfaces should also be reviewed, logs preserved and appliances examined for indicators of compromise rather than assuming that installing a patch removes an attacker who may already have gained access.</p><p>The lesson extends beyond Citrix: perimeter appliances are effectively security infrastructure and servers at the same time. They require asset ownership, rapid patching and compromise assessment&#8212;not merely occasional firmware maintenance. </p><p></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p><p>That&#8217;s it. If you found this useful, please leave a like, subscribe if you haven&#8217;t already, and share it with someone who might enjoy it too.</p><p>Until next time, keep exploring.</p><p></p>]]></content:encoded></item><item><title><![CDATA[Weekly Brief: Rust Coreutils, Fedora 45 Beta, Linux 7.3 and More]]></title><description><![CDATA[Ubuntu&#8217;s Rust utilities reach a major milestone, Fedora tightens package security, Linux 7.3 fixes serious regressions, and gzip patches a dangerous file-deletion race.]]></description><link>https://blog.sysxplore.com/p/weekly-brief-rust-coreutils-fedora</link><guid isPermaLink="false">https://blog.sysxplore.com/p/weekly-brief-rust-coreutils-fedora</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 21 Sep 2026 12:40:05 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/f3f08bfb-9b5e-424d-84fc-29c6e6cc1b5e_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Ubuntu&#8217;s Rust core utilities reach a major compatibility milestone</h2><p>Rust Coreutils 0.12.0 arrived on September 17 with every compatibility problem prioritized by Ubuntu now fixed.</p><p>These included possible data loss during parallel <code>install -D</code> operations, <code>cp -R</code> name collisions, recursive <code>chmod</code>behaviour through symlinks and a deeply nested directory crash in <code>rm</code>.</p><p>Security hardening also landed across <code>ls</code>, <code>sort</code>, <code>install</code>, <code>rm</code>, <code>chmod</code>, <code>chown</code> and <code>chgrp</code>. The project now passes 653 of the 674 GNU tests it runs, leaving 21 failures.</p><p>Ubuntu&#8217;s decision to ship uutils makes behavioural compatibility operationally important. Shell scripts often depend on exact exit codes, undocumented details and decades-old GNU behaviour.</p><p>Administrators adopting Ubuntu 26.10 should carefully test backup, deployment and provisioning scripts.</p><h2>Fedora 45 Beta introduces stricter package verification</h2><p>Fedora Linux 45 Beta was released on September 15.</p><p>RPM now rejects packages without a valid signature by default unless an administrator explicitly overrides the check. This strengthens Fedora&#8217;s package trust boundary, but local RPMs, internal repositories and automated installation systems may fail until their signing processes are updated.</p><p>Fedora also restricts <code>ptrace</code> permissions for unprivileged users, replaces the kernel&#8217;s traditional <code>fbcon</code> virtual console with the userspace <code>kmscon</code>, and standardizes desktop secret storage around <code>oo7</code>.</p><p>Fedora CoreOS gains zRAM swap and <code>systemd-oomd</code>, introducing active memory-pressure management to the container-focused edition.</p><p>The release also includes Podman 6, GCC 16.2, glibc 2.44, Python 3.15 and Go 1.27.</p><h2>Linux 7.3-rc4 fixes user-facing regressions</h2><p>Linux 7.3-rc4 arrived on September 20 with fixes across filesystems, drivers and the x86 architecture.</p><p>A Btrfs change introduced during Linux 7.2 made <code>f_fsid</code> unstable across kernel updates and reboots. Applications using that identifier for credential encryption could lose access to stored data. NetworkManager&#8217;s OpenConnect integration was among the affected applications.</p><p>The fix restores the filesystem UUID-based calculation.</p><p>Another correction restores <code>/dev/root</code> detection for Btrfs systems using GRUB without an initramfs.</p><p>On Intel Xeon 6 Granite Rapids systems, the kernel will also prevent unsafe microcode upgrade sequences capable of triggering a machine-check exception.</p><p>These fixes show why kernel-upgrade testing should include VPN credentials, boot paths and application behaviour alongside conventional filesystem checks.</p><h2>Systemd 262 prepares smaller containers</h2><p>Systemd 262 reached RC3 on September 15.</p><p>PID 1 now embeds a minimal collection of essential unit files and can be built as a statically linked multicall binary. This allows very small containers to run systemd without installing the usual collection of unit files.</p><p>Systemd also gains <code>RestartRandomizedDelaySec=</code>, which spreads automatic restarts across time and helps prevent synchronized restart storms.</p><p>TPM-sealed credentials are now pinned to the TPM&#8217;s Storage Root Key, strengthening their protection against interposer attacks.</p><p>Administrators should watch several compatibility changes:</p><ul><li><p>One-shot D-Bus registrations of DNS-SD services now disappear when the registering client disconnects.</p></li><li><p><code>journalctl -F</code> rejects filters it previously accepted and silently ignored.</p></li><li><p>TPM credentials created with the new release cannot be opened by older systemd versions, affecting rollback procedures.</p></li></ul><h2>Gzip 1.15 fixes a race capable of deleting the wrong file</h2><p>GNU gzip 1.15 was released on September 20 with fixes for several long-standing correctness problems.</p><p>The most consequential correction addresses a race in which gzip could delete the wrong file if another process renamed an ancestor directory while gzip was replacing its output.</p><p>The release also fixes uninitialized-memory use, a buffer overflow involving sequential <code>.Z</code> and <code>.lzh</code> decompression, and corruption during some successive LZH operations.</p><p>Gzip sits inside backup jobs, log rotation, package creation and deployment pipelines. Administrators should track updates from their distributions because older package versions may receive the fixes through backports.</p><p></p><p></p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p><p>That&#8217;s it. If you found this useful, please leave a like, subscribe if you haven&#8217;t already, and share it with someone who might enjoy it too.</p><p>Until next time, keep exploring.</p>]]></content:encoded></item><item><title><![CDATA[Switzerland Is Spending $11 Million to Test Life Beyond Microsoft 365]]></title><description><![CDATA[The Swiss federal administration will introduce an open-source workplace on 3,000 computers as it looks for greater control over government data and digital infrastructure.]]></description><link>https://blog.sysxplore.com/p/switzerland-is-spending-11-million</link><guid isPermaLink="false">https://blog.sysxplore.com/p/switzerland-is-spending-11-million</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 14 Sep 2026 14:22:15 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/a90b6629-0882-4fac-a6c8-f38aee12beee_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Switzerland is investing 9 million Swiss francs, approximately $11.1 million, in an open-source alternative to Microsoft 365.</p><p>The project will introduce openDesk across 3,000 federal workstations by the end of 2027. These computers represent around 7% of the 54,000 machines used throughout the Swiss federal administration.</p><p>The migration follows a proof of concept involving 172 federal employees. Participants tested whether an open-source workplace could handle everyday tasks currently performed through Outlook, Teams, Word, Excel and other Microsoft 365 services.</p><p>The results were promising enough for the Swiss Federal Council to approve a much larger rollout.</p><p>Microsoft 365 will continue operating alongside openDesk during the pilot. This gives employees access to their existing tools while the government tests the new platform under real working conditions.</p><p>The wider goal is digital sovereignty: giving Switzerland greater control over the software, infrastructure and data used to run its public administration.</p><h2>What Switzerland is moving to</h2><p>The platform selected for the pilot is called openDesk.</p><p>It was developed for public-sector organisations by the German Centre for Digital Sovereignty, known as ZenDiS. Instead of attempting to reproduce the complete Microsoft 365 platform through one enormous application, openDesk brings several established open-source projects together into an integrated workplace.</p><p>Its components include:</p><ul><li><p>Collabora Online for documents, spreadsheets and presentations</p></li><li><p>Open-Xchange for email, calendars and contacts</p></li><li><p>Nextcloud for file storage, synchronisation and sharing</p></li><li><p>Element and Matrix for messaging and direct calls</p></li><li><p>Jitsi for video conferences</p></li><li><p>OpenProject for project management</p></li><li><p>XWiki for documentation and knowledge management</p></li><li><p>CryptPad for collaborative diagrams</p></li><li><p>Nubus for identity and access management</p></li></ul><p>Employees access these services through a common portal with centralised authentication.</p><p>This gives government organisations a complete collaboration environment while preserving the ability to operate the software on infrastructure they control.</p><h2>The first test involved 172 employees</h2><p>Switzerland began with a smaller proof-of-concept project known as PoC BOSS.</p><p>A group of 172 federal employees used openDesk for common office tasks, including email, document processing and collaboration. The trial examined whether the platform could support daily government work and provide a practical alternative to Microsoft&#8217;s cloud services.</p><p>Document editing and email received positive assessments.</p><p>Large video conferences still presented technical limitations. Microsoft Teams has benefited from years of development and deployment across large organisations, so matching its performance and integration will require additional work.</p><p>The federal government still considered the overall trial successful.</p><p>The next phase expands the test from 172 people to 3,000 workstations, creating a much better picture of how openDesk performs at scale.</p><p>&#128514; Yes, it&#8217;s good. The &#8220;sponsor, which is me&#8221; line gives it personality and makes the self-promotion feel natural instead of forcing an ad into the article.</p><p>I&#8217;d only remove the emoji from my version and keep your original joke clean:</p><h2>A quick word from the sponsor</h2><p>This article is made possible by our sponsor, which is me.</p><p>If you&#8217;ve been struggling with Linux and everything still feels confusing, look no further. I wrote this Linux Bible specifically for you.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Vlab!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Vlab!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Vlab!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Vlab!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Vlab!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!Vlab!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:285671,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/215667624?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Vlab!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg 424w, https://substackcdn.com/image/fetch/$s_!Vlab!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg 848w, https://substackcdn.com/image/fetch/$s_!Vlab!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!Vlab!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe11923d0-74c1-4120-a98a-0234d4bc8a93_2048x2048.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p><em>First Steps with Linux</em> takes you from knowing absolutely nothing about Linux to becoming a confident Linux user and sysadmin.</p><p>Available in both paperback and Kindle.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://firststepswithlinux.com/paperback&quot;,&quot;text&quot;:&quot;Check it out&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://firststepswithlinux.com/paperback"><span>Check it out</span></a></p><p></p><h2>Why spend $11 million on open-source software?</h2><p>Open-source software can be downloaded without paying a traditional proprietary licence, but a government migration still requires substantial investment.</p><p>Switzerland must deploy and operate the infrastructure, integrate it with existing systems, migrate accounts and data, configure identity management, train employees, provide technical support and maintain the environment.</p><p>Documents and workflows developed around Microsoft formats also need to remain usable. Macros, templates, calendars, shared mailboxes and business processes can create compatibility problems long after the applications themselves have been installed.</p><p>The 9 million Swiss franc budget supports this transition.</p><p>Software freedom gives the government more control over the platform. Achieving that control requires engineers, infrastructure, testing and long-term maintenance.</p><p>The project&#8217;s success will depend on whether openDesk can become a dependable working environment for thousands of employees.</p><h2>Digital sovereignty is driving the migration</h2><p>Governments increasingly depend on a small group of foreign technology companies for email, documents, communication, identity management and cloud storage.</p><p>This concentration creates a strategic concern.</p><p>When a public institution moves its work into a proprietary cloud platform, the provider controls important parts of the underlying technology. The institution must follow the vendor&#8217;s product changes, licensing conditions, pricing decisions and technical roadmap.</p><p>The provider may also fall under laws from another country.</p><p>Microsoft is based in the United States and is subject to American legislation, including the CLOUD Act. Under certain legal processes, US authorities can require American companies to provide access to data under their control, including some information stored in overseas data centres.</p><p>Keeping data inside Switzerland can address its physical location. Control over the provider and encryption keys determines who may ultimately gain access to it.</p><p>Swiss data-protection authorities have previously warned public bodies about using international cloud services for highly sensitive information when the provider can access the data or its encryption keys.</p><p>An independently operated open-source platform gives the government more control over where information is stored, who operates the infrastructure and how the software handles that information.</p><h2>Open source gives Switzerland more options</h2><p>Access to source code allows an organisation to inspect software, adapt it and choose who provides technical support.</p><p>It also makes switching infrastructure providers more practical.</p><p>A government using openDesk could operate it internally, contract a Swiss provider or move it between compatible hosting environments. The availability of the software&#8217;s code and deployment architecture creates more room to make those choices.</p><p>OpenDesk also uses widely deployed projects such as Nextcloud, Collabora, Matrix and Jitsi. Switzerland can benefit from their existing communities while contributing improvements that other public institutions may reuse.</p><p>This can turn government technology spending into shared digital infrastructure.</p><p>When several European governments need secure document collaboration, messaging and file storage, they can cooperate around common open-source components instead of purchasing separate proprietary platforms indefinitely.</p><h2>The migration will be gradual</h2><p>Replacing office software across a government requires more than installing different applications.</p><p>Employees build years of habits around familiar menus, shortcuts and workflows. Departments may depend on complex spreadsheets, Microsoft-specific document formatting, Outlook integrations and automated processes written for the existing environment.</p><p>External organisations may also continue sending Microsoft Office documents that must open and render correctly.</p><p>Switzerland&#8217;s parallel deployment allows employees to test openDesk without immediately losing access to Microsoft 365. Administrators can identify incompatibilities, improve training and determine which departments are suitable for migration.</p><p>By the end of 2027, the government should have enough information to decide whether the platform can expand beyond the initial 3,000 computers.</p><p>A successful pilot could eventually influence the remaining federal workstations.</p><h2>Switzerland&#8217;s military is moving faster</h2><p>The Swiss military is conducting a separate migration on a faster schedule.</p><p>Its Cyber Command is expected to move away from Microsoft 365 collaboration services and complete its transition to openDesk by October 2026.</p><p>Military communications and operational information carry particularly strict sovereignty requirements. Control over infrastructure, software updates and data access becomes an essential security consideration in that environment.</p><p>The military migration will provide another large-scale test of openDesk and may reveal lessons that help the civilian federal administration.</p><h2>Europe is building alternatives to foreign cloud platforms</h2><p>Switzerland&#8217;s project forms part of a wider European movement toward digital sovereignty.</p><p>Germany created ZenDiS to help public authorities adopt open-source software and reduce their dependence on individual vendors. The organisation now develops and coordinates openDesk as a reusable workplace for government institutions.</p><p>France has also invested in domestic and open-source collaboration tools. The European Union continues to examine how critical public infrastructure can remain under European legal and operational control.</p><p>These projects reflect a growing understanding that office software has become part of national infrastructure.</p><p>Government employees use these platforms to exchange documents, discuss policies, schedule meetings and store institutional knowledge. Losing access to them, facing sudden licensing changes or depending on decisions made by a foreign provider can affect the operation of the state.</p><p>Open-source platforms provide another path, particularly when governments cooperate on their development and maintenance.</p><h2>The pilot will reveal the real cost of independence</h2><p>The $11 million investment will attract attention because open-source software is often described as free.</p><p>The more useful question is what Switzerland receives from that investment.</p><p>The government is paying to develop the skills, infrastructure and operational capacity required to control its own digital workplace. It is also creating leverage by proving that another platform can perform at least part of the work currently handled by Microsoft 365.</p><p>Even a partial migration can reduce dependency and strengthen the government&#8217;s position when negotiating future cloud and software contracts.</p><p>The pilot will also reveal where openDesk still needs improvement. Video conferencing, document compatibility, user training and integration with existing systems are likely to determine how far the migration can expand.</p><p>By the end of 2027, Switzerland should know whether openDesk can support a much larger portion of its federal workforce.</p><p>The most important result may extend beyond the number of computers migrated. Switzerland is investing in the ability to choose how its public administration operates, where its data lives and which organisations control the tools behind it.</p><p>That ability is becoming a central part of digital sovereignty.</p><p>That&#8217;s it. If you found this useful, please leave a like, subscribe if you haven&#8217;t already, and share it with someone who might enjoy it too.</p><p>Until next time, keep exploring.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[Linux 7.3 Brings Performance Improvements Across the Kernel]]></title><description><![CDATA[Faster filesystems, smarter CPU scheduling and substantial latency reductions are among the improvements now being tested in Linux 7.3.]]></description><link>https://blog.sysxplore.com/p/linux-73-brings-performance-improvements</link><guid isPermaLink="false">https://blog.sysxplore.com/p/linux-73-brings-performance-improvements</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Thu, 03 Sep 2026 03:50:42 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/8e0b895b-ce54-4969-894c-e8bbc63655a1_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Linux 7.3 is beginning to take shape as one of the more performance-focused kernel updates in recent years.</p><p>The first release candidate arrived on August 30, closing the merge window and beginning the testing phase. The major features expected to appear in the final release have now landed.</p><p>Many of the improvements focus on keeping Linux responsive when the system is busy.</p><p>That includes filesystems processing large amounts of I/O, applications competing for CPU time, servers operating under memory pressure and latency-sensitive workloads waiting for other processor cores.</p><p>Each improvement targets a particular bottleneck, so the results will depend heavily on the hardware and workload. Together, they show how Linux is becoming better at handling demanding conditions.</p><h2>Btrfs receives substantial performance improvements</h2><p>Btrfs is one of the biggest beneficiaries of Linux 7.3.</p><p>One of the most important changes affects Direct I/O. This allows applications to read and write data while bypassing the normal filesystem page cache. Databases and other storage-intensive applications often use it because they already manage their own caching.</p><p>Direct I/O has strict alignment requirements. Some Btrfs operations that failed to meet them previously moved to the buffered I/O path, limiting how much of the storage device&#8217;s available throughput the workload could use.</p><p>Linux 7.3 introduces an IOmap bounce-buffer mechanism that keeps more operations on the Direct I/O path. According to the <a href="https://lore.kernel.org/lkml/cover.1787152457.git.dsterba@suse.com/">Btrfs pull request</a>, testing increased the achievable throughput from around half of the theoretical maximum to approximately 95%.</p><p>Btrfs also receives improvements to its logging and <code>fsync()</code> paths.</p><p>One change removes an unnecessary delay when several tasks attempt to perform logging operations concurrently. Another avoids searching for holes during a full <code>fsync()</code> when the kernel already knows that the file contains many extents and contains no holes.</p><p>The affected tests recorded improvements of around three to five times. These gains apply to specific filesystem operations, so the effect will vary between Btrfs workloads.</p><p>The default free-space cache is also moving from version 1 to the newer free-space tree. This implementation stores free-space information inside the Btrfs metadata tree and provides better reliability and scalability on large filesystems.</p><p>Administrators running Btrfs will receive most of these improvements automatically when Linux 7.3 reaches their distributions.</p><h2>EXT4 and IOmap get faster on modern NVMe storage</h2><p>EXT4 also receives several storage improvements.</p><p>The filesystem can now allow more parallel Direct I/O writes in situations where those operations were previously serialized. Its multi-block allocator also avoids some unnecessary work when applications use <code>fallocate()</code> to reserve space.</p><p>Below the filesystem itself, Linux 7.3 contains a significant reworking of IOmap, the kernel infrastructure used by filesystems to map file operations onto storage.</p><p>The new implementation uses a single callback that the compiler can inline, reducing overhead on a particularly busy I/O path.</p><p>The difference becomes more visible on very fast storage, where software processing can limit how quickly the operating system feeds requests to the device. In the <a href="https://lore.kernel.org/lkml/20260814-vfs-7.3-rc1.iomap-78c92ce13812@brauner/">submitted IOmap testing</a>, EXT4 performance increased from approximately 1.92 million to 2.19 million IOPS on fast NVMe storage.</p><p>That represents an improvement of around 14% in the tested workload.</p><p>The result shows how refinements inside the kernel can help filesystems take better advantage of increasingly fast storage hardware.</p><h2>CPU scheduling gets smarter</h2><p>Linux 7.3 also includes important scheduler work.</p><p>Linux distributes runnable tasks across a hierarchy of scheduling groups. This supports features such as control groups, but repeatedly walking that hierarchy can introduce overhead and produce less consistent scheduling decisions.</p><p>The new &#8220;flatten the pick&#8221; work simplifies parts of that process by allowing the scheduler to select tasks from a flatter run queue.</p><p>Testing on an older Intel Sandy Bridge system paired with a Radeon RX 580 showed improvements in both frame rates and frame-time consistency while gaming.</p><p>Frame-time consistency determines how smoothly individual frames appear. An inconsistent delivery rate can make a game feel choppy even when its average frame rate appears reasonable. Reducing scheduling delays can create a smoother experience, particularly on older and CPU-constrained systems.</p><p>Linux 7.3 also improves scheduling on Intel hybrid processors containing both Performance and Efficiency cores.</p><p>These processors require the scheduler to decide when a task should run and which kind of core should handle it.</p><p>Previous cluster-aware scheduling behaviour did not always represent Intel&#8217;s hybrid topology correctly. The <a href="https://lore.kernel.org/all/20260720-rneri-fix-cas-clusters-v6-0-bb500bf4afd4@linux.intel.com/">new scheduler work</a> improves that handling across processors including Alder Lake, Lunar Lake and Panther Lake.</p><p>This should improve task placement when demanding applications and background processes compete for different kinds of CPU cores.</p><h2>Fewer stalls under memory pressure</h2><p>Some of the most dramatic Linux 7.3 numbers come from memory-management fixes.</p><p>Kernel Samepage Merging, or KSM, allows identical memory pages to be combined. It is particularly useful in virtualization environments where several virtual machines may contain the same operating-system data.</p><p>Before merging or modifying these pages, the kernel sometimes needs to determine which virtual memory areas reference them. Under heavy memory pressure, a problem in this reverse-mapping process could hold an internal lock for hundreds of milliseconds.</p><p>Anything else waiting for that lock had to stop.</p><p>In the affected test, the worst delay reached approximately 700 milliseconds. The <a href="https://lore.kernel.org/all/20260703162253688u8Str9eFLR8TGCmo7nIOF@zte.com.cn/">Linux 7.3 fix</a> reduced it to below two milliseconds.</p><p>For virtualized systems and workloads using KSM under pressure, this could translate into fewer unexplained pauses.</p><p>Another improvement reduces locking contention inside <code>zsmalloc</code>, the memory allocator used by zRAM and Zswap to store compressed pages.</p><p>When many processes released compressed memory simultaneously, they could contend for the same locks. The <a href="https://lore.kernel.org/all/20260626015003.2965881-1-haowenchao22@gmail.com/">new implementation</a> distributes some of that work more effectively.</p><p>A Raspberry Pi 4B showed improvements of up to 1.83 times in the submitted test, while a 20-core Intel system reached up to 1.4 times.</p><p>The larger improvement on the Raspberry Pi is particularly interesting. Compressed memory is commonly used on devices with limited RAM, which is also where unnecessary allocator overhead becomes especially noticeable.</p><h2>Executed programs stay in memory longer</h2><p>Linux 7.3 also changes how Multi-Gen LRU treats executable pages.</p><p>Multi-Gen LRU helps the kernel decide which memory pages are actively being used and which can be reclaimed when memory becomes scarce.</p><p>Mapped executable pages could previously be reclaimed too aggressively, even after the code had recently been executed. If the application needed that code again, the system had to read it back from storage.</p><p>Linux 7.3 promotes these pages after their first use, making frequently executed code less likely to be selected immediately for reclaim.</p><p>In testing on a deliberately memory-constrained 32-core Arm build system, system CPU time fell from 9,248 seconds to approximately 7,862 seconds. A similar improvement was observed on x86.</p><p>The benefit should be most visible on oversubscribed virtual machines, dense container hosts and build systems where executable code regularly competes with application data for memory.</p><h2>Lower latency for real-time and networking workloads</h2><p>Another Linux 7.3 change targets communication between processor cores.</p><p>When one CPU asks other CPUs to perform work using an inter-processor interrupt, it may need to wait for those processors to complete the request. The kernel previously kept preemption disabled for the entire operation, including while waiting for remote CPUs to respond.</p><p>That could create substantial latency spikes. A high-priority task ready to run on the waiting CPU had to wait until the operation finished.</p><p>Linux 7.3 allows preemption to be re-enabled during the waiting period. The CPU can therefore run another eligible task while the request completes.</p><p>In testing with the Data Plane Development Kit, or DPDK, P99 latency dropped from approximately 17 milliseconds to 1.5 milliseconds. That represents a reduction of around 90%.</p><p>The change is especially relevant to packet processing, telecommunications and real-time workloads where predictable response time is essential.</p><p>A server may process a large number of requests per second while a small percentage experience long delays. This improvement helps reduce those latency spikes.</p><h2>What Linux 7.3 improves</h2><p>The performance story of Linux 7.3 comes from several targeted changes across the kernel:</p><ul><li><p>Btrfs avoids slow paths during important Direct I/O and <code>fsync()</code> operations.</p></li><li><p>EXT4 and IOmap reduce overhead on fast storage.</p></li><li><p>The scheduler makes better decisions on constrained and hybrid CPUs.</p></li><li><p>Memory-management fixes remove long stalls under pressure.</p></li><li><p>zRAM and Zswap handle concurrent memory operations more effectively.</p></li><li><p>SMP changes reduce latency for high-priority workloads.</p></li></ul><p>These improvements will appear in different places and under different conditions. A desktop user may notice smoother frame delivery. A database server may benefit from faster filesystem operations. A container host may experience fewer memory-related stalls. A packet-processing system may see much lower tail latency.</p><p>Linux 7.3-rc1 is currently in the testing stage. Features can still be adjusted, and regressions may be discovered before the stable release arrives.</p><p>Once Linux 7.3 is stable, most users will receive it through their distributions. Administrators can then test it against their own hardware and workloads to determine which improvements apply to their environments.</p><p>Linux 7.3 focuses on the bottlenecks that appear when systems are busy: storage contention, memory pressure, CPU scheduling and latency. These improvements target the conditions where performance matters most.</p><p>If you found this useful, please leave a like, subscribe if you haven&#8217;t already, and share it with someone who might enjoy it too.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p><p>Until next time, keep exploring.</p>]]></content:encoded></item><item><title><![CDATA[Kubernetes Gets More Serious About Resilience, Debian Makes Its AI Decision, and Linux 7.3 Enters Testing]]></title><description><![CDATA[Three developments stood out this week: Kubernetes 1.37 introduced meaningful changes to control-plane resilience and workload identity, Debian decided how it will handle AI-assisted contributions, and Linux 7.3 entered testing with an interesting improvement for systems under heavy memory pressure.]]></description><link>https://blog.sysxplore.com/p/kubernetes-137-debian-ai-linux-73</link><guid isPermaLink="false">https://blog.sysxplore.com/p/kubernetes-137-debian-ai-linux-73</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 31 Aug 2026 13:54:25 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/ddafd838-3d76-42da-af02-56b7b0789aa9_1536x1024.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Three developments stood out this week: Kubernetes 1.37 introduced meaningful changes to control-plane resilience and workload identity, Debian decided how it will handle AI-assisted contributions, and Linux 7.3 entered testing with an interesting improvement for systems under heavy memory pressure.</p><h2>Kubernetes 1.37 changes control-plane resilience and workload identity</h2><p>Kubernetes 1.37 was released on August 26 with 67 enhancements. The most important changes are operational rather than cosmetic.</p><p>API-server watch-cache initialization can now reject excess requests with HTTP 429 instead of allowing recovery traffic to overwhelm <code>etcd</code>. Memory QoS is now Beta and enabled by default, although its conservative defaults avoid immediately throttling existing workloads.</p><p>Pod Certificates and Cluster Trust Bundles also bring native X.509 workload identity into Kubernetes. This gives workloads a built-in mechanism for obtaining short-lived certificates and discovering the trust bundles needed to verify other services.</p><p>SELinux volume mounting now prefers mount-time labels when supported by the CSI driver. This can improve performance, but it also introduces a potential compatibility issue: pods using different SELinux labels may fail to start when sharing the same volume on one node.</p><p>HPA scale-to-zero is now Beta and enabled by default for workloads using external or object metrics. The Metrics API has also finally reached stable <code>v1</code>, although the Horizontal Pod Autoscaler still consumes <code>v1beta1</code> in this release.</p><p><a href="https://kubernetes.io/blog/2026/08/26/kubernetes-v1-37-release/">Official Kubernetes 1.37 announcement</a><br><a href="https://kubernetes.io/blog/2026/08/28/kubernetes-v1-37-pod-certificates-and-cluster-trust-bundles/">Pod Certificates and Cluster Trust Bundles</a><br><a href="https://kubernetes.io/blog/2026/08/27/kubernetes-v1-37-metrics-api-ga/">Metrics API transition details</a></p><h3>Why it matters</h3><p>Kubernetes is moving beyond basic container orchestration into workload identity, memory management and failure containment.</p><p>The new HTTP 429 behavior is particularly important. During control-plane recovery, custom controllers that retry requests aggressively can make the situation worse. Kubernetes can now protect <code>etcd</code> from some of that traffic, but operators still need to ensure their controllers implement proper retry and backoff behavior.</p><p>Before upgrading, administrators should test custom controllers, metrics-server compatibility and workloads that share storage across different SELinux contexts.</p><p>Native X.509 workload identity is another important step. Service-account tokens are useful, but they were never going to be the complete answer for service-to-service trust inside Kubernetes. Pod Certificates bring certificate-based authentication closer to the core platform.</p><h2>Debian rejected both an AI ban and mandatory disclosure</h2><p>On August 29, Debian developers selected the &#8220;Responsible Use of Generative AI&#8221; option in a project-wide vote.</p><p>Debian will neither endorse nor prohibit AI-assisted contributions. Contributors remain responsible for understanding, reviewing, testing and legally justifying everything they submit, regardless of which tools helped produce it.</p><p>Disclosure of AI use is encouraged but not required.</p><p>The resolution also warns contributors against sending private information, credentials or embargoed security details to third-party AI services. Prior discussion is required before using automated systems for mass bug filing, patch submission or other project-wide activity.</p><p><a href="https://www.debian.org/vote/2026/vote_002">Official Debian vote and full resolution</a><br><a href="https://lists.debian.org/debian-vote/2026/08/msg00360.html">Published voting results</a></p><h3>Why it matters</h3><p>Debian chose to judge contributions by their quality and hold the person submitting them accountable.</p><p>Tools do not sign uploads. People do.</p><p>That is a practical position because enforcing a complete ban would be nearly impossible. Mandatory disclosure would also introduce a rule that depends heavily on contributors reporting their own tool usage accurately.</p><p>However, voluntary disclosure does not solve the additional review burden placed on maintainers. A polished contribution can still contain fabricated explanations, subtle regressions or code the submitter does not properly understand.</p><p>Debian&#8217;s decision makes the responsibility clear: using AI does not transfer accountability away from the contributor.</p><h2>Linux 7.3 enters testing with better memory-pressure handling</h2><p>Linux 7.3-rc1 was released on August 30, closing another large kernel merge window.</p><p>Roughly one-third of the raw diff comes from AMD&#8217;s new DCN6 GPU register definitions, so the amount of changed code makes the release appear functionally larger than it really is.</p><p><a href="https://lwn.net/Articles/1091420/">Linus Torvalds&#8217; release announcement</a><br><a href="https://www.kernel.org/">Official Linux kernel archive</a></p><p>One of the more interesting sysadmin-facing changes is an improvement to Multi-Gen LRU, or MGLRU, memory reclaim.</p><p>Mapped executable pages are now promoted after their first use. This makes frequently executed code less likely to be reclaimed and later reread from storage when the system is under heavy memory pressure.</p><p>In the submitted benchmarks, system CPU time fell from 9,248 seconds to 7,862 seconds on a deliberately constrained 32-core Arm build system. A similar improvement was demonstrated on x86.</p><p><a href="https://lwn.net/Articles/1083238/">Maintainer patch discussion and benchmark</a></p><h3>Why it matters</h3><p>This change could benefit oversubscribed virtual machines, dense container hosts and memory-constrained build systems where executable pages compete aggressively with application data.</p><p>It should not be interpreted as a universal 15% performance improvement. The tests deliberately created extreme memory contention, and lightly loaded systems may see little difference.</p><p>Still, it reflects where a lot of interesting kernel performance work is now happening. Modern systems are already fast when resources are plentiful. The harder problem is making them behave well when memory, CPU time and storage bandwidth are under pressure.</p><p>Better reclaim decisions can make an overloaded server less wasteful, but they remain a complement to proper capacity planning rather than a replacement for it.</p><p></p><p>That&#8217;s it. If you found this useful, please leave a like, subscribe if you haven&#8217;t already, and share it with someone who might enjoy it too.</p><p>Until next time, keep exploring.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[First Steps With Linux — Now in Paperback]]></title><description><![CDATA[It took longer than I expected, but the paperback is finally here.]]></description><link>https://blog.sysxplore.com/p/first-steps-with-linux-now-in-paperback</link><guid isPermaLink="false">https://blog.sysxplore.com/p/first-steps-with-linux-now-in-paperback</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Fri, 24 Jul 2026 18:20:14 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!vhCe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd4922e5-3b00-48a2-a40b-d4f435879cbc_4284x4284.heic" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It&#8217;s been a while.</p><p>The last time I wrote here, I was announcing the release of <strong>First Steps With Linux</strong> after nearly two years of writing.</p><p>Since then, things haven&#8217;t exactly slowed down.</p><p>I&#8217;ve continued improving the book, updating chapters, redesigning diagrams, releasing a Dark Edition, and working on something many readers had been asking for from the very beginning.</p><p>A paperback.</p><p>Today I&#8217;m happy to finally say:</p><p><strong>First Steps With Linux is now available in <a href="https://www.amazon.com/dp/B0H3FB66B7">paperback</a>.</strong></p><div class="image-gallery-embed" data-attrs="{&quot;gallery&quot;:{&quot;images&quot;:[{&quot;src&quot;:&quot;https://substackcdn.com/image/fetch/$s_!vhCe!,w_200,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdd4922e5-3b00-48a2-a40b-d4f435879cbc_4284x4284.heic&quot;},{&quot;type&quot;:&quot;image/heic&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f542d8c2-3343-44a6-9a63-e53831f3541c_4284x4284.heic&quot;}],&quot;caption&quot;:&quot;&quot;,&quot;alt&quot;:&quot;&quot;,&quot;staticGalleryImage&quot;:{&quot;type&quot;:&quot;image/png&quot;,&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/877e4dde-bd56-476b-bf13-0969556ac8e1_1456x720.png&quot;}},&quot;isEditorNode&quot;:true}"></div><p>Holding the finished copy in my hands for the first time was surreal.</p><p>After spending thousands of hours writing, editing, redesigning diagrams, and refining explanations, seeing it as a real book made all those late nights worth it.</p><p>I&#8217;m incredibly proud of how it turned out.</p><h2>It wasn&#8217;t as simple as pressing &#8220;Print&#8221;</h2><p>I assumed turning the manuscript into a paperback would be the easy part.</p><p>I was wrong.</p><p>Finding a publisher that could actually print a technical book of this size took far longer than I expected. After trying several options, I eventually settled on Amazon KDP.</p><p>Then another challenge appeared.</p><p>The manuscript exceeded KDP&#8217;s page limit for the trim size I originally wanted.</p><p>The obvious solution was to split the book into two separate volumes.</p><p>I didn&#8217;t want to do that.</p><p>From day one, the vision was simple.</p><p><strong>Everything in one book.</strong></p><p>One book you can keep on your desk.</p><p>One place to learn Linux from the ground up and keep coming back to as your skills grow.</p><p>So instead of splitting it, I went back and reworked the layout page by page. I adjusted spacing, optimized the formatting, and removed every bit of unnecessary whitespace until the manuscript finally fit within the printing limits.</p><p>I also chose a larger <strong>8.5 &#215; 11-inch</strong> format. It meant giving up some of Amazon&#8217;s distribution options, but I was happy to make that trade.</p><p>Having the complete book in a single volume mattered more to me than wider distribution.</p><p>It took far longer than I expected.</p><p>But it was worth every minute.</p><h2>Where to get the paperback</h2><p>If you&#8217;ve been waiting for a physical copy, it&#8217;s finally here.</p><p>You can get your copy on Amazon:</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://www.amazon.com/dp/B0H3FB66B7&quot;,&quot;text&quot;:&quot;Get the Paperback&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://www.amazon.com/dp/B0H3FB66B7"><span>Get the Paperback</span></a></p><h2>More than just another Linux book</h2><p>When I started writing <strong>First Steps With Linux</strong>, my goal wasn&#8217;t simply to write another Linux guide.</p><p>I wanted to create a resource that teaches Linux as a system&#8212;not just as a collection of commands.</p><p>Something that helps readers connect the dots, build confidence, and understand why things work the way they do.</p><p>Seeing that idea become a physical book has been one of the most rewarding moments of my career.</p><h2>Thank you</h2><p>This newsletter has played a much bigger role in this project than you might realize.</p><p>Many of the explanations in the book were inspired by questions from readers.</p><p>Many of the diagrams started as ideas for articles published here.</p><p>And many improvements came directly from the feedback you shared over the years.</p><p>So thank you.</p><p>Your support helped shape this book from the very beginning.</p><h2>What&#8217;s next?</h2><p>Now that the paperback is finally out, I can get back to doing what started all of this.</p><p><strong>Writing.</strong></p><p>It&#8217;s been a little quiet around here, and I appreciate everyone who stuck around while I was focused on the book.</p><p>I&#8217;ve got a long list of Linux deep dives, tutorials, and behind-the-scenes articles I&#8217;ve been wanting to write, and I&#8217;m looking forward to publishing regularly again.</p><p>I&#8217;ve also been thinking about expanding the newsletter a little. Alongside Linux articles, I&#8217;d like to start sharing certification preparation material for readers working towards <strong>RHCSA</strong>, <strong>CompTIA Linux+</strong>, and <strong>LFCS</strong>. I also plan to occasionally branch into networking, firewalls, and other infrastructure topics that naturally complement Linux.</p><p>The goal hasn&#8217;t changed.</p><p>To create practical, beginner-friendly content that helps you build real-world skills and become a more confident Linux and systems professional.</p><p>Thank you for reading, and I&#8217;ll see you in the next one.</p>]]></content:encoded></item><item><title><![CDATA[Spin Up Linux Virtual Machines Quickly with KVM Using Cloud Images]]></title><description><![CDATA[When most people start with virtualization, they reach for tools like VirtualBox or VMware.]]></description><link>https://blog.sysxplore.com/p/spin-up-linux-virtual-machines-quickly-with-kvm</link><guid isPermaLink="false">https://blog.sysxplore.com/p/spin-up-linux-virtual-machines-quickly-with-kvm</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Tue, 31 Mar 2026 19:48:23 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/0d16496b-85b4-491f-ba8a-395b601ce5f0_5000x2625.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When most people start with virtualization, they reach for tools like VirtualBox or VMware.</p><p>You install the software, open the interface, create a new virtual machine, attach an ISO, and go through the operating system installation step by step.</p><p>It works.</p><p>Linux also provides a native virtualization stack built around KVM and QEMU.</p><p>With it, you can work directly with virtual machine disk images and build systems in a faster and more flexible way.</p><p>Instead of performing a full operating system installation each time, you can start from an existing image, prepare it for your environment, and run it as a virtual machine.</p><p>This approach is common in real-world environments where systems need to be created quickly, tested, replaced, or rebuilt without repeating the same installation process each time.</p><p>In this guide, you will use KVM to build a simple lab environment by importing and working with disk images.</p><p>You will go through the process step by step, from preparing the image to creating the virtual machine and accessing it.</p><h2><strong>Checking if your system supports virtualization</strong></h2><p>Before working with KVM, your system needs to support hardware virtualization.</p><p>Most modern CPUs already support it, but it&#8217;s worth verifying.</p><p>Run the following command:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ grep -E 'vmx|svm' /proc/cpuinfo</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!AhV4!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!AhV4!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 424w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 848w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 1272w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!AhV4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png" width="1036" height="522" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:522,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:144635,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!AhV4!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 424w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 848w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 1272w, https://substackcdn.com/image/fetch/$s_!AhV4!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5c150d3e-1d21-46ca-8d7e-d1a3aa14a299_1036x522.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command looks inside /proc/cpuinfo, which contains information about your processor, and searches for specific flags.</p><p>The vmx flag indicates Intel virtualization support, while svm indicates AMD virtualization support.</p><p>If your system supports virtualization, you should see one of these flags in the output, usually repeated across multiple lines.</p><p>For example, you might see something like vmx or svm listed among the CPU features.</p><p>If you only want to confirm support without scrolling through the output, you can return the number of occurrences instead:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ egrep -c '(vmx|svm)' /proc/cpuinfo</code></pre></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!j4ai!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 424w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 848w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 1272w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!j4ai!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png" width="1036" height="150" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:150,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:16606,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!j4ai!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 424w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 848w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 1272w, https://substackcdn.com/image/fetch/$s_!j4ai!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2b95f09d-4b3f-4d19-9d2a-e22763788770_1036x150.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>A value greater than 0 confirms that virtualization is supported.</p><p>If these command returns no output, virtualization is either not supported or disabled in the BIOS or UEFI settings. In most cases, it is simply disabled, and you can enable it from your firmware settings under options such as Intel VT-x or AMD-V.</p><ul><li><p>KVM relies on hardware virtualization to run virtual machines efficiently. Without it, you won&#8217;t be able to use KVM as expected.</p></li></ul><h2><strong>Installing the KVM tools</strong></h2><p>KVM itself is part of the Linux kernel.</p><p>What you install are the tools used to create, manage, and interact with virtual machines.</p><p>For this demonstration, I&#8217;m using Fedora 42.</p><p>If you&#8217;re running Fedora or any Red Hat&#8211;based system, you can install the required packages with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo dnf install qemu-kvm libvirt virt-install guestfs-tools genisoimage virt-manager virt-viewer</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!f_-9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f_-9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 424w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 848w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 1272w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!f_-9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png" width="1036" height="519" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:519,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:157588,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!f_-9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 424w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 848w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 1272w, https://substackcdn.com/image/fetch/$s_!f_-9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F80f5a5c1-ad5e-48f3-85a1-8fa300c45e1e_1036x519.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>These packages give you everything needed to work with KVM.</p><p>qemu-kvm provides the virtualization backend, libvirt handles virtual machine management and networking, and virt-install allows you to create virtual machines from the command line.</p><p>The guestfs-tools package includes tools like virt-customize, which you&#8217;ll use later to prepare disk images.</p><p>The remaining tools, such as virt-manager and virt-viewer, provide graphical access if you need it, while genisoimage is useful when working with ISO files.</p><p>If you are using Ubuntu or another Debian-based system, you can install the equivalent tools with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo apt install qemu-kvm libvirt-daemon-system libvirt-clients virtinst libguestfs-tools genisoimage virt-manager virt-viewer</code></pre></div><p>After installation, make sure the libvirtd service is running:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ systemctl status libvirtd</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!_esa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_esa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 424w, https://substackcdn.com/image/fetch/$s_!_esa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 848w, https://substackcdn.com/image/fetch/$s_!_esa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 1272w, https://substackcdn.com/image/fetch/$s_!_esa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!_esa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png" width="1036" height="558" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:558,&quot;width&quot;:1036,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:128733,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_esa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 424w, https://substackcdn.com/image/fetch/$s_!_esa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 848w, https://substackcdn.com/image/fetch/$s_!_esa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 1272w, https://substackcdn.com/image/fetch/$s_!_esa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd1cb4d2f-5bfc-49fb-9b15-be7a4f53fc95_1036x558.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If it is not running, start and enable it:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo clearsystemctl start libvirtd
$ sudo systemctl enable libvirtd</code></pre></div><p>To manage virtual machines without using sudo, add your user to the libvirt group:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo usermod -aG libvirt $USER</code></pre></div><p>Instead of logging out and back in, you can apply the change immediately with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ newgrp libvirt</code></pre></div><p>The newgrp command allows you to switch your current session to a new group without logging out, so the updated permissions take effect right away.</p><p>If you prefer not to modify group membership, you can run the commands as root or continue using sudo.</p><blockquote><p>If your user is not part of the libvirt group, you may run into permission errors when creating or managing virtual machines.</p></blockquote><p>Now that the tools are installed, the next step is to get a disk image that we can use to build our lab.</p><div><hr></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!KgYn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!KgYn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 424w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 848w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 1272w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!KgYn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic" width="1200" height="630" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:630,&quot;width&quot;:1200,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:135726,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!KgYn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 424w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 848w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 1272w, https://substackcdn.com/image/fetch/$s_!KgYn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3b7ffa64-ac4a-401e-bbc9-c65cecc0fa43_1200x630.heic 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If you&#8217;re enjoying this article,</p><p>I wrote a 700+ page book teaching Linux step by step, with real examples you can follow and break safely in your own lab.</p><p>If you&#8217;re serious about learning Linux properly, check it out:</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://firststepswithlinux.com&quot;,&quot;text&quot;:&quot;FIRST STEPS WITH LINUX&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://firststepswithlinux.com"><span>FIRST STEPS WITH LINUX</span></a></p><div><hr></div><h2><strong>Getting a disk image</strong></h2><p>To avoid going through a full operating system installation, you&#8217;ll work with prebuilt disk images.</p><p>These images already contain a minimal operating system and are ready to be used as virtual machines.</p><p>Most of these images are distributed in the qcow2 format, which is commonly used with KVM and QEMU.</p><p>You can download ready-made images from the OpenStack image repository.</p><p>They provide minimal images for distributions like RHEL, Fedora, and Ubuntu.</p><p>These images are lightweight and designed to boot quickly, which makes them ideal for testing and lab environments.</p><p>For this demonstration, I&#8217;ll be using the lastest cloud image from Rocky Linux.</p><p>You can download it from their <a href="https://rockylinux.org/download">official site</a>.</p><p>Look for the <strong>Rocky Linux 10 cloud image (qcow2)</strong>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!QEI1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!QEI1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 424w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 848w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 1272w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!QEI1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png" width="1228" height="527" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:527,&quot;width&quot;:1228,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:36948,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!QEI1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 424w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 848w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 1272w, https://substackcdn.com/image/fetch/$s_!QEI1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2ee48eee-f01e-4596-9b39-02f8a672d8a8_1228x527.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Cloud images are minimal by design and are intended to be customized and deployed quickly.</p><p>Once you&#8217;ve downloaded the image, move it to the default directory used by libvirt:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo mv Rocky-10-GenericCloud-Base.latest.x86_64.qcow2 /var/lib/libvirt/images/rock-10.qcow2</code></pre></div><p>This is where libvirt expects virtual machine disk images to be stored.</p><p>In the example, I have moved and renamed the image to a new name (<code>rock-10.qcow2)</code>to make things simple.</p><p>The image is small when downloaded, but it will grow as you use it.</p><p>Make sure you have enough disk space available, especially if you plan to create multiple virtual machines.</p><p>At this point, you have a base image ready.</p><p>The next step is to prepare it for your environment before turning it into a virtual machine.</p><h2><strong>Preparing the disk image</strong></h2><p>The image you downloaded is minimal and not ready for direct use.</p><p>Cloud images are designed to be initialized dynamically, usually through tools like cloud-init.</p><p>For this setup, you&#8217;ll prepare the image manually so it behaves like a normal system.</p><p>To modify the image, you&#8217;ll use the virt-customize tool.</p><p>Run the following command:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo virt-customize \
-a /var/lib/libvirt/images/rock-10.qcow2 \
--hostname rocky-10-kvm-lab \
--root-password password:root \
--uninstall cloud-init \
--selinux-relabel</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!dOEK!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dOEK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 424w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 848w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 1272w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dOEK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png" width="1039" height="344" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:344,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:54654,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dOEK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 424w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 848w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 1272w, https://substackcdn.com/image/fetch/$s_!dOEK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe8b21bdd-6cc3-4a90-a9dc-68478ea593c2_1039x344.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command modifies the disk image before it is even booted.</p><p>The -a option specifies the path to the image.</p><p>The --hostname option sets the hostname of the virtual machine.</p><p>The --root-password option defines the root password. In this case, it is set to root.</p><p>The --uninstall cloud-init option removes cloud-init from the image. This avoids delays during boot, since the system will no longer wait for cloud-init configuration.</p><p>The --selinux-relabel option ensures that file contexts are correctly restored after making changes to the image. This is important on systems like Rocky Linux, Fedora, and other SELinux-enabled distributions.</p><blockquote><p>The image must not be running when you use virt-customize. You are modifying it offline.</p><p>The virt-customize tool provides many more options than what is shown here. You can explore them using the manual pages (man virt-customize) and experiment based on your needs.</p></blockquote><p>Now, the image is configured and ready to be used as a virtual machine.</p><p>The next step is to import it into KVM and create the virtual machine.</p><h2><strong>Creating the virtual machine</strong></h2><p>Now that the image is prepared, you can import it into KVM and create a virtual machine.</p><p>Run the following command:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo virt-install \
--name rocky-10-kvm-lab-demo \
--memory 1024 \
--vcpus 1 \
--disk /var/lib/libvirt/images/rock-10.qcow2 \
--import \
--os-variant rocky9.0 \
--noautoconsole</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DSYt!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DSYt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 424w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 848w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 1272w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!DSYt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png" width="1039" height="361" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:361,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:51975,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DSYt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 424w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 848w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 1272w, https://substackcdn.com/image/fetch/$s_!DSYt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae8fb326-c88e-43cb-9612-f02dffddfea5_1039x361.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command creates a virtual machine using the existing disk image.</p><p>The --name option defines the name of the virtual machine.</p><p>The --memory option sets the RAM in megabytes, and --vcpus defines how many virtual CPUs the system will use.</p><p>The --disk option points to the image you prepared earlier.</p><p>The --import option tells KVM to use the existing disk instead of installing a new operating system.</p><p>The --os-variant option helps optimize the virtual machine configuration for a specific operating system.</p><p>To see the operating systems available on your system, you can run:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ osinfo-query os</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!sMuS!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sMuS!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 424w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 848w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 1272w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sMuS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png" width="1039" height="350" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:350,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39896,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sMuS!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 424w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 848w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 1272w, https://substackcdn.com/image/fetch/$s_!sMuS!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feb6124f5-456b-431d-a978-289c3a20ed5f_1039x350.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This command queries the local OS information database and lists the operating systems recognized by libosinfo.</p><p>You can achieve the same thing with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virt-install --osinfo list</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!jf2R!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jf2R!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 424w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 848w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 1272w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!jf2R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png" width="1039" height="341" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/360852cb-5429-4f28-b74b-27473de2b057_1039x341.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:341,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41403,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jf2R!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 424w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 848w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 1272w, https://substackcdn.com/image/fetch/$s_!jf2R!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F360852cb-5429-4f28-b74b-27473de2b057_1039x341.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But <code>osinfo-query os</code> is prefered since it provides additional info.</p><p>If you want to narrow the output, you can pipe it to grep. For example:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ osinfo-query os | grep -i rocky</code></pre></div><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CYeW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CYeW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 424w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 848w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 1272w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CYeW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png" width="1039" height="430" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ae96856d-c229-429f-a4cb-9659a2143678_1039x430.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:430,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:67741,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CYeW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 424w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 848w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 1272w, https://substackcdn.com/image/fetch/$s_!CYeW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fae96856d-c229-429f-a4cb-9659a2143678_1039x430.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>On my system, the latest available entry is rocky9.0.</p><p>However, the image used in this demonstration is Rocky Linux 10.1.</p><p>You can still use the closest available match when specifying the operating system.</p><p>You can also use the newer --osinfo option, which is based on the same underlying database and provides a more flexible way to define the operating system:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">--osinfo detect=on,name=rocky9.0.</code></pre></div><p>This tells libvirt to use information from the OS database to configure the virtual machine.</p><p>The detect=on option first tries to detect the operating system from the disk image.</p><p>If detection fails, it falls back to the value provided with name=rocky10.0.</p><p>This helps ensure that the virtual machine is created with suitable defaults for that operating system.</p><h2><strong>Accessing the virtual machine</strong></h2><p>Once the virtual machine is created, it starts running in the background.</p><p>To confirm that it is running, you can list active virtual machines:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh list</code></pre></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iAsf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iAsf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png" width="1039" height="208" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:208,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21200,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iAsf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!iAsf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2f00c22b-b1c6-4db4-857c-7da3b01d5097_1039x208.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>To connect to the system, you first need its IP address.</p><p>You can retrieve it using:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo virsh domifaddr rocky-10-kvm-lab-demo</code></pre></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nudP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!nudP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!nudP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!nudP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nudP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png" width="1039" height="208" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:208,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:25227,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nudP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!nudP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!nudP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!nudP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1c7106c8-e27a-4950-833a-d203bde279ba_1039x208.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>This command shows the network interfaces associated with the virtual machine, including the assigned IP address.</p><p>Look for an entry under the address column.</p><p>Once you have the IP address, connect using SSH:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ ssh root@192.168.122.227</code></pre></div><p>Use the root password you configured earlier. N</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cm4u!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!cm4u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png" width="1039" height="208" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:208,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39673,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cm4u!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 424w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 848w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 1272w, https://substackcdn.com/image/fetch/$s_!cm4u!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa96757a2-5644-469f-a11c-decd8f868f2d_1039x208.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>You&#8217;ll notice the password does not work. SSH attempts different authentication methods and eventually fails with:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)</code></pre></div><p>This is a good opportunity to understand what is happening.</p><p>On many cloud images, especially Rocky, root login using a password over SSH is disabled by default, even if a root password is set.</p><p>This means the system allows SSH access, but refuses password-based login for root.</p><p>A few common reasons for this behavior:</p><ul><li><p><code>PermitRootLogin</code> is set to <code>prohibit-password</code> or <code>without-password</code></p></li><li><p><code>PasswordAuthentication</code> is disabled</p></li><li><p>The image is designed to use SSH keys instead of passwords</p></li></ul><p>In this setup, you did not inject an SSH key, so SSH has no valid authentication method to use.</p><p>To confirm this, connect to the virtual machine console:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sudo virsh console rocky-10-kvm-lab-demo</code></pre></div><p>If the login prompt does not appear immediately, press <code>Enter</code> a few times.</p><p>Log in as <code>root</code> using the password <code>root</code>.</p><p>Once inside, check the effective SSH configuration:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sshd -T | grep -E 'permitrootlogin|passwordauthentication'</code></pre></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!phYO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!phYO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!phYO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!phYO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!phYO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png" width="1039" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:32377,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!phYO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!phYO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!phYO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!phYO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ce75584-9586-48b5-8678-6fd7b00018c0_1039x253.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The output clearly explains why the login failed.</p><p><code>passwordauthentication</code> is enabled, but <code>permitrootlogin</code> is set to <code>without-password</code>, which means root login is only allowed using SSH keys, not a password.</p><blockquote><p>You can verify the effective SSH configuration using <code>sshd -T</code>. This shows the final values after all configuration files and drop-in overrides are applied.</p></blockquote><p>Let&#8217;s fix that by creating a drop-in file instead of modifying the main SSH configuration file:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ printf 'PermitRootLogin yes\nPasswordAuthentication yes\n' &gt; / etc/ssh/sshd_config.d/99-root-login.conf

$ systemctl restart sshd</code></pre></div><p>Now verify the effective configuration again:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ sshd -T | grep -E 'permitrootlogin|passwordauthentication'</code></pre></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nPF9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nPF9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png" width="1039" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/efd814f1-76ba-4f06-8d23-52714911255b_1039x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31394,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nPF9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!nPF9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fefd814f1-76ba-4f06-8d23-52714911255b_1039x253.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>You can now connect using SSH with the root password. First exit the console by pressing <code>Ctrl + ]</code></p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ ssh root@192.168.122.227</code></pre></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!my15!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!my15!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!my15!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!my15!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!my15!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png" width="1039" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:31846,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!my15!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!my15!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!my15!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!my15!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48e2bffc-adec-410d-be65-2d093d1642c7_1039x253.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>If you prefer key-based authentication, you can inject an SSH key when preparing the image with virt-customize.</p><p>For example:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ ssh-keygen -t rsa

$ sudo virt-customize \
-a /var/lib/libvirt/images/rock-10.qcow2 \
--ssh-inject 'root:file:/root/.ssh/id_rsa.pub'</code></pre></div><p>This adds your public key to the image so you can connect without a password:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ ssh root@192.168.122.227</code></pre></div><p>If the IP address does not appear, the virtual machine may still be initializing its network.</p><p>Give it a few seconds and run the command again.</p><p>At this point, you have a working virtual machine running from a prebuilt image.</p><p>You can log in, install packages, test configurations, and experiment freely without affecting your main system.</p><blockquote><p>Every virtual machine you create from an image starts from the same baseline. If you need multiple systems, create a copy of the image for each virtual machine. A single disk image should not be shared between multiple VMs.</p></blockquote><h2><strong>Stopping the virtual machine</strong></h2><p>Once you are done working with the virtual machine, you can stop it.</p><p>To see running virtual machines:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh list</code></pre></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NRLt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!NRLt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png" width="1039" height="253" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:253,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21592,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NRLt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 424w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 848w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 1272w, https://substackcdn.com/image/fetch/$s_!NRLt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb98253fa-780a-43cb-87bb-16f1bad0ca98_1039x253.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>To stop the virtual machine gracefully:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh shutdown rocky-10-kvm-lab-demo</code></pre></div><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hqMy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 424w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 848w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 1272w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hqMy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png" width="1039" height="190" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:190,&quot;width&quot;:1039,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22814,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/192757854?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hqMy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 424w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 848w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 1272w, https://substackcdn.com/image/fetch/$s_!hqMy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5fe9ad92-ee89-462e-99e6-1fe4b4ff5c0e_1039x190.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>This sends a shutdown signal to the guest operating system, allowing it to close services and unmount filesystems properly.</p><p>If the virtual machine does not respond, you can force it to stop:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh destroy rocky-10-kvm-lab-demo</code></pre></div><p>This stops the virtual machine immediately, similar to cutting power.</p><p>If you want to start it again later:</p><div class="highlighted_code_block" data-attrs="{&quot;language&quot;:&quot;bash&quot;,&quot;nodeId&quot;:null}" data-component-name="HighlightedCodeBlockToDOM"><pre class="shiki"><code class="language-bash">$ virsh start rocky-10-kvm-lab-demo</code></pre></div><h2>Closing</h2><p>At this point, you have a working virtual machine built from a prebuilt image.</p><p>No installation wizard. No repeated setup steps.</p><p>You took an image, prepared it, and turned it into a running system in a few commands.</p><p>This is a faster way to build lab environments.</p><p>You can keep a collection of images, adjust them for different use cases, and spin up new systems whenever you need them.</p><p>From here, you can go further.</p><p>Create multiple virtual machines, connect them together, simulate networks, or test real-world scenarios.</p><p>Everything starts from the same idea: take an image, run it, and use it.</p><p>That&#8217;s it.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[A Practical Guide to Linux System Administration]]></title><description><![CDATA[It has been a quiet few months here.]]></description><link>https://blog.sysxplore.com/p/a-practical-guide-to-linux-system</link><guid isPermaLink="false">https://blog.sysxplore.com/p/a-practical-guide-to-linux-system</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Thu, 12 Mar 2026 17:15:44 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/376ce229-f712-4064-b976-e739d622f38c_5000x2625.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>It has been a quiet few months here.</p><p>The reason is simple: I have been finishing something that took much longer than I originally expected.</p><p>For almost two years I&#8217;ve been working on a book called<a href="https://firststepswithlinux.com"> </a><strong><a href="https://firststepswithlinux.com">First Steps with Linux</a></strong>, a practical guide that takes you from zero Linux experience to confidently managing Linux systems.</p><p>Writing it alongside work, research, and the articles I publish here turned out to be a bigger project than I imagined. There were many moments where I thought it was almost finished, only to realize there were still chapters that needed rewriting, diagrams that needed improvement, or concepts that needed clearer explanations.</p><p>Today I&#8217;m happy to finally say:</p><p><strong>The book is finished.</strong></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ebNg!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ebNg!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 424w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 848w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 1272w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ebNg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic" width="1456" height="1820" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1820,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:4272998,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/heic&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/190717463?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ebNg!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 424w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 848w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 1272w, https://substackcdn.com/image/fetch/$s_!ebNg!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F569055f0-a650-4dd5-9afc-3d1dc104084b_4500x5625.heic 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><h2><strong>Why I wrote this book</strong></h2><p>Many of the articles on this newsletter focus on deep dives into specific Linux topics. Over time I noticed something interesting in the questions I received from readers.</p><p>Most people weren&#8217;t struggling with one isolated command or tool.</p><p>They were struggling with <strong>connecting the pieces together</strong>.</p><p>Linux has incredible documentation and countless tutorials online, but beginners often jump between random guides without seeing how everything fits together.</p><p>So the idea behind this book was simple:</p><p>Create a resource that teaches Linux <strong>as a system</strong>, not just as a collection of commands.</p><h2><strong>What the book covers</strong></h2><p>The final manuscript ended up much larger than I planned.</p><p>The book now runs <strong>700+ pages</strong> and covers a wide range of practical Linux topics, including:</p><ul><li><p>Navigating the Linux command line and filesystem</p></li><li><p>File permissions, SUID/SGID, Access Control Lists (ACLs), and file attributes</p></li><li><p>Managing users and groups</p></li><li><p>Working with disk partitions and filesystems such as <strong>ext4</strong> and <strong>XFS</strong>, including partitioning, formatting, repairing, and mounting disks</p></li><li><p>Software management using <strong>apt</strong>, <strong>dnf</strong>, and <strong>rpm-based systems</strong>, including managing local repositories</p></li><li><p>Storage technologies such as <strong>LVM, RAID, swap, disk quotas, NFS, and autofs</strong></p></li><li><p>Working with regex, archives, and compressed files</p></li><li><p>Process management, including foreground and background processes and priority control</p></li><li><p>Task automation using <strong>cron</strong>, <strong>systemd timers</strong>, <strong>batch</strong>, and <strong>at</strong></p></li><li><p>Practical Linux networking: managing interfaces, IP addresses, and routing</p></li></ul><p>The goal was to build something that helps readers move from basic Linux usage to confidently managing real systems.</p><h2><strong>Technical review</strong></h2><p>An early version of the book was technically reviewed by Alex Callejas, Services Content Architect at Red Hat and author of <em>Fedora Linux System Administration</em>.</p><p>His feedback helped refine several sections of the book and improve explanations across multiple chapters.</p><h2><strong>Beta readers</strong></h2><p>Before the final release, the book was shared with a small group of beta readers who carefully reviewed sections of the manuscript and provided detailed feedback.</p><p>Their comments helped clarify explanations, identify confusing areas, and improve several chapters across the book.</p><p>I&#8217;m very grateful for the time they invested in reading early drafts and helping shape the final version.</p><h2><strong>Where to get the book</strong></h2><p>To celebrate the launch, the book is available at a <strong>special launch price of $49</strong>.</p><p>The regular price will increase to <strong>$69</strong> after the launch window.</p><p>You can get the book here:</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://firststepswithlinux.com&quot;,&quot;text&quot;:&quot;Get the Book&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://firststepswithlinux.com"><span>Get the Book</span></a></p><h2><strong>Thank you</strong></h2><p>If you&#8217;ve been reading the articles on this newsletter, thank you.</p><p>Many of the ideas that shaped this book came from the discussions and questions shared here over the years.</p><p>Your feedback helped shape what the book eventually became.</p><p>I&#8217;ll return to publishing new Linux deep dives here soon. Now that the book is finally finished, there are several topics I&#8217;ve been wanting to write about.</p>]]></content:encoded></item><item><title><![CDATA[ EP2: Networking in Linux - Routing Deep Dive]]></title><description><![CDATA[When we talk about routing, we often picture routers, firewalls, and network appliances moving traffic across large networks.]]></description><link>https://blog.sysxplore.com/p/ep2-networking-in-linux-routing-deep-dive</link><guid isPermaLink="false">https://blog.sysxplore.com/p/ep2-networking-in-linux-routing-deep-dive</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sun, 28 Dec 2025 09:28:40 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/eadf0b36-605d-4f3c-a516-145540c364c2_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>When we talk about routing, we often picture routers, firewalls, and network appliances moving traffic across large networks. But Linux itself is a router. Every Linux system makes routing decisions, even if it only has a single network interface.</p><p>Every time an application sends a packet, the Linux kernel decides where that packet should go. Sometimes the traffic stays local. Sometimes it leaves through a specific interface. In other cases, it must be forwarded to another network entirely. All of those decisions are made using the same routing logic, regardless of whether the system is acting as a simple workstation or as a multi-homed router.</p><p>This article looks at routing from the perspective of <strong>a single Linux host</strong>. We focus on how the kernel determines reachability and selects paths for outgoing traffic, working step by step through routes, scopes, routing tables, policy-based routing, and routing marks.</p><p>Rather than jumping straight into commands, the emphasis is on how routing decisions are made inside the kernel and how those decisions affect where packets actually go. Understanding this flow makes it easier to reason about routing behaviour, especially once systems become multi-homed or start handling traffic for other networks.</p><h2>Routing vs Forwarding</h2><p>Routing and forwarding are closely related, but they are not the same thing.</p><p>Routing is the decision-making process. It is about determining the best path a packet should take based on the information available to the kernel.</p><p>Forwarding is the action. It is the act of moving a packet from one network interface to another, or delivering it locally when the destination belongs to the system itself.</p><p>By default, IPv4 forwarding is disabled on a typical Linux host, so Linux will not route transit IPv4 packets from one network interface to another. This is intentional. A server should not accidentally behave like a router. When packet forwarding is enabled, Linux becomes capable of moving traffic between networks, but it still relies on routing information to decide <em>how</em> that traffic should flow.</p><p>To check whether IPv4 packet forwarding is enabled, you can use:</p><pre><code><code>$ sysctl net.ipv4.ip_forward</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!TUeo!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 424w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 848w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 1272w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!TUeo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png" width="1076" height="139" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:139,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21679,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!TUeo!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 424w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 848w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 1272w, https://substackcdn.com/image/fetch/$s_!TUeo!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F23a7baa8-64f4-4608-8783-a2fe68f7c0a3_1076x139.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>If the output is <code>0</code>, packet forwarding is disabled. If the output is <code>1</code>, packet forwarding is enabled.</p><p>To enable packet forwarding temporarily, you can write directly to the kernel parameter:</p><pre><code><code>$ echo 1 &gt; /proc/sys/net/ipv4/ip_forward</code></code></pre><p>Or use <code>sysctl</code>:</p><pre><code><code>$ sysctl -w net.ipv4.ip_forward=1</code></code></pre><p>Both methods take effect immediately, but the change does <strong>not</strong> persist across reboots.</p><p>To make packet forwarding permanent, add the following line to a drop-in file under <code>/etc/sysctl.d/</code>. You can choose any filename, but it is common to prefix it with a number, for example <code>99-ip-forward.conf</code>:</p><pre><code><code>net.ipv4.ip_forward = 1</code></code></pre><p>Then apply the configuration:</p><pre><code><code>$ sudo sysctl -p</code></code></pre><p>Once a packet arrives on an interface, the kernel must answer a simple question:</p><p><strong>Is this packet meant for me, or should it be sent somewhere else?</strong></p><p>Routing determines the answer. Forwarding is what happens next.</p><h2>IP Destination Classes</h2><p>From the kernel&#8217;s point of view, every destination IP falls into one of three categories. This classification happens early and shapes every routing decision that follows.</p><p><strong>Local destinations</strong> are IP addresses assigned to the system itself. This includes interface addresses and the loopback range.</p><p>You can see local destinations by inspecting interface addresses:</p><pre><code><code>$ ip -c -4 -brief addr</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yQ3s!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yQ3s!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 424w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 848w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 1272w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png" width="1076" height="337" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/d5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:337,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:73917,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yQ3s!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 424w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 848w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 1272w, https://substackcdn.com/image/fetch/$s_!yQ3s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fd5902a76-6648-42be-bef8-10b09fdb5feb_1076x337.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each address shown here represents traffic that terminates on the local machine. The loopback interface deserves special attention: the entire <code>127.0.0.0/8</code> range points back to the system itself and is commonly used for local testing and inter-process communication.</p><p>If you are coming from Cisco or Juniper, these are typically referred to as <strong>local routes</strong>, and they usually appear as <code>/32</code> host routes in routing tables.</p><p><strong>Connected networks</strong> are networks that are directly reachable through a local interface. If an interface is configured with an address in a given subnet, Linux knows that any IP within that subnet can be reached without a router.</p><p>You can view connected networks with:</p><pre><code><code>$ ip route show scope link</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!UlPW!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!UlPW!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 424w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 848w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 1272w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!UlPW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png" width="1076" height="337" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:337,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:111751,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!UlPW!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 424w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 848w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 1272w, https://substackcdn.com/image/fetch/$s_!UlPW!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F79a56bdf-7793-45aa-9f08-cc07639b88ee_1076x337.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>These routes tell the kernel which networks are reachable directly and through which interface. Traffic destined for any of these networks is sent straight out of the corresponding interface, without involving a gateway.</p><p>For example, traffic to <code>192.168.8.1</code> is sent directly out of <code>enp2s0</code>.</p><p>If you come from Cisco or Juniper environments, these are known as <strong>connected routes</strong>. Notice the use of <code>scope link</code> here; we will revisit scopes in more detail shortly.</p><p><strong>Remote networks</strong> include everything else. If a destination is neither local nor directly connected, Linux must send the packet to a router that <em>is</em> directly reachable.</p><p>These routers are typically represented by default routes:</p><pre><code><code>$ ip route show default</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!gB2g!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 424w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 848w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 1272w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!gB2g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png" width="1076" height="207" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:207,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40662,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!gB2g!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 424w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 848w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 1272w, https://substackcdn.com/image/fetch/$s_!gB2g!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0bf5de3f-2caf-4e11-9cd3-639cdd5ac7eb_1076x207.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>In this case, the system has two default routes, one per interface. Linux will not use both arbitrarily. Instead, it compares their metrics and selects the preferred path. We will look at route selection and metrics in detail later.</p><p>This classification is fundamental. Before the kernel evaluates metrics or chooses a gateway, it first determines whether a destination is local, connected, or remote.</p><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:&quot;button-wrapper&quot;}" data-component-name="ButtonCreateButton"><a class="button primary button-wrapper" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><h2>What are Routes</h2><p>A route is simply an instruction that tells the kernel how to reach a destination.</p><p>At a minimum, a route answers three questions:</p><ul><li><p>Which destination does this apply to?</p></li><li><p>Where should the packet go next?</p></li><li><p>Which interface should be used?</p></li></ul><p>In Linux, a route is made up of a few core components:</p><ul><li><p><strong>Destination</strong></p><p>This can be a single IP address (a host route), a subnet (a network route), or a catch-all default route (<code>0.0.0.0/0</code>).</p></li><li><p><strong>Next hop</strong></p><p>This is the IP address of the next router the packet should be sent to. If the destination is directly connected, no next hop is required.</p></li><li><p><strong>Interface</strong></p><p>This is the local network interface the packet will exit from.</p></li></ul><p>You can see how the kernel interprets a route decision using <code>ip route get</code>. For example:</p><pre><code><code>$ ip route get 1.1.1.1</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EU7G!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 424w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 848w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 1272w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!EU7G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png" width="1076" height="207" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:207,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26757,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EU7G!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 424w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 848w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 1272w, https://substackcdn.com/image/fetch/$s_!EU7G!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbf1f4467-ab26-4b87-84f2-ff70244d69c5_1076x207.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>This output shows the full routing decision for that destination:</p><ul><li><p><code>1.1.1.1</code> is the destination address.</p></li><li><p><code>192.168.8.1</code> is the next hop (gateway).</p></li><li><p><code>enp2s0</code> is the interface used to send the packet.</p></li><li><p><code>192.168.8.102</code> is the source address chosen for the packet.</p></li><li><p><code>uid 1000</code> indicates which user initiated the traffic.</p></li></ul><p>There are additional routing attributes, such as metrics and routing tables, weight, which we will look at later. For now, the important point is that this is the <em>final decision</em> the kernel has made for that packet.</p><p>If the destination belongs to a directly connected network, there is no next hop. The packet is sent straight out of the appropriate interface.</p><p>If the destination is remote, the route must specify a gateway. That gateway itself must be reachable through a directly connected network. Linux will never forward traffic to a next hop it cannot already reach.</p><p>Routes are not guesses or suggestions. They are explicit rules the kernel follows when deciding where packets should go.</p><h2>Route Scopes</h2><p>Route scopes describe how far a route can &#8220;see&#8221;. They define the visibility of a route and place boundaries on where it can be used. These scopes map directly to the destination classes we discussed earlier.</p><p>Linux primarily uses three scopes: <strong>host</strong>, <strong>link</strong>, and <strong>global</strong>.</p><p><strong>Host scope</strong> routes apply only to addresses on the local machine. These include interface IP addresses and the loopback range. Traffic matching a host-scope route never leaves the system and never involves packet forwarding.</p><p>You can inspect host-scope routes across all routing tables with:</p><pre><code><code>$ ip route show scope host table all</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!P_py!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!P_py!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 424w, https://substackcdn.com/image/fetch/$s_!P_py!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 848w, https://substackcdn.com/image/fetch/$s_!P_py!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 1272w, https://substackcdn.com/image/fetch/$s_!P_py!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!P_py!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png" width="1076" height="419" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:419,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:142408,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!P_py!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 424w, https://substackcdn.com/image/fetch/$s_!P_py!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 848w, https://substackcdn.com/image/fetch/$s_!P_py!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 1272w, https://substackcdn.com/image/fetch/$s_!P_py!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3c458e22-8d17-4582-883b-998f0ad1a835_1076x419.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The loopback range appears as <code>127.0.0.0/8</code> because it is treated as a special local network. Any address within that range will always resolve back to the local system:</p><pre><code><code>$ ping 127.2.4.23 -c 3</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pp93!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pp93!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 424w, https://substackcdn.com/image/fetch/$s_!pp93!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 848w, https://substackcdn.com/image/fetch/$s_!pp93!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 1272w, https://substackcdn.com/image/fetch/$s_!pp93!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!pp93!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png" width="1076" height="316" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a5086738-0f9e-4779-99ee-11906a94644b_1076x316.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:316,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:69924,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pp93!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 424w, https://substackcdn.com/image/fetch/$s_!pp93!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 848w, https://substackcdn.com/image/fetch/$s_!pp93!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 1272w, https://substackcdn.com/image/fetch/$s_!pp93!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa5086738-0f9e-4779-99ee-11906a94644b_1076x316.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Even though the address looks arbitrary, the traffic never leaves the host.</p><p><strong>Link scope</strong> routes apply to directly connected networks. These routes are used for destinations that can be reached without passing through a router. Traffic matching a link-scope route is sent directly out of the associated interface.</p><p>You can view link-scope routes with:</p><pre><code><code>$ ip route show scope link table all</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Avab!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Avab!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 424w, https://substackcdn.com/image/fetch/$s_!Avab!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 848w, https://substackcdn.com/image/fetch/$s_!Avab!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 1272w, https://substackcdn.com/image/fetch/$s_!Avab!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!Avab!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png" width="1076" height="661" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:661,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:243254,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Avab!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 424w, https://substackcdn.com/image/fetch/$s_!Avab!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 848w, https://substackcdn.com/image/fetch/$s_!Avab!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 1272w, https://substackcdn.com/image/fetch/$s_!Avab!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa7c63c29-4dd1-491b-962e-824537aa3030_1076x661.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Alongside unicast routes, you&#8217;ll also see broadcast routes. Broadcast addresses target all hosts on a local network segment and are automatically created by the kernel for each connected network.</p><p><strong>Global scope</strong> routes apply to destinations beyond the local system and its directly connected networks. These routes require one or more routers to reach the final destination. The default route is the most common example.</p><p>You can identify global-scope routes with:</p><pre><code><code>$ ip -4 route show scope global table all</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!jqr5!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 424w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 848w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 1272w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!jqr5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png" width="1076" height="177" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:177,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:41553,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!jqr5!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 424w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 848w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 1272w, https://substackcdn.com/image/fetch/$s_!jqr5!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F0cb26a48-6c9c-4ce6-bc4b-a9eebb3e0b69_1076x177.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>These routes act as catch-all paths for traffic that does not match any more specific destination.</p><p>Route scopes are not cosmetic labels. They allow the kernel to quickly eliminate routes that cannot possibly apply to a given destination, making route selection faster and more predictable.</p><h2>Routing Tables</h2><p>Linux does not store all routes in a single flat list. Instead, routes are grouped into <strong>routing tables</strong>. Each table represents a separate set of routing decisions that the kernel can consult when processing a packet.</p><p>You may have already noticed this in earlier commands, where we used <code>table all</code> to display routes from every table at once. By default, however, most commands operate on a single table unless told otherwise.</p><p>Linux ships with three routing tables by default.</p><p>The <strong>local</strong> table is a special table maintained by the kernel. It contains routes for addresses that belong to the local system itself, including interface addresses and loopback. This table cannot be modified directly.</p><p>You can view its contents with:</p><pre><code><code>$ ip route show table local</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0Tr-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0Tr-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png 424w, https://substackcdn.com/image/fetch/$s_!0Tr-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png 848w, https://substackcdn.com/image/fetch/$s_!0Tr-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png 1272w, https://substackcdn.com/image/fetch/$s_!0Tr-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!0Tr-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png" width="1076" height="499" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:499,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:182264,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0Tr-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png 424w, https://substackcdn.com/image/fetch/$s_!0Tr-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png 848w, https://substackcdn.com/image/fetch/$s_!0Tr-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png 1272w, https://substackcdn.com/image/fetch/$s_!0Tr-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F75a63703-f5ac-4d42-9b85-a326f7ce2381_1076x499.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>This table effectively maps local IP addresses to the interfaces they belong to. Any packet destined for one of these addresses is delivered locally and never forwarded.</p><p>The <strong>main</strong> table is where most routing decisions take place. Connected networks, static routes, and default gateways typically live here. When you add or remove routes without explicitly specifying a table, you are modifying the main table.</p><p>You can inspect it with:</p><pre><code><code>$ ip route show table main
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!yD6k!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!yD6k!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png 424w, https://substackcdn.com/image/fetch/$s_!yD6k!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png 848w, https://substackcdn.com/image/fetch/$s_!yD6k!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png 1272w, https://substackcdn.com/image/fetch/$s_!yD6k!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!yD6k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png" width="1076" height="413" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:413,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:155911,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!yD6k!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png 424w, https://substackcdn.com/image/fetch/$s_!yD6k!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png 848w, https://substackcdn.com/image/fetch/$s_!yD6k!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png 1272w, https://substackcdn.com/image/fetch/$s_!yD6k!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc915c5d4-7e4d-461b-ab8e-8e2cfffeec8f_1076x413.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This table is populated automatically when interfaces come up, addresses are assigned (for example via DHCP), or routes are added manually.</p><p>The <strong>default</strong> table exists primarily for legacy compatibility and is rarely used directly on modern systems. In practice, routing decisions almost always involve the local and main tables unless policy-based routing is configured.</p><p>Each routing table is identified by a numeric ID. These IDs can be mapped to human-readable names using the <code>rt_tables</code> file:</p><pre><code><code>$ cat /etc/iproute2/rt_tables</code></code></pre><p>On some distributions, such as Fedora, this file may not exist under <code>/etc</code> by default. In that case, the vendor-supplied definitions are located at:</p><pre><code><code>/usr/share/iproute2/rt_tables</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!cZzp!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!cZzp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png 424w, https://substackcdn.com/image/fetch/$s_!cZzp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png 848w, https://substackcdn.com/image/fetch/$s_!cZzp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png 1272w, https://substackcdn.com/image/fetch/$s_!cZzp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!cZzp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png" width="1076" height="413" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:413,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35647,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!cZzp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png 424w, https://substackcdn.com/image/fetch/$s_!cZzp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png 848w, https://substackcdn.com/image/fetch/$s_!cZzp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png 1272w, https://substackcdn.com/image/fetch/$s_!cZzp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F30883194-0b6f-4c31-b58b-61af7b0803ea_1076x413.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>If <code>/etc/iproute2/rt_tables</code> is missing, it can be created manually. Entries placed there override or extend the system tables without modifying vendor files, which ensures they are not overwritten during package upgrades.</p><p>When working with routing commands, you can always refer to a table by its numeric ID if you prefer:</p><pre><code><code>$ ip route show table 254</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!75GO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!75GO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png 424w, https://substackcdn.com/image/fetch/$s_!75GO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png 848w, https://substackcdn.com/image/fetch/$s_!75GO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png 1272w, https://substackcdn.com/image/fetch/$s_!75GO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!75GO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png" width="1076" height="413" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:413,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:156463,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!75GO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png 424w, https://substackcdn.com/image/fetch/$s_!75GO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png 848w, https://substackcdn.com/image/fetch/$s_!75GO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png 1272w, https://substackcdn.com/image/fetch/$s_!75GO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9a3ac89c-7024-4fc2-a412-81e224739351_1076x413.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Linux supports up to <strong>255 routing tables</strong>. This is not accidental or excessive; it enables advanced routing setups where traffic must be handled differently depending on its source, destination, or other attributes. We will explore those scenarios when we get to policy-based routing.</p><h2>Route Selection</h2><p>When multiple routes could match a destination, Linux follows a strict and well-defined selection process. This process is deterministic, which means the kernel will always make the same decision given the same routing information.</p><p>The most important rule is <strong>longest prefix match</strong>.</p><p>A route with a more specific destination always wins over a less specific one. A <code>/32</code> prefix-length host route is preferred over a <code>/25</code>, a <code>/25</code> is preferred over a <code>/24</code>, and any subnet route is preferred over a default route. This is why the default route is only used as a last resort, when no more specific route exists.</p><p>Once prefix length is considered, Linux looks at <strong>metrics</strong>.</p><p>If multiple routes have the same prefix length, the route with the lowest metric is selected. Metrics allow one route to be preferred over another even when both are otherwise equally valid.</p><p>You can see this clearly with multiple default routes:</p><pre><code><code>$ ip route show default</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Eubf!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png 424w, https://substackcdn.com/image/fetch/$s_!Eubf!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png 848w, https://substackcdn.com/image/fetch/$s_!Eubf!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png 1272w, https://substackcdn.com/image/fetch/$s_!Eubf!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!Eubf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png" width="1076" height="200" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/573151d5-9b3a-48dc-8309-337cec359529_1076x200.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:200,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40582,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Eubf!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png 424w, https://substackcdn.com/image/fetch/$s_!Eubf!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png 848w, https://substackcdn.com/image/fetch/$s_!Eubf!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png 1272w, https://substackcdn.com/image/fetch/$s_!Eubf!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F573151d5-9b3a-48dc-8309-337cec359529_1076x200.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p></p><p>Both routes match the same destination (<code>0.0.0.0/0</code>), but the route with metric <code>100</code> is preferred over the one with metric <code>600</code>.</p><p>You can verify the decision the kernel makes with:</p><pre><code><code>$ ip route get 1.1.1.1</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!YkTK!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png 424w, https://substackcdn.com/image/fetch/$s_!YkTK!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png 848w, https://substackcdn.com/image/fetch/$s_!YkTK!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png 1272w, https://substackcdn.com/image/fetch/$s_!YkTK!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!YkTK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png" width="1076" height="200" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:200,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26702,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!YkTK!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png 424w, https://substackcdn.com/image/fetch/$s_!YkTK!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png 848w, https://substackcdn.com/image/fetch/$s_!YkTK!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png 1272w, https://substackcdn.com/image/fetch/$s_!YkTK!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb06eb93a-406c-4587-bc65-7e0f798cbe62_1076x200.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Even though both default routes are valid, the packet is sent via <code>192.168.8.1</code> because it has the lower metric.</p><p>Metrics are commonly used to express preference or priority. A route with a higher metric can act as a backup path that is only used when the preferred route becomes unavailable.</p><p>Only when both <strong>prefix length</strong> and <strong>metric</strong> are equal does Linux consider more advanced mechanisms, such as equal-cost routing or equal-cost multi-path (ECMP). At that point, the kernel no longer selects a single &#8220;best&#8221; route, but instead treats multiple routes as equally valid candidates.</p><h2>ECMP Routing</h2><p>Linux supports Equal-Cost Multi-Path (ECMP) routing, which allows traffic to be distributed across multiple gateways when more than one route to a destination is equally valid. Instead of committing to a single next hop, the kernel can spread traffic across several paths at Layer 3.</p><p>Path selection in ECMP is not random. The kernel uses a hashing mechanism to decide which next hop a packet, or flow, should take. How predictable this behaviour is depends on the hashing policy in use.</p><p>To see ECMP in action, consider a route with two equal-cost gateways:</p><pre><code><code>sudo ip route add 34.160.111.145 \
  nexthop via 192.168.8.1 dev enp2s0 weight 1 \
  nexthop via 10.108.75.150 dev wlo1 weight 1
</code></code></pre><p>This installs a route to <code>34.160.111.145</code> with two next hops of equal cost:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!LcuI!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LcuI!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png 424w, https://substackcdn.com/image/fetch/$s_!LcuI!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png 848w, https://substackcdn.com/image/fetch/$s_!LcuI!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png 1272w, https://substackcdn.com/image/fetch/$s_!LcuI!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!LcuI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png" width="1076" height="328" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:328,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:81487,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LcuI!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png 424w, https://substackcdn.com/image/fetch/$s_!LcuI!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png 848w, https://substackcdn.com/image/fetch/$s_!LcuI!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png 1272w, https://substackcdn.com/image/fetch/$s_!LcuI!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb52f161e-0e5d-496e-a2a4-fd030dffe00d_1076x328.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The address <code>34.160.111.145</code> belongs to <code>ifconfig.me</code>, a service that simply returns your public IP address. If you repeatedly run:</p><pre><code><code>$ curl ifconfig.me</code></code></pre><p>you might expect traffic to alternate between the two gateways. By default, that does not happen.</p><p>The reason lies in how Linux hashes ECMP traffic. You can inspect the current hashing policy with:</p><pre><code><code>$ sysctl net.ipv4.fib_multipath_hash_policy</code></code></pre><p>On most systems, the value is <code>0</code>:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CIbD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png 424w, https://substackcdn.com/image/fetch/$s_!CIbD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png 848w, https://substackcdn.com/image/fetch/$s_!CIbD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png 1272w, https://substackcdn.com/image/fetch/$s_!CIbD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!CIbD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png" width="1076" height="159" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/da316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:159,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23830,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CIbD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png 424w, https://substackcdn.com/image/fetch/$s_!CIbD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png 848w, https://substackcdn.com/image/fetch/$s_!CIbD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png 1272w, https://substackcdn.com/image/fetch/$s_!CIbD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fda316b10-6cf6-4b96-9eb5-37472214e7db_1076x159.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>With this setting, the kernel hashes only on the <strong>destination IP address</strong>. All traffic sent to the same destination is therefore pinned to a single next hop. Source IP, source port, destination port, and protocol are ignored.</p><p>This behaviour is intentional. It provides stable and predictable routing decisions: every connection to the same server consistently uses the same gateway. The trade-off is limited load distribution. If many connections target a single destination, one link may carry all the traffic while others remain idle.</p><h3>Enabling flow-based ECMP hashing</h3><p>To distribute traffic at a finer granularity, the hashing policy can be changed to:</p><pre><code><code>$ sudo sysctl -w net.ipv4.fib_multipath_hash_policy=1</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!FJWD!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png 424w, https://substackcdn.com/image/fetch/$s_!FJWD!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png 848w, https://substackcdn.com/image/fetch/$s_!FJWD!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png 1272w, https://substackcdn.com/image/fetch/$s_!FJWD!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!FJWD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png" width="1076" height="227" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:227,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50257,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!FJWD!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png 424w, https://substackcdn.com/image/fetch/$s_!FJWD!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png 848w, https://substackcdn.com/image/fetch/$s_!FJWD!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png 1272w, https://substackcdn.com/image/fetch/$s_!FJWD!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f1c7dd0-313b-430c-b21e-e17da0b0e963_1076x227.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p></p><p>With this setting, the kernel hashes on the full five-tuple:</p><ul><li><p>source IP</p></li><li><p>destination IP</p></li><li><p>source port</p></li><li><p>destination port</p></li><li><p>protocol</p></li></ul><p>Each TCP or UDP flow is treated independently. This allows different connections to the same destination to use different next hops, resulting in much better load distribution.</p><h3>The catch: asymmetric routing</h3><p>Flow-based ECMP assumes that return traffic will follow the same path as outbound traffic. In environments where this assumption holds, such as controlled routed networks or data centers, this approach works well.</p><p>On a typical workstation or laptop, that assumption often breaks down.</p><p>In this example, the system is connected to two completely different ISPs: one via Ethernet and another via Wi-Fi. Each gateway performs its own NAT and has no awareness of the other path. When flow-based hashing is enabled, Linux is free to choose either interface for each new connection.</p><p>A TCP connection to <code>ifconfig.me</code> might begin with a SYN packet leaving over Wi-Fi. The upstream NAT on that gateway creates state for the connection and forwards it to the internet. A moment later, a retransmission or ACK is sent, but this time the ECMP hash selects the Ethernet path instead.</p><p>From the ISP&#8217;s point of view, that packet makes no sense.</p><p>It arrives on a different gateway, with a source address that does not match any existing NAT state, and without a corresponding connection entry. The packet is silently dropped. Nothing is misconfigured on the Linux host, yet the connection stalls.</p><p>From the user&#8217;s perspective, the behaviour appears random:</p><pre><code><code>$ curl ifconfig.me   &#8594; works
$ curl ifconfig.me   &#8594; hangs
$ curl ifconfig.me   &#8594; works again</code></code></pre><p>This is asymmetric routing in practice. Linux did exactly what it was told to do, but the surrounding network could not support it. Consumer ISPs in particular are unforgiving of this pattern.</p><p>This behaviour explains why Linux does not enable flow-based ECMP by default.</p><p>In most environments, the kernel cannot assume symmetric return paths. Gateways may belong to different networks, NAT is almost always involved, and upstream routing is outside the host&#8217;s control. In such conditions, aggressive load distribution is more likely to break connections than improve throughput.</p><p>By defaulting to destination-based hashing, Linux chooses predictability over maximum utilisation. Traffic to the same destination remains pinned to a single path, NAT state remains consistent, and connections stay stable, even on multi-homed workstations and laptops.</p><h2>Metric vs Weight</h2><p>You may have noticed that when creating an ECMP route, we did not explicitly set a metric:</p><pre><code><code>$ sudo ip route add 34.160.111.145 \
  nexthop via 192.168.8.1 dev enp2s0 weight 1 \
  nexthop via 10.108.75.150 dev wlo1 weight 1</code></code></pre><p>This is because ECMP routes are, by definition, equal-cost routes. All next hops within an ECMP route implicitly share the same metric. If no metric is specified, the default value is used.</p><p>You <em>can</em> still assign a metric explicitly if needed:</p><pre><code><code>$ ip route del 34.160.111.145

$ sudo ip route add 34.160.111.145 metric 100 \
  nexthop via 192.168.8.1 dev enp2s0 weight 1 \
  nexthop via 10.108.75.150 dev wlo1 weight 1</code></code></pre><p>Which results in:</p><pre><code><code>$ ip route show scope global</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!tn17!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!tn17!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png 424w, https://substackcdn.com/image/fetch/$s_!tn17!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png 848w, https://substackcdn.com/image/fetch/$s_!tn17!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png 1272w, https://substackcdn.com/image/fetch/$s_!tn17!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!tn17!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png" width="1076" height="357" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:357,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:88562,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!tn17!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png 424w, https://substackcdn.com/image/fetch/$s_!tn17!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png 848w, https://substackcdn.com/image/fetch/$s_!tn17!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png 1272w, https://substackcdn.com/image/fetch/$s_!tn17!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc11d3f67-2b4a-46ec-a02d-ea799626b47f_1076x357.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>In this case, the metric applies to the <strong>route as a whole</strong>, not to individual next hops.</p><h3>What metrics are used for</h3><p>A <strong>metric</strong> is used to compare <strong>different routes to the same destination</strong>.</p><p>When multiple routes exist, the kernel first applies longest prefix match. If prefix lengths are equal, the route with the lowest metric is preferred. Metrics are therefore used to express preference, priority, or backup behaviour between routes.</p><p>For example, a route with a higher metric may exist purely as a fallback and will only be used if the preferred route becomes unavailable.</p><h3>What weights are used for</h3><p>A <strong>weight</strong>, on the other hand, is used <em>within</em> an ECMP route.</p><p>Weights control how traffic is distributed across multiple equal-cost next hops. When all next hops have the same weight, traffic is distributed evenly. When weights differ, traffic is split proportionally.</p><p>For example, assigning a weight of <code>3</code> to one next hop and <code>1</code> to another results in an approximate 3:1 traffic split, or roughly 75/25.</p><p>Weights do <strong>not</strong> influence route selection. They only influence traffic distribution <em>after</em> a route has already been selected.</p><p>So, in simple words:</p><ul><li><p><strong>Metric</strong> determines <em>which route</em> is preferred when multiple routes match the same destination.</p></li><li><p><strong>Weight</strong> determines <em>how traffic is distributed</em> across multiple next hops within a single ECMP route.</p></li></ul><p>Both serve different purposes and operate at different stages of the routing decision process.</p><h2>Special Routes</h2><p>Not all routes exist to deliver traffic. Some routes exist specifically to control what happens <em>when</em> traffic matches them.</p><p>Linux supports several special route types that change how packets are handled when a destination is matched.</p><p>An <strong>unreachable</strong> route tells the kernel that a destination cannot be reached. When a packet matches such a route, the kernel immediately rejects it and sends an ICMP <em>destination unreachable</em> message back to the sender.</p><p>You can create an unreachable route like this:</p><pre><code><code>$ sudo ip route add unreachable 1.1.1.1</code></code></pre><p>The same can be applied to an entire subnet:</p><pre><code><code>$ sudo ip route add unreachable 192.168.10.0/24</code></code></pre><p>A <strong>prohibit</strong> route is similar, but slightly stricter. When traffic matches a prohibit route, the kernel rejects it with an ICMP <em>administratively prohibited</em> message.</p><pre><code><code>$ sudo ip route add prohibit 1.1.1.1</code></code></pre><p>This type of route is often used to explicitly deny traffic while still providing feedback to the sender.</p><p>A <strong>blackhole</strong> route silently drops packets. No response is sent back to the sender.</p><pre><code><code>$ sudo ip route add blackhole 1.1.1.1</code></code></pre><p>Because there is no feedback, blackhole routes are commonly used for traffic filtering, denial-of-service mitigation, or to prevent unwanted traffic from consuming resources.</p><p>Blackhole routes are also frequently used in routing protocols such as BGP. A route may need to exist in the routing table so it can be advertised, even though no traffic should actually be forwarded.</p><p>Another common use case is site-to-site VPNs. If traffic for a remote subnet should only ever traverse a tunnel, a blackhole route can prevent that traffic from leaking out through a default gateway when the tunnel is down.</p><p>Special routes do not replace firewall rules, but they complement them. They operate directly at the routing layer and influence packet handling before any forwarding decision is made.</p><h2>Routing Rules and Policy-Based Routing (PBR)</h2><p>So far, routing decisions have been based entirely on the destination address. That works well in simple setups, but it quickly becomes limiting once traffic needs to be treated differently depending on where it comes from or how it enters the system.</p><p>Policy-based routing (PBR) addresses this limitation by introducing <strong>routing rules</strong>.</p><p>Instead of always consulting the same routing table, Linux maintains a rule database that determines <strong>which routing table should be used</strong> for a given packet. Only after a table is selected does the kernel perform normal route lookup within that table.</p><p>You can view the current set of routing rules with:</p><pre><code><code>$ ip rule show</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!17iP!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png 424w, https://substackcdn.com/image/fetch/$s_!17iP!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png 848w, https://substackcdn.com/image/fetch/$s_!17iP!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png 1272w, https://substackcdn.com/image/fetch/$s_!17iP!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!17iP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png" width="1076" height="249" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:249,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28692,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!17iP!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png 424w, https://substackcdn.com/image/fetch/$s_!17iP!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png 848w, https://substackcdn.com/image/fetch/$s_!17iP!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png 1272w, https://substackcdn.com/image/fetch/$s_!17iP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe5784754-2d84-4d22-a3f8-deadce5e6181_1076x249.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Rules are evaluated in order, from top to bottom. As soon as a rule matches, the kernel consults the routing table associated with that rule. If a suitable route is found, the lookup stops.</p><p>This mechanism makes it possible to base routing decisions on more than just the destination address. Rules can match on source address, destination address, incoming interface, firewall marks, and other attributes.</p><p>If you are familiar with enterprise firewalls such as FortiGate or Check Point, this approach should feel familiar. In those platforms, most routing decisions are also policy-driven rather than purely destination-based.</p><p>A common use case for policy-based routing is <strong>multi-WAN routing</strong>, where traffic must exit through different internet connections depending on its characteristics.</p><p>To demonstrate this, we can create two custom routing tables and populate each with a different default gateway.</p><p>First, define the routing tables:</p><pre><code><code>$ sudo mkdir -p /etc/iproute2

$ echo "200     wan-wifi" | sudo tee -a /etc/iproute2/rt_tables
$ echo "201     wan-ethernet" | sudo tee -a /etc/iproute2/rt_tables</code></code></pre><p>Next, add a default route to each table:</p><pre><code><code>$ sudo ip route add default via 10.108.75.150 dev wlo1 table wan-wifi
$ sudo ip route add default via 192.168.8.1  dev enp2s0 table wan-ethernet</code></code></pre><p>You can verify the contents of each table with:</p><pre><code><code>$ ip route show table wan-wifi
$ ip route show table wan-ethernet</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!NxKN!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png 424w, https://substackcdn.com/image/fetch/$s_!NxKN!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png 848w, https://substackcdn.com/image/fetch/$s_!NxKN!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png 1272w, https://substackcdn.com/image/fetch/$s_!NxKN!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!NxKN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png" width="1076" height="249" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:249,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56317,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!NxKN!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png 424w, https://substackcdn.com/image/fetch/$s_!NxKN!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png 848w, https://substackcdn.com/image/fetch/$s_!NxKN!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png 1272w, https://substackcdn.com/image/fetch/$s_!NxKN!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8b24bff5-82a9-4451-9cd9-8c82f097fb47_1076x249.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>At this point, the routes exist, but they are not used yet. The kernel still relies on the main routing table unless instructed otherwise.</p><p>Now we can introduce policy rules.</p><p>In this example, traffic destined for <code>ifconfig.me</code> (<code>34.160.111.145</code>) will be routed via Wi-Fi, while traffic destined for <code>ifconfig.co</code> (<code>104.21.54.91</code>) will be routed via Ethernet:</p><pre><code><code>$ sudo ip rule add to 34.160.111.145 table wan-wifi
$ sudo ip rule add to 104.21.54.91 table wan-ethernet</code></code></pre><p>Displaying the rules again shows the new entries:</p><pre><code><code>$ ip rule show</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rDEa!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rDEa!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png 424w, https://substackcdn.com/image/fetch/$s_!rDEa!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png 848w, https://substackcdn.com/image/fetch/$s_!rDEa!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png 1272w, https://substackcdn.com/image/fetch/$s_!rDEa!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!rDEa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png" width="1076" height="282" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:282,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:59417,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rDEa!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png 424w, https://substackcdn.com/image/fetch/$s_!rDEa!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png 848w, https://substackcdn.com/image/fetch/$s_!rDEa!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png 1272w, https://substackcdn.com/image/fetch/$s_!rDEa!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F741e634a-fb24-4504-ad7f-af23a123ef0b_1076x282.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>The ordering is important. These rules are evaluated before the main table, so matching traffic is redirected to the appropriate routing table.</p><p>Testing confirms the behaviour:</p><pre><code><code>$ curl ifconfig.me
$ curl ifconfig.co
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!7Tml!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!7Tml!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg 424w, https://substackcdn.com/image/fetch/$s_!7Tml!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg 848w, https://substackcdn.com/image/fetch/$s_!7Tml!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!7Tml!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!7Tml!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg" width="1076" height="282" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:282,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:28360,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182754299?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!7Tml!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg 424w, https://substackcdn.com/image/fetch/$s_!7Tml!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg 848w, https://substackcdn.com/image/fetch/$s_!7Tml!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!7Tml!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff5bbd145-e767-422d-bf03-c30af1f5156c_1076x282.jpeg 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Each destination uses a different outbound interface and therefore returns a different public IP address.</p><p>Policy-based routing can be applied in many ways. When a system acts as a router, rules commonly match on the <strong>source address</strong> using <code>from</code>. When more granular control is needed, rules can match on both <code>from</code> and <code>to</code>, or on other attributes entirely.</p><h2>Routing Marks</h2><p>One of the most powerful routing mechanisms in Linux is the <strong>firewall mark</strong>.</p><p>A firewall mark is a numeric tag that can be attached to packets as they pass through the system. Routing rules can then match on that mark and select a routing table accordingly.</p><p>This adds another layer of flexibility to policy-based routing. Instead of matching only on addresses or interfaces, routing decisions can be influenced by anything the firewall is able to inspect or classify.</p><p>The idea is simple:</p><ul><li><p>The firewall <strong>marks</strong> the packet.</p></li><li><p>The routing rules <strong>interpret</strong> that mark.</p></li><li><p>The kernel selects the appropriate routing table.</p></li></ul><p>Routing itself still happens at Layer 3. The firewall does not route traffic; it only labels packets. The routing subsystem then uses those labels to decide where packets should go.</p><p>This approach allows routing decisions to be based on a wide range of criteria, including:</p><ul><li><p>incoming or outgoing interface</p></li><li><p>source or destination address</p></li><li><p>protocol or port</p></li><li><p>connection state</p></li><li><p>application-specific characteristics</p></li></ul><p>Because marking happens before routing decisions are made, it integrates cleanly with the existing policy routing framework.</p><p>Firewall marks are commonly used in more advanced setups, such as:</p><ul><li><p>complex multi-WAN designs</p></li><li><p>VPN traffic segregation</p></li><li><p>service-specific routing</p></li><li><p>selective traffic steering</p></li></ul><p>The key advantage is separation of concerns. The firewall focuses on classification, while the routing subsystem focuses on path selection. This keeps configurations easier to reason about and avoids overloading routing rules with complex matching logic.</p><p>Routing marks are a deep topic on their own and deserve a dedicated discussion. We will explore them in more detail in a separate article.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p>]]></content:encoded></item><item><title><![CDATA[Part 4: SSH Tunnels Deep Dive - SSH as a SOCKS Proxy]]></title><description><![CDATA[By this point, we&#8217;ve already seen how SSH can forward traffic to a specific port or even through another internal host.]]></description><link>https://blog.sysxplore.com/p/part-4-dynamic-port-forwarding</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-4-dynamic-port-forwarding</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Fri, 19 Dec 2025 17:12:58 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/9097fe06-e17b-4bdb-8e1e-195ff0da818d_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>By this point, we&#8217;ve already seen how SSH can forward traffic to a specific port or even through another internal host. Let&#8217;s now look at the last type of SSH tunnel: <strong>dynamic port forwarding</strong>. <strong>Dynamic forwarding</strong> builds on those ideas, but removes the need to decide the destination upfront.</p><p>Instead of forwarding one specific port to one specific service, dynamic port forwarding turns SSH into a local proxy that can carry any <strong>TCP</strong> traffic through the connection. Because of this flexibility, an SSH session using dynamic forwarding can behave almost like a lightweight, <strong>application-level VPN</strong>.</p><p>The idea is simple: SSH opens a <strong>SOCKS5 proxy</strong> on your machine. Any application that knows how to use a SOCKS proxy, web browsers, package managers, command-line tools, can send their traffic into it. SSH then decides where that traffic should go based on the requests coming from the application. It&#8217;s the application, not the tunnel, that chooses the final destination.</p><p>You will often see dynamic port forwarding used for <strong>web browsing</strong>. By routing your browser&#8217;s traffic through an SSH tunnel, you can make it appear as if you&#8217;re browsing from the SSH server&#8217;s network. This is useful for accessing <strong>geo-restricted content</strong>, <strong>bypassing local network filters</strong>, or simply adding an extra layer of <strong>encryption</strong> to your web traffic.</p><p>To see this behavior clearly, we&#8217;ll recreate a situation where normal internet access is blocked and then use dynamic forwarding to work around it.</p><h2>Lab Setup</h2><p>For this scenario, we can reuse our local ssh tunnel lab setup, so we have:</p><ul><li><p>The <strong>client machine</strong> (192.168.60.10) where I&#8217;ll run my SSH command and open the tunnel.</p></li><li><p>The <strong>webserver server</strong> (192.168.60.11 ) that I can connect to via SSH.</p></li></ul><p>Instead of keeping this abstract, the diagram below shows how dynamic port forwarding works end to end, from the local SOCKS proxy to the SSH server and out to the destination requested by the application.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!wV9H!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!wV9H!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!wV9H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:547364,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182094913?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!wV9H!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!wV9H!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6340371f-fa2b-4bbf-bb66-c6cbb48263d2_4501x4501.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><blockquote><p><strong>NOTE:</strong></p><p>If you skipped the <a href="https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding">first part</a> or haven&#8217;t set up the lab yet, the <a href="https://github.com/thatstraw/ssh-tunnels-labs">GitHub repository</a> includes the full setup so you can start from here.</p></blockquote><h3><strong>Simulating a Network Restriction</strong></h3><p>But first let&#8217;s do some house cleaning and disable the firewall on the webserver so that we don&#8217;t have any issues when testing the dynamic tunnel.</p><p>This ensures that any failure we see comes from the client side restrictions, not from the SSH server itself. So, on the <strong>webserver</strong> run:</p><pre><code><code>$ sudo ufw disable</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!X9_j!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 424w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 848w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 1272w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!X9_j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png" width="984" height="156" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/f778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:156,&quot;width&quot;:984,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:21341,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182094913?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!X9_j!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 424w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 848w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 1272w, https://substackcdn.com/image/fetch/$s_!X9_j!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ff778b9ef-3ec3-4f68-808c-9bab65dc8148_984x156.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>With the server ready, we can now introduce the real problem dynamic forwarding is meant to solve.</p><p>Now let&#8217;s pretend that our ISP is blocking access us from accessing websites, so if we try to <code>curl google.com </code>from the client machine, it will fail, to simulate that, we can configure a firewall to block all outgoing http and https traffic on the <strong>client</strong> machine:</p><p></p><pre><code><code>$  sudo ufw deny out 443
$  sudo ufw deny out 80

$ sudo ufw allow ssh

$ sudo ufw enable

$ sudo ufw status

</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!5Q5h!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!5Q5h!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png 424w, https://substackcdn.com/image/fetch/$s_!5Q5h!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png 848w, https://substackcdn.com/image/fetch/$s_!5Q5h!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png 1272w, https://substackcdn.com/image/fetch/$s_!5Q5h!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!5Q5h!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png" width="984" height="657" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:657,&quot;width&quot;:984,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:110685,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182094913?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!5Q5h!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png 424w, https://substackcdn.com/image/fetch/$s_!5Q5h!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png 848w, https://substackcdn.com/image/fetch/$s_!5Q5h!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png 1272w, https://substackcdn.com/image/fetch/$s_!5Q5h!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffbcf33ce-0006-4f83-a6de-a1b4395abc8e_984x657.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Our firewall is now blocking all outgoing http and https traffic. Let&#8217;s confirm that by trying to curl <code>google.com</code> from the client machine:</p><pre><code><code>$ curl --max-time 5 http://www.google.com</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2L8I!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png 424w, https://substackcdn.com/image/fetch/$s_!2L8I!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png 848w, https://substackcdn.com/image/fetch/$s_!2L8I!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png 1272w, https://substackcdn.com/image/fetch/$s_!2L8I!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!2L8I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png" width="982" height="181" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:181,&quot;width&quot;:982,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27461,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182094913?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2L8I!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png 424w, https://substackcdn.com/image/fetch/$s_!2L8I!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png 848w, https://substackcdn.com/image/fetch/$s_!2L8I!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png 1272w, https://substackcdn.com/image/fetch/$s_!2L8I!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1b7a71c-0b08-4315-a0e0-3218a3963fb0_982x181.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>As expected it failed. </p><p>At this point, the client machine has no direct path to the web, which makes it a perfect candidate for a dynamic SSH tunnel.</p><h3><strong>Creating the Dynamic SSH Tunnel</strong></h3><p>To bypass this restriction, SSH needs to listen locally and behave like a SOCKS proxy. That&#8217;s exactly what dynamic port forwarding does.</p><pre><code>$ ssh -D user@ssh_server</code></pre><p>This tells SSH to open a <strong>SOCKS5 proxy</strong> on .</p><p>A common choice is port 1080. To establish the dynamic tunnel, run the following command on the client machine:</p><pre><code>$ ssh -N -D 1080 vagrant@webserver</code></pre><p>After running this command, your laptop now has a proxy available at:</p><pre><code><strong>localhost:1080</strong></code></pre><p>Any application configured to use that proxy will send its traffic through the SSH connection to 192.168.60.11 (webserver), and from there out to the internet, or to whatever networks the SSH server can reach.</p><p>From SSH&#8217;s point of view, it&#8217;s no longer forwarding traffic to a single destination, it&#8217;s forwarding <em>requests</em>.</p><h3><strong>Testing the SOCKS Proxy</strong></h3><p>Instead of reconfiguring a browser, we&#8217;ll use <code>curl</code> so we can see the effect directly from the command line.</p><p>Let&#8217;s test out this out.</p><p>We can tell curl to use the SOCKS5 proxy at localhost:1080 like this:</p><pre><code><code>$ curl --socks5 localhost:1080 http://www.google.com</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!frnv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!frnv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png 424w, https://substackcdn.com/image/fetch/$s_!frnv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png 848w, https://substackcdn.com/image/fetch/$s_!frnv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png 1272w, https://substackcdn.com/image/fetch/$s_!frnv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!frnv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png" width="982" height="289" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/11668d91-9281-484b-8ef1-8ba63b817544_982x289.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:289,&quot;width&quot;:982,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:76175,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/182094913?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!frnv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png 424w, https://substackcdn.com/image/fetch/$s_!frnv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png 848w, https://substackcdn.com/image/fetch/$s_!frnv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png 1272w, https://substackcdn.com/image/fetch/$s_!frnv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F11668d91-9281-484b-8ef1-8ba63b817544_982x289.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And voila! We have successfully accessed google.com through the dynamic SSH tunnel. The traffic was routed from our curl command to the SOCKS5 proxy at localhost:1080, then through the SSH connection to the webserver, and finally out to the internet.</p><h3><strong>What Makes Dynamic Forwarding Different?</strong></h3><p>Now that we&#8217;ve seen it working, it&#8217;s worth stepping back and looking at what makes this type of tunnel fundamentally different from the others.</p><p>Unlike traditional port forwarding, which sends traffic to a single destination, <strong>dynamic forwarding is flexible</strong>. It adapts based on whatever the application is trying to reach, making it a <strong>powerful tool</strong> when dealing with filtered networks, restricted environments, or cases where you want a single encrypted path to carry multiple types of traffic at once.</p><p>As I mentioned earlier, dynamic port forwarding creates a SOCKS5 proxy on your local machine. Applications that support SOCKS proxies can send their traffic through this proxy, and SSH will forward that traffic to its intended destination based on the requests, but you have to explicitly configure the application to use the SOCKS5 proxy. If you want to route all your system&#8217;s traffic through the SSH tunnel, you would need to set up a <strong>system-wide proxy</strong> or use tools like <strong>Proxychains</strong> or <strong>Redsocks</strong> to redirect traffic through the SOCKS proxy. For system wide proxy simply go to your networks settings and configure the type of proxy you want to use, either http, https or socks5 (which ssh dynamic forwarding uses) and set the proxy address to localhost and port to 1080 (or whatever port you used when establishing the dynamic tunnel).</p><h2>Choosing the Right Tunnel for Each Situation</h2><p>All SSH tunnels use the same underlying mechanism, but the problem they solve depends entirely on where traffic needs to go and where it should appear to come from.</p><p>Once you&#8217;ve seen how each type of tunnel behaves, the real value comes from knowing <strong>when to use each one</strong>. All SSH tunnels rely on the same encrypted connection, but they solve very different problems depending on the direction of traffic and the layout of the network around you.</p><ul><li><p><strong>Local port forwarding</strong> fits naturally when you want to reach something hidden behind the SSH server. If the SSH server can see a service that you cannot, whether it&#8217;s a private database, an internal API, or another machine in a protected subnet, local forwarding gives your laptop a direct line to it. From your application&#8217;s perspective, the service appears to be running on your own machine, even though the SSH server is quietly handling all the forwarding work.</p></li><li><p><strong>Remote port forwarding</strong> addresses the opposite scenario. Sometimes you&#8217;re running something locally, perhaps a development server or a support tool, that a remote system cannot reach because you&#8217;re behind NAT or a strict firewall. Opening a port on the remote machine and routing that traffic back to your laptop allows others to access your local service without you needing to expose it to the wider internet.</p></li><li><p>The <strong>SSH proxy tunnel</strong> extends the idea of local forwarding into networks with multiple layers. Instead of connecting only to the SSH server, your traffic continues deeper into another machine that only the SSH server can reach. This makes it perfect for environments with <strong>bastion hosts</strong>, <strong>internal-only services</strong>, or <strong>cloud networks</strong> where the public-facing server is deliberately isolated from the private systems behind it.</p></li><li><p><strong>Dynamic forwarding</strong> takes a more general approach. Instead of targeting a single service, it acts as a <strong>flexible SOCKS proxy</strong> that applications can send any request through. If you want your traffic to originate from the SSH server&#8217;s network, or you need a simple way to move multiple types of application traffic through one encrypted path, dynamic forwarding becomes the most convenient choice.</p></li></ul><p>Each tunnel follows a specific pattern, and once you understand what direction the traffic must move, and where it needs to appear to come from, picking the right method becomes straightforward.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p>]]></content:encoded></item><item><title><![CDATA[Part 3: SSH Tunnels Deep Dive - SSH Through Bastion Server]]></title><description><![CDATA[In the last two parts , Local Port Forwarding and Remote Port Forwarding , we covered the two main directions of SSH port forwarding: local and remote.]]></description><link>https://blog.sysxplore.com/p/part-3-ssh-through-bastion-server</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-3-ssh-through-bastion-server</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sat, 06 Dec 2025 14:59:35 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e479dc77-fad4-4301-a782-03f62c634449_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the last two parts , <a href="https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding">Local Port Forwarding</a> and <a href="https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding">Remote Port Forwarding</a> , we covered the two main directions of SSH port forwarding: local and remote. Those are the ones most people struggle with at first, but once you understand them, everything else falls into place. The next type of SSH tunnel builds on what you already learned about local forwarding, but adds an intermediate step.</p><p>Instead of forwarding traffic directly to the SSH server, we forward it <em>through</em> a machine that sits between you and the actual target. This intermediate machine is commonly known as a <strong>bastion host</strong>.</p><h2>SSH Proxy Tunnel (Forwarding Through an Intermediate Server)</h2><p>So here is how it looks like, one machine is exposed to the outside world, while the internal systems sit protected behind it. For most of the part, you can only reach the bastion host directly. The internal systems are hidden away, inaccessible from the public internet. Since the bastion host has access to those internal systems, it becomes our <strong>gateway into the private network</strong>. So we can make use of ssh local port forwarding to reach those internal systems through the bastion host.</p><p>So here is how it works: you open a local port on your laptop, just like standard local forwarding. But instead of sending that traffic directly to the SSH server, you tell SSH to forward it further into the internal network, to a machine that only the bastion host can reach.</p><p>To make this clearer, here&#8217;s a visual representation of how local port forwarding works when a bastion host sits between you and the internal machine:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!K6ys!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!K6ys!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!K6ys!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:621077,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:false,&quot;topImage&quot;:true,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180339261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!K6ys!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!K6ys!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc960ec79-b2ff-4612-8da7-5d3c5b0fbcf8_4501x4501.png 1456w" sizes="100vw" fetchpriority="high"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Let&#8217;s demonstrate this in the lab.</p><h2>Lab Setup</h2><p>So for this I have setup 3 machines:</p><ul><li><p>The <strong>client machine</strong> (192.168.56.10 ) where I&#8217;ll run my SSH command and open the tunnel.</p></li><li><p>The <strong>bastion host</strong> (192.168.56.11) which I&#8217;ll connect to via SSH.</p></li><li><p>The <strong>internal machine</strong> (192.168.57.11) that I want to reach through the bastion host.</p></li></ul><blockquote><p><strong>NOTE:</strong></p><p>If you skipped the <a href="https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding">first part</a> or haven&#8217;t set up the lab yet, the <a href="https://github.com/thatstraw/ssh-tunnels-labs">GitHub repository</a> includes the full setup so you can start from here.</p></blockquote><h2>Verifying Connectivity</h2><p>The internal machine is running a simple webserver on port 80. From the client machine, we cannot reach the internal machine directly. Let&#8217;s confirm that by trying to curl the internal machine from the client:</p><pre><code><code>$ vagrant ssh client
$ curl --max-time 5 http://192.168.57.11
</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rnwn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png 424w, https://substackcdn.com/image/fetch/$s_!rnwn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png 848w, https://substackcdn.com/image/fetch/$s_!rnwn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png 1272w, https://substackcdn.com/image/fetch/$s_!rnwn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!rnwn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png" width="1192" height="181" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:181,&quot;width&quot;:1192,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:30716,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180339261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rnwn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png 424w, https://substackcdn.com/image/fetch/$s_!rnwn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png 848w, https://substackcdn.com/image/fetch/$s_!rnwn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png 1272w, https://substackcdn.com/image/fetch/$s_!rnwn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48408893-71fd-4aa5-9e80-844e5be79791_1192x181.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p></p><p>As you expected, the connection times out because the internal machine is not reachable from the client machine. Now, let&#8217;s set up the SSH proxy tunnel through the bastion host to reach the internal machine.</p><h2>Creating the SSH Proxy Tunnel</h2><p>The syntax looks identical to normal local port forwarding:</p><pre><code>$ ssh -L &lt;local_port&gt;:&lt;remote_host&gt;:&lt;remote_port&gt; user@bastion_host</code></pre><p>The difference lies in what <strong>remote_host</strong> is. Instead of pointing to the SSH server itself, it points to a <strong>third machine beyond it</strong>, something your laptop cannot reach, but the SSH server can.</p><p>To establish the tunnel, run the following command on the client machine:</p><pre><code>$ ssh -N -L 8888:192.168.57.11:80 vagrant@bastion</code></pre><p>In this setup:</p><p><strong>bastion</strong> (192.168.56.11) is the SSH server you connect to</p><p><strong>192.168.57.11</strong> is the internal machine we want to actually reach to.</p><p><strong>Port 8888</strong> on your laptop becomes the entry point for all traffic</p><p>Once the tunnel is active, we can open a new terminal window on the client machine to test the tunnel. First, let&#8217;s confirm that the ssh tunnel is listening on port 8888:</p><pre><code><code>$ sudo lsof -i :8888</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Npnk!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png 424w, https://substackcdn.com/image/fetch/$s_!Npnk!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png 848w, https://substackcdn.com/image/fetch/$s_!Npnk!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png 1272w, https://substackcdn.com/image/fetch/$s_!Npnk!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!Npnk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png" width="1192" height="181" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:181,&quot;width&quot;:1192,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40750,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180339261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Npnk!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png 424w, https://substackcdn.com/image/fetch/$s_!Npnk!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png 848w, https://substackcdn.com/image/fetch/$s_!Npnk!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png 1272w, https://substackcdn.com/image/fetch/$s_!Npnk!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F48fdd93d-df55-4ed6-adfe-9524eb4e09a5_1192x181.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Great! The ssh process is listening on both IPv4 and IPv6 localhost on port 8888. This confirms that our SSH proxy tunnel is <strong>active and ready</strong> to use.</p><p>In the new terminal window, lets try to access the internal machine through the tunnel by sending a request to localhost:8888 on the client machine:</p><pre><code><code>$ curl http://localhost:8888</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lvW1!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lvW1!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png 424w, https://substackcdn.com/image/fetch/$s_!lvW1!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png 848w, https://substackcdn.com/image/fetch/$s_!lvW1!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png 1272w, https://substackcdn.com/image/fetch/$s_!lvW1!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!lvW1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png" width="1192" height="386" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/c842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:386,&quot;width&quot;:1192,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:56239,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180339261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lvW1!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png 424w, https://substackcdn.com/image/fetch/$s_!lvW1!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png 848w, https://substackcdn.com/image/fetch/$s_!lvW1!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png 1272w, https://substackcdn.com/image/fetch/$s_!lvW1!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fc842f944-8810-4e3b-86c4-cd2e0275c1fe_1192x386.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Fantastic! We have successfully accessed the internal machine through the SSH proxy tunnel. The traffic was forwarded from our local port 8888 to the internal machine&#8217;s port 80 via the bastion host.</p><p>is equivalent to visiting:</p><pre><code>$ vagrant ssh bastion
$ curl http://192.168.57.11</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ZUur!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ZUur!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png 424w, https://substackcdn.com/image/fetch/$s_!ZUur!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png 848w, https://substackcdn.com/image/fetch/$s_!ZUur!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png 1272w, https://substackcdn.com/image/fetch/$s_!ZUur!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!ZUur!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png" width="1192" height="386" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:386,&quot;width&quot;:1192,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:58674,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180339261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ZUur!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png 424w, https://substackcdn.com/image/fetch/$s_!ZUur!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png 848w, https://substackcdn.com/image/fetch/$s_!ZUur!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png 1272w, https://substackcdn.com/image/fetch/$s_!ZUur!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3e3d4c75-a993-4931-91a4-55c6f13dbd20_1192x386.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>from the bastion server&#8217;s point of view.</p><p>Even though your laptop has no route to the 192.168.57.11 host, the bastion server does, and that&#8217;s enough. The bastion server becomes your <strong>bridge into the internal network</strong>, quietly passing traffic through without exposing any ports publicly.</p><p>This pattern is common in <strong>cloud setups</strong>, <strong>corporate networks</strong>, and environments where internal services must stay hidden. Instead of modifying firewalls or configuring VPNs, you rely on the one machine you&#8217;re allowed to access and let SSH handle the rest.</p><p>This not all you can do with ssh tunnels, the world is your oyster, it all depends on your creativity and use case, so don&#8217;t be limited to think outside the box. You can also reverse this setup and do remote port forwarding through a bastion host as well, but I will leave that as an exercise for you to try it out yourself.</p><p>If you&#8217;re curious what that reversed setup looks like in practice, here&#8217;s a diagram showing remote port forwarding through a bastion host:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!G9CX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!G9CX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!G9CX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!G9CX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!G9CX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!G9CX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:727258,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180339261?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!G9CX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!G9CX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!G9CX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!G9CX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F5e0963f9-b4cf-4ef7-8d93-388c3072f708_4501x4501.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This is not covered in this part, but the diagram can help you visualise how the reverse flow works.</p><h2>Looking Ahead</h2><p>Proxy tunneling gives you a way to reach systems that sit deeper inside a private network, but SSH has one more trick up its sleeve. In the next part, we&#8217;ll explore Dynamic Port Forwarding and see how SSH can act as a SOCKS5 proxy, letting your applications decide where their traffic should go.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p></p>]]></content:encoded></item><item><title><![CDATA[Part 2: SSH Tunnels Deep Dive - Remote Port Forwarding]]></title><description><![CDATA[In the previous part, we walked through local port forwarding and saw how an SSH tunnel can give your machine a private path into a service running on the remote side.]]></description><link>https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Tue, 02 Dec 2025 16:55:21 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/e49cab37-3de9-4d73-88be-d654546729d1_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the previous part, we walked through local port forwarding and saw how an SSH tunnel can give your machine a private path into a service running on the remote side.</p><p>In this part, we&#8217;ll flip the direction. Instead of pulling traffic toward the client, we&#8217;ll look at <strong>remote port forwarding</strong>, where the remote machine opens a port and sends traffic back to your local system. </p><h3><strong>Understanding Remote Port Forwarding</strong></h3><p><strong>Remote port forwarding</strong> works in the opposite direction of local forwarding. Instead of opening a port on your laptop and sending traffic into a remote network, you open a port on the remote machine and send traffic back to your laptop. This is useful when your laptop is running a service that the remote side cannot reach directly, maybe because you&#8217;re behind <strong>NAT</strong>, a <strong>firewall</strong>, or you simply don&#8217;t have a <strong>public IP</strong>.</p><p>A classic example is when you&#8217;re developing a web application locally and want someone else to access it. Take James, for instance. He&#8217;s been building a website on his laptop and wants to show it to his colleague Kay. The problem? James is sitting behind a private network with no public IP, and incoming connections to his laptop are blocked. Kay has no direct way of reaching James&#8217;s machine, and James doesn&#8217;t have the time or desire to deploy the site to a public server just for a quick preview.</p><p>What James can do, however, is spin up a temporary server on the cloud, something both of them can reach, and use <strong>SSH remote port forwarding</strong> to expose his local website through that server. The cloud VM opens a port, and anything sent to that port is quietly tunneled back to James&#8217;s laptop. From Kay&#8217;s perspective, the website looks like it&#8217;s being served from the cloud, even though it&#8217;s actually running on James&#8217;s machine at home. This will make more sense in the lab, so let&#8217;s jump right another lab.</p><h3><strong>Lab Setup</strong></h3><p>So for this I have setup 3 machines:</p><ul><li><p><strong>james-lap</strong> (192.168.70.10) - James&#8217;s laptop where the web application is running locally on port 80.</p></li><li><p><strong>aws-pub-instance</strong> (192.168.70.10 and 192.168.80.20) - A cloud VM that both James and Kay can access. This machine will act as the SSH server for remote port forwarding.</p></li><li><p><strong>kay-pc</strong> (192.168.80.10) - Kay&#8217;s computer from which she wants to access James&#8217;s local web application.</p></li></ul><p>Notice the aws-pub-instance has <strong>two network interfaces</strong>, one connected to James&#8217;s network (192.168.70.0/24) and the other connected to Kay&#8217;s network (<strong>192.168.80.0/24</strong>). This setup allows both James and Kay to reach the aws-pub-instance. Normally, a cloud VM would have a normally single public IP address, but for the sake of this lab, we are simulating the cloud environment using private IPs.</p><blockquote><p><strong>NOTE:</strong></p><p>If you skipped the <a href="https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding">first part</a> or haven&#8217;t set up the lab yet, the <a href="https://github.com/thatstraw/ssh-tunnels-labs">GitHub repository</a> includes the full setup so you can start from here.</p></blockquote><h3><strong>Verifying Connectivity</strong></h3><p>Both kay and james cannot directly reach each other due to network restrictions, but they can both access the aws-pub-instance. which we can confirm by pinging from both sides: From james-lap:</p><pre><code><code>$ vagrant ssh james-lap
$ ping aws-pub-instance
$ ping kay-pc
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!rIoL!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!rIoL!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 424w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 848w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 1272w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!rIoL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png" width="905" height="428" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:428,&quot;width&quot;:905,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:88116,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!rIoL!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 424w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 848w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 1272w, https://substackcdn.com/image/fetch/$s_!rIoL!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb1845ee1-c7c0-4f99-89c7-25b4983bf4f6_905x428.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>from kay-pc:</p><pre><code><code>$ vagrant ssh kay-pc
$ ping aws-pub-instance
$ ping james-lap
</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!quWs!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!quWs!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 424w, https://substackcdn.com/image/fetch/$s_!quWs!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 848w, https://substackcdn.com/image/fetch/$s_!quWs!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 1272w, https://substackcdn.com/image/fetch/$s_!quWs!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!quWs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png" width="905" height="458" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:458,&quot;width&quot;:905,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:86448,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!quWs!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 424w, https://substackcdn.com/image/fetch/$s_!quWs!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 848w, https://substackcdn.com/image/fetch/$s_!quWs!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 1272w, https://substackcdn.com/image/fetch/$s_!quWs!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F989c9a99-fdc7-4eee-b0cd-5d9fc2fd7043_905x458.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As you can see, both James and Kay can reach the aws-pub-instance, but they cannot reach each other directly. and Also just to be sure that james&#8217;s local web application is running, let&#8217;s curl it from james-lap:</p><pre><code><code>$ curl localhost</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LTZV!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 424w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 848w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 1272w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LTZV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png" width="905" height="237" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:237,&quot;width&quot;:905,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:35059,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LTZV!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 424w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 848w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 1272w, https://substackcdn.com/image/fetch/$s_!LTZV!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffc7f1863-31d0-46c2-970b-b9431dd74483_905x237.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Great! The web application is up and running on James&#8217;s laptop. Now, let&#8217;s set up the remote port forwarding from james-lap to aws-pub-instance.</p><h3><strong>Creating the Remote SSH Tunnel</strong></h3><p>The <strong>syntax</strong> looks similar to local port forwarding, but with the <strong>-R</strong> option and reversed order of ports:</p><pre><code>$ ssh -N -R &lt;remote-address&gt;:&lt;remote_port&gt;:&lt;local_address&gt;:&lt;local_port&gt; user@remote_public_ssh_server</code></pre><p>Again we will break this down in a bit, but for now, let&#8217;s run the command on james-lap to create the remote tunnel:</p><p></p><pre><code><code>$ ssh -N -R localhost:8080:localhost:80 vagrant@aws-pub-instance</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Rg4l!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Rg4l!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png 424w, https://substackcdn.com/image/fetch/$s_!Rg4l!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png 848w, https://substackcdn.com/image/fetch/$s_!Rg4l!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png 1272w, https://substackcdn.com/image/fetch/$s_!Rg4l!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Rg4l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png" width="906" height="337" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:337,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:66011,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Rg4l!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png 424w, https://substackcdn.com/image/fetch/$s_!Rg4l!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png 848w, https://substackcdn.com/image/fetch/$s_!Rg4l!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png 1272w, https://substackcdn.com/image/fetch/$s_!Rg4l!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa120b4e9-7da3-4820-b3ca-200c3b1084a5_906x337.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Ok, now let&#8217;s explain the syntax:</p><ul><li><p><strong>-R</strong> indicates that we are setting up remote port forwarding.</p></li><li><p><strong>localhost:8080</strong> specifies that we want to open port 8080 on the remote machine (aws-pub-instance). In other words, we are telling the aws-pub-instance to listen on port 8080 on its localhost ip (127.0.0.1) for incoming connections.</p></li><li><p><strong>localhost:80</strong> indicates that any traffic sent to localhost:8080 (on aws-pub-instance) should be forwarded to localhost port 80 on james-lap.</p></li><li><p><strong>user@remote_public_ssh_server</strong> is the SSH server we are connecting to, which in this case is the aws-pub-instance itself.</p></li><li><p><strong>-N</strong> indicates that we do not want to execute any commands on the remote server. We just want to set up the tunnel.</p></li></ul><p>Notice again, I explicitly specified localhost for the remote port binding. This means that the aws-pub-instance will only listen for connections on its <strong>loopback interface</strong> (127.0.0.1), but you can ommit localhost and just specify 8080, and it will have the same effect. By default, SSH binds to the loopback interface (localhost) unless you specify a different ip address to listen on.</p><p>Now you understand this command, let&#8217;s run it on james-lap to establish the remote tunnel and see what happens, but this time I&#8217;m going to ommit the localhost part and just specify 8080 for the remote port binding:</p><pre><code><code>$ ssh -N -R 8080:localhost:80 vagrant@aws-pub-instance</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!o21e!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png 424w, https://substackcdn.com/image/fetch/$s_!o21e!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png 848w, https://substackcdn.com/image/fetch/$s_!o21e!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png 1272w, https://substackcdn.com/image/fetch/$s_!o21e!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!o21e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png" width="906" height="184" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:184,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22219,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!o21e!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png 424w, https://substackcdn.com/image/fetch/$s_!o21e!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png 848w, https://substackcdn.com/image/fetch/$s_!o21e!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png 1272w, https://substackcdn.com/image/fetch/$s_!o21e!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F888b7400-b62a-488f-8df2-848a7805d6ba_906x184.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><h3><strong>Confirming the Remote Port Binding</strong></h3><p>With our remote tunnel established, let&#8217;s confirm that the aws-pub-instance is indeed listening on port 8080:</p><pre><code><code>$ vagrant aws-pub-instance
$ sudo lsof -i :8080</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!43Xx!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!43Xx!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png 424w, https://substackcdn.com/image/fetch/$s_!43Xx!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png 848w, https://substackcdn.com/image/fetch/$s_!43Xx!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png 1272w, https://substackcdn.com/image/fetch/$s_!43Xx!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!43Xx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png" width="906" height="256" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:256,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42025,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!43Xx!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png 424w, https://substackcdn.com/image/fetch/$s_!43Xx!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png 848w, https://substackcdn.com/image/fetch/$s_!43Xx!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png 1272w, https://substackcdn.com/image/fetch/$s_!43Xx!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad823f4c-37f5-4bfa-b203-fdc43babb4fe_906x256.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>As you can see, the sshd process is listening on both IPv4 and IPv6 localhost on port 8080 (http-alt). This confirms that our remote port forwarding is <strong>active and ready</strong> to use.</p><blockquote><p><strong>NOTE</strong></p><p>With remote port forwarding, the <strong>remote server</strong> you connect to (in this case <code>aws-pub-instance</code>) is the machine that <strong>opens a port and listens</strong> for incoming connections. Any traffic it receives on that port is then <strong>sent back to your local machine</strong>.<br>In local port forwarding, it&#8217;s the <strong>opposite direction</strong>: <strong>your computer</strong> opens and listens on a port, and any incoming traffic is forwarded to the remote host.</p></blockquote><p>So as you might have guessed by now, if we run curl on aws-pub-instance to access localhost:8080, it should forward the request back to james-lap&#8217;s localhost:80 and return the web application:</p><pre><code><code>$ curl localhost:8080</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!iQDO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!iQDO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png 424w, https://substackcdn.com/image/fetch/$s_!iQDO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png 848w, https://substackcdn.com/image/fetch/$s_!iQDO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png 1272w, https://substackcdn.com/image/fetch/$s_!iQDO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!iQDO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png" width="906" height="256" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:256,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38126,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!iQDO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png 424w, https://substackcdn.com/image/fetch/$s_!iQDO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png 848w, https://substackcdn.com/image/fetch/$s_!iQDO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png 1272w, https://substackcdn.com/image/fetch/$s_!iQDO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F65943e12-8cdd-4994-aadf-639aff47b6ad_906x256.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Fantastic! We have successfully accessed James&#8217;s local web application through the remote port forwarding tunnel. The traffic was forwarded from aws-pub-instance&#8217;s port 8080 to james-lap&#8217;s port 80 via the SSH connection. But remember, since we bound the remote port to localhost (127.0.0.10) on aws-pub-instance, only connections originating from aws-pub-instance itself can reach that port.</p><p>So that means kay-pc cannot access james&#8217;s local web application through the tunnel. If we try to curl localhost:8080 from kay-pc, it will fail:</p><pre><code><code>$ curl --max-timeout  localhost:8080</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hPYh!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png 424w, https://substackcdn.com/image/fetch/$s_!hPYh!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png 848w, https://substackcdn.com/image/fetch/$s_!hPYh!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png 1272w, https://substackcdn.com/image/fetch/$s_!hPYh!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hPYh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png" width="906" height="188" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:188,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:25946,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hPYh!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png 424w, https://substackcdn.com/image/fetch/$s_!hPYh!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png 848w, https://substackcdn.com/image/fetch/$s_!hPYh!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png 1272w, https://substackcdn.com/image/fetch/$s_!hPYh!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1915b52a-f40f-403b-8793-4794d6334bc6_906x188.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Makes sense, we cannot curl to ourself and expect to reach another machine. Ok, you might be wondering, what if we can just use the public IP or hostname of aws-pub-instance from kay-pc to reach the remote port? Well, that won&#8217;t work either because we bound the remote port to localhost (127.0.0.1) on aws-pub-instance. Let&#8217;s try it out:</p><pre><code><code>$ curl --max-time 5 aws-pub-instance:8080</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!dhWt!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png 424w, https://substackcdn.com/image/fetch/$s_!dhWt!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png 848w, https://substackcdn.com/image/fetch/$s_!dhWt!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png 1272w, https://substackcdn.com/image/fetch/$s_!dhWt!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!dhWt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png" width="906" height="188" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:188,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:27705,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!dhWt!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png 424w, https://substackcdn.com/image/fetch/$s_!dhWt!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png 848w, https://substackcdn.com/image/fetch/$s_!dhWt!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png 1272w, https://substackcdn.com/image/fetch/$s_!dhWt!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffadfed1d-a86c-4b73-a1b7-a6039b5913c8_906x188.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>It didn&#8217;t work again. The reason is that by binding the remote port to localhost, we restricted access to that port to only connections originating from aws-pub-instance itself. So can safely well can just give kay access to aws-pub-instance and let her curl localhost:8080 from there to reach james&#8217;s local web application, which works, but for some reasons or security you don&#8217;t want kay to have access to the aws-pub-instance.</p><p>So what&#8217;s the solution? </p><p>As I mentioned in <a href="https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding">last part</a>, by default SSH binds to the loopback interface (localhost) unless you specify a different ip address to listen on. So if we want kay-pc to access the remote port, we need to bind it to <strong>0.0.0.0</strong> (all interfaces) on aws-pub-instance or a specific ip address that kay uses to communicate with the aws public instance. This way, the remote port will be accessible from any machine that can reach aws-pub-instance, including kay-pc.</p><p>Alright, let&#8217;s terminate the existing ssh session on james-lap and re-establish the remote tunnel, this time binding the remote port to 0.0.0.0.</p><pre><code><code>$  ssh -N -R 0.0.0.0:8080:localhost:80 vagrant@aws-pub-instance</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!LrP7!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png 424w, https://substackcdn.com/image/fetch/$s_!LrP7!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png 848w, https://substackcdn.com/image/fetch/$s_!LrP7!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png 1272w, https://substackcdn.com/image/fetch/$s_!LrP7!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!LrP7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png" width="906" height="188" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:188,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23464,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!LrP7!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png 424w, https://substackcdn.com/image/fetch/$s_!LrP7!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png 848w, https://substackcdn.com/image/fetch/$s_!LrP7!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png 1272w, https://substackcdn.com/image/fetch/$s_!LrP7!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F226e2bfe-bf25-4736-972b-abd713fbc0e9_906x188.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p></p><p>With tunnel re-established, let&#8217;s confirm that the aws-pub-instance is now listening on all interfaces for port 8080:</p><pre><code><code>$ sudo lsof -i :8080</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MQag!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MQag!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png 424w, https://substackcdn.com/image/fetch/$s_!MQag!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png 848w, https://substackcdn.com/image/fetch/$s_!MQag!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png 1272w, https://substackcdn.com/image/fetch/$s_!MQag!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MQag!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png" width="906" height="256" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:256,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:48648,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MQag!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png 424w, https://substackcdn.com/image/fetch/$s_!MQag!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png 848w, https://substackcdn.com/image/fetch/$s_!MQag!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png 1272w, https://substackcdn.com/image/fetch/$s_!MQag!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa6e1ef83-76de-4fc1-b6c1-3cc267e04c41_906x256.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Suprisingly, the output looks the same as before, ssh is still listening on localhost:8080, so its not going to work again. There is one more step we need to do, we need to modify the <strong>sshd_config</strong> file on aws-pub-instance to allow ssh tunnels to bind to non-loopback interfaces. </p><h3><strong>Enabling GatewayPorts</strong></h3><p>By default, sshd_config has a setting called <strong>GatewayPorts</strong> which is set to <strong>no</strong>, this prevents any ssh tunnels from binding to non-loopback interfaces.</p><p>Which we can confirm by running:</p><pre><code><code>$ sudo sshd -T | grep gatewayports</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!52sn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png 424w, https://substackcdn.com/image/fetch/$s_!52sn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png 848w, https://substackcdn.com/image/fetch/$s_!52sn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png 1272w, https://substackcdn.com/image/fetch/$s_!52sn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!52sn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png" width="906" height="147" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:147,&quot;width&quot;:906,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:23928,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!52sn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png 424w, https://substackcdn.com/image/fetch/$s_!52sn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png 848w, https://substackcdn.com/image/fetch/$s_!52sn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png 1272w, https://substackcdn.com/image/fetch/$s_!52sn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F430f68a6-6ec3-490e-8c81-312fc6b0da23_906x147.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The default value is <strong>no</strong>, which means remote port forwarding can only bind to localhost (127.0.0.1). To allow remote port forwarding to bind to non-loopback or all interfaces, we need to set <strong>GatewayPorts</strong> to <strong>yes</strong>. If you want to bind to a specific interface, you can set GatewayPorts to <strong>clientspecified</strong>, which allows the client to specify the ip address to bind to when establishing the remote tunnel. Let me explain the difference between the two:</p><p>If gatewayports is set to <strong>yes</strong> and we run the following command on james-lap:</p><pre><code><code>$ ssh -N -R 8080:localhost:80 vagrant@aws-pub-instance</code></code></pre><p>The remote port 8080 will be bound to <strong>all interfaces</strong> (0.0.0.0). So this is the same as explicitly specifying 0.0.0.0:8080.</p><p>If we try to run the following command on james-lap instead:</p><pre><code><code>$ ssh -N -R 192.168.80.20:8080:localhost:80 vagrant@aws-pub-instance</code></code></pre><p>Notice we put the ip kay can use to reach aws-pub-instance (192.168.80.20). But if gatewayports is set to yes, the remote port 8080 will still be bound to all interfaces (0.0.0.0). So other case you might want ssh to respect the ip address you specified when establishing the remote tunnel, in that case you would set gatewayports to <strong>clientspecified</strong>. So with gatewayports set to clientspecified, the remote port 8080 will be bound to 192.168.80.20.</p><p>With that out  of the way, let&#8217;s edit the sshd_config file so that can allow remote port forwarding to bind to non-loopback interfaces. On aws-pub-instance, run the following commands:</p><pre><code>$ echo &#8220;GatewayPorts yes&#8221; | sudo tee -a /etc/ ssh/sshd_config.d/99-overrides.conf
$ sudo systemctl restart sshd
$ sudo sshd -T | grep gatewayports</code></pre><blockquote><p><strong>NOTE</strong><br>You may notice the space in the path (<code>/etc/ ssh/sshd_config.d/99-overrides.conf</code>). I added it intentionally because Substack kept throwing an error whenever I wrote the full path without the space. The actual path on the system has <strong>no space</strong>.</p></blockquote><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sUOF!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png 424w, https://substackcdn.com/image/fetch/$s_!sUOF!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png 848w, https://substackcdn.com/image/fetch/$s_!sUOF!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png 1272w, https://substackcdn.com/image/fetch/$s_!sUOF!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!sUOF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png" width="908" height="217" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:217,&quot;width&quot;:908,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:50080,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sUOF!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png 424w, https://substackcdn.com/image/fetch/$s_!sUOF!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png 848w, https://substackcdn.com/image/fetch/$s_!sUOF!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png 1272w, https://substackcdn.com/image/fetch/$s_!sUOF!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F580a4941-b55b-4bfa-9361-46eb484325cd_908x217.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The first command appends the <strong>GatewayPorts yes</strong> setting to a new configuration file in the <strong>sshd_config.d</strong> directory. The second command restarts the sshd service to apply the changes. The third command confirms that the GatewayPorts setting is now set to yes. You can have directly edited the main sshd_config file located at <strong>/etc /ssh/sshd_config</strong>, but its a good practice to put custom overides configurations in separate files inside the sshd_config.d directory for <strong>modularity</strong> and easier management.</p><p>Now that we have updated the sshd_config file, let&#8217;s re-establish the remote tunnel from james-lap:</p><pre><code><code>$ ssh -N -R :8080:localhost:80 vagrant@aws-pub-instance</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!k5Ia!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png 424w, https://substackcdn.com/image/fetch/$s_!k5Ia!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png 848w, https://substackcdn.com/image/fetch/$s_!k5Ia!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png 1272w, https://substackcdn.com/image/fetch/$s_!k5Ia!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!k5Ia!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png" width="908" height="217" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:217,&quot;width&quot;:908,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40271,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!k5Ia!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png 424w, https://substackcdn.com/image/fetch/$s_!k5Ia!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png 848w, https://substackcdn.com/image/fetch/$s_!k5Ia!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png 1272w, https://substackcdn.com/image/fetch/$s_!k5Ia!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F655cc3d2-9f02-4641-94f1-0d8651dbf8f8_908x217.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>As always we confirm that the aws-pub-instance is listening on port 8080:</p><pre><code><code>$ sudo lsof -i :8080</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Yf8P!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png 424w, https://substackcdn.com/image/fetch/$s_!Yf8P!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png 848w, https://substackcdn.com/image/fetch/$s_!Yf8P!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png 1272w, https://substackcdn.com/image/fetch/$s_!Yf8P!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Yf8P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png" width="908" height="217" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/95fc7309-d212-4bb7-8966-d98498792e44_908x217.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:217,&quot;width&quot;:908,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:39610,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Yf8P!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png 424w, https://substackcdn.com/image/fetch/$s_!Yf8P!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png 848w, https://substackcdn.com/image/fetch/$s_!Yf8P!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png 1272w, https://substackcdn.com/image/fetch/$s_!Yf8P!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F95fc7309-d212-4bb7-8966-d98498792e44_908x217.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p></p><p>As you can see, the sshd process is now listening on <strong>all interfaces</strong> (*) on port 8080 (http-alt). This confirms that our remote port forwarding is now accessible from any machine that can reach aws-pub-instance, including kay-pc.</p><h3><strong>Accessing the Tunnel from Kay&#8217;s Machine</strong></h3><p>Finally, let&#8217;s try to access James&#8217;s local web application from kay-pc by sending a request to aws-pub-instance&#8217;s IP address on port 8080:</p><pre><code><code>$ curl aws-pub-instance:8080</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!f4G9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png 424w, https://substackcdn.com/image/fetch/$s_!f4G9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png 848w, https://substackcdn.com/image/fetch/$s_!f4G9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png 1272w, https://substackcdn.com/image/fetch/$s_!f4G9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!f4G9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png" width="908" height="217" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:217,&quot;width&quot;:908,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34954,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!f4G9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png 424w, https://substackcdn.com/image/fetch/$s_!f4G9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png 848w, https://substackcdn.com/image/fetch/$s_!f4G9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png 1272w, https://substackcdn.com/image/fetch/$s_!f4G9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6b2a46af-d7a1-4637-b987-e6d4079cc8d1_908x217.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>And just like that, we have successfully accessed James&#8217;s local web application from Kay&#8217;s computer through the remote port forwarding tunnel. The traffic was forwarded from aws-pub-instance&#8217;s port 8080 to james-lap&#8217;s port 80 via the SSH connection. Below is a diagram that shows how everything is connected together:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!MYMn!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!MYMn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!MYMn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!MYMn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!MYMn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!MYMn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/bfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:673083,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338175?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!MYMn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png 424w, https://substackcdn.com/image/fetch/$s_!MYMn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png 848w, https://substackcdn.com/image/fetch/$s_!MYMn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!MYMn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fbfafc7bc-1991-4b85-9884-8572bdcc114a_4501x4501.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>This becomes useful when your local system is behind <strong>NAT</strong> or a <strong>strict firewall</strong> that blocks incoming connections. With remote forwarding, you make your machine reachable from the outside without configuring routers or exposing anything publicly.</p><h2><strong>Looking Ahead</strong></h2><p>Remote port forwarding solves the opposite problem of local forwarding, but there&#8217;s still more SSH can do. In the next part, we&#8217;ll look at how to reach machines hidden behind another server by using SSH as a proxy through a bastion host.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p><p></p><p></p>]]></content:encoded></item><item><title><![CDATA[Part 1: SSH Tunnels Deep Dive - Local Port Forwarding]]></title><description><![CDATA[Most people only use SSH for logging into a remote machine, and they never look beyond that.]]></description><link>https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-1-ssh-local-port-forwarding</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Mon, 01 Dec 2025 17:11:51 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/b0c239cf-c6ef-4c4a-b685-c029b00e0e07_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Most people only use <strong>SSH</strong> for logging into a remote machine, and they never look beyond that. But SSH can do far more than provide a secure shell. One of its most <strong>powerful but overlooked features</strong> is <strong>tunneling</strong>, the ability to move traffic through an <strong>encrypted channel</strong> and reach services you normally can&#8217;t access.</p><p>This becomes incredibly useful once you start dealing with servers behind <strong>firewalls</strong>, <strong>private subnets</strong>, or <strong>NAT boundaries</strong>. A service might be running somewhere in the network, but you have no direct way of reaching it. With SSH tunneling, you don&#8217;t need to expose ports publicly or ask for firewall changes, you simply reuse the SSH connection you already have.</p><p>Think of an SSH session as a <strong>secure pipe</strong>. Normally, you use it to send commands. But that same pipe can carry <em>anything</em>: database requests, web traffic, API calls, as long as it&#8217;s TCP. SSH gives you the flexibility to redirect that traffic in different directions depending on what you need to reach.</p><p>At first, SSH tunnels feel confusing. That&#8217;s normal. Many admins and developers struggle with them until they see them demonstrated in real scenarios and work through them hands-on. That&#8217;s the goal of this series: to break down <strong>SSH</strong> tunneling into clear, practical parts, each one supported by labs you can run on your own machine. All the lab files are available in the <a href="https://github.com/thatstraw/ssh-tunnels-labs/">GitHub repository</a>.</p><p>This series will cover the four major types of SSH tunnels:</p><ul><li><p>Local Port Forwarding</p></li><li><p>Remote Port Forwarding</p></li><li><p>Proxy Tunneling through a Bastion Host</p></li><li><p>Dynamic Port Forwarding (SOCKS5)</p></li></ul><p>Each part focuses on one pattern, explains when it&#8217;s useful, and walks you through a complete lab environment that demonstrates the behaviour step by step.</p><p>In this first part, we&#8217;ll start with the most familiar one, <strong>Local Port Forwarding</strong>, and see how a simple SSH connection can give you access to services that would normally be unreachable.</p><h2>Local Port Forwarding</h2><p><strong>Local port forwarding</strong> is usually the first tunneling feature people encounter because it feels intuitive: you open a port on your own machine, and any traffic you send to that port gets delivered to a service running somewhere else. Nothing about the service changes. It still listens on its normal port, on its own network, but your laptop gains a <strong>private, encrypted shortcut</strong> straight to it.</p><p>A useful way to think about local forwarding is to imagine you&#8217;re standing outside a building. You can&#8217;t walk in, but you can open a small window on your side and slide data through it. SSH takes whatever goes into that window and carries it to the room you specify inside the building. From your local machine&#8217;s point of view, the service looks like it&#8217;s running right on your laptop, even if it&#8217;s actually behind several layers of restrictions.</p><p>One common situation where a local tunnel becomes invaluable is when you&#8217;re on a network where a server allows SSH access but blocks everything else, no HTTP, no HTTPS, nothing. Maybe the service you need is a website running on port 80 or 8080, but the <strong>firewall won&#8217;t let you reach it directly</strong>. Instead of requesting firewall changes or exposing the service publicly, you simply open an SSH local tunnel. Your HTTP traffic then rides inside the encrypted SSH connection and reaches the webserver without being blocked.</p><p>Let&#8217;s jump into the lab and see this in action.</p><h2>Lab Setup</h2><p>I have two machines set up:</p><ul><li><p><strong>Client</strong> &#8211; 192.168.60.10 (this is where I&#8217;ll run my SSH command)</p></li><li><p><strong>Webserver</strong> &#8211; 192.168.60.11 (this machine is running a simple website and allows SSH access)</p></li></ul><p>For now, the client can still access the webserver directly over HTTP. We&#8217;ll simulate a firewall blocking this access shortly. But first, let&#8217;s confirm the webserver is actually reachable, from the client run:</p><pre><code><code>$ vagrant ssh client
$ curl http://webserver</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!DDMC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!DDMC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 424w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 848w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 1272w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!DDMC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png" width="907" height="374" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ee03175b-e7a3-4720-8f77-a7328f364399_907x374.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:374,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:47067,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!DDMC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 424w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 848w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 1272w, https://substackcdn.com/image/fetch/$s_!DDMC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fee03175b-e7a3-4720-8f77-a7328f364399_907x374.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As you can see, the webserver responds normally.</p><h2><strong>Simulating a Firewall Block</strong></h2><p>Now, let&#8217;s block all incoming traffic on the webserver except SSH. We&#8217;ll do this by setting a simple <strong>firewall rule</strong> on the webserver:</p><pre><code><code>$ vagrant ssh webserver
$ sudo ufw allow ssh
$ sudo ufw enable</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!T7WU!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!T7WU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 424w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 848w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 1272w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!T7WU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png" width="907" height="276" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:276,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:45635,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!T7WU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 424w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 848w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 1272w, https://substackcdn.com/image/fetch/$s_!T7WU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7c634967-0fc8-4103-a346-3d1a0e74be98_907x276.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I allowed SSH before enabling the firewall. The reason is simple: when UFW is enabled, any traffic that doesn&#8217;t match an allow rule is blocked by an <strong>implicit deny</strong> at the bottom of the rule list. If we enabled the firewall first without allowing SSH, we would lock ourselves out. By allowing SSH beforehand, we make sure we can still access the machine.</p><p>Let&#8217;s confirm that the firewall is active:</p><pre><code><code>$ sudo ufw status</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!pqwy!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!pqwy!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 424w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 848w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 1272w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!pqwy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png" width="907" height="276" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:276,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:34250,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!pqwy!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 424w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 848w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 1272w, https://substackcdn.com/image/fetch/$s_!pqwy!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6a7550d1-fab0-4832-9aee-acde438de3cc_907x276.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>Our firewall is now running. If we try accessing the webserver over HTTP again from the client, it should fail:</p><pre><code><code>$ curl --max-time 5 http://webserver</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!VpPn!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 424w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 848w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 1272w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!VpPn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png" width="907" height="153" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:153,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:26277,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!VpPn!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 424w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 848w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 1272w, https://substackcdn.com/image/fetch/$s_!VpPn!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7e78a8fd-fb76-438a-8c23-49cfc19384cc_907x153.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>As expected, the connection times out because the firewall is blocking HTTP traffic.</p><blockquote><p><strong>NOTE:</strong> </p><p>I added the <code>--max-time 5</code> option to the curl command to prevent it from hanging indefinitely while waiting for a response. This is useful here because we know the connection will fail due to the firewall rule.</p></blockquote><div><hr></div><div class="subscription-widget-wrap-editor" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe&quot;,&quot;language&quot;:&quot;en&quot;}" data-component-name="SubscribeWidgetToDOM"><div class="subscription-widget show-subscribe"><div class="preamble"><p class="cta-caption">sysxplore is an indie, reader-supported publication.I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible. To support my work, consider becoming a free or paid subscriber and join the growing community of tech professionals.</p></div><form class="subscription-widget-subscribe"><input type="email" class="email-input" name="email" placeholder="Type your email&#8230;" tabindex="-1"><input type="submit" class="button primary" value="Subscribe"><div class="fake-input-wrapper"><div class="fake-input"></div><div class="fake-button"></div></div></form></div></div><div><hr></div><h2><strong>Creating the Local SSH Tunnel</strong></h2><p>Since we still need to reach the webserver, let&#8217;s set up a <strong>local SSH tunnel</strong>. This will forward a local port on the client machine directly to the webserver&#8217;s HTTP port through the existing SSH connection.</p><p>Now let&#8217;s set up the client, but before we run the command, here&#8217;s the <strong>syntax for local port forwarding</strong>:</p><pre><code><code>$ ssh -L &lt;local_host&gt;:&lt;local_port&gt;:&lt;remote_host&gt;:&lt;remote_port&gt; user@remote_ssh_server</code></code></pre><p>We&#8217;ll break this down properly in a moment. For now, let&#8217;s run the actual command on the client to create the tunnel:</p><pre><code><code>$ ssh -N -L localhost:8080:localhost:80 vagrant@webserver</code></code></pre><p>This is a good time to explain what each part means:</p><ul><li><p><strong>-L</strong> tells SSH that we&#8217;re setting up local port forwarding.</p></li><li><p><strong><a href="http://localhost:8080">localhost:8080</a></strong> means we want to open port 8080 on our local machine (the client).</p></li><li><p><strong><a href="http://localhost:80">localhost:80</a></strong> means that any traffic sent to <a href="http://localhost:8080">localhost:8080</a> on the client should be forwarded to <a href="http://localhost">localhost</a> on port 80 on the webserver from the webserver&#8217;s perspective.</p></li><li><p><strong>vagrant@webserver</strong> is simply the SSH server we&#8217;re creating the tunnel to, which in this case is the webserver itself.</p></li></ul><p>You also probably noticed the <strong>-N</strong> option:</p><ul><li><p><strong>-N</strong> tells SSH not to execute any remote commands. We only want the tunnel, not a remote shell.</p></li></ul><p>If we removed -N, SSH would log us into a shell session after establishing the tunnel, which isn&#8217;t what we want here. We only need the tunnel.</p><p>Once the tunnel is established, SSH appears to &#8220;hang&#8221;, but that&#8217;s normal. It&#8217;s not stuck; it&#8217;s simply waiting for traffic to arrive on port 8080. </p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!sEqU!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 424w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 848w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 1272w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!sEqU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png" width="907" height="153" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:153,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22803,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!sEqU!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 424w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 848w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 1272w, https://substackcdn.com/image/fetch/$s_!sEqU!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7ebe372b-236f-48f8-9899-29a373cc28d6_907x153.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>So we switch to a new terminal window to test it.</p><h2><strong>Verifying the Tunnel</strong></h2><p>In the new terminal window, let&#8217;s confirm that SSH is listening on port 8080 on the client:</p><pre><code><code>$ vagrant ssh client
$ lsof -i :8080</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!IFfp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 424w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 848w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 1272w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!IFfp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png" width="907" height="233" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:233,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:38600,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!IFfp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 424w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 848w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 1272w, https://substackcdn.com/image/fetch/$s_!IFfp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7b04ffca-aa68-4150-bd9e-023c2a4207ec_907x233.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>You can see that the SSH process is listening on both IPv4 and IPv6 localhost on port 8080 (http-alt). We can also confirm that the SSH connection to the webserver is active:</p><pre><code><code>$ sudo ss -tnp | grep sshd</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!_Jfi!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 424w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 848w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 1272w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png" width="907" height="233" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:233,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40696,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!_Jfi!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 424w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 848w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 1272w, https://substackcdn.com/image/fetch/$s_!_Jfi!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F00cd3a4b-2a42-41a5-b6b7-b69b0a6c7e5f_907x233.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>The first line shows the important part, our client (192.168.60.10) is connected to the webserver (192.168.60.11) over SSH. This confirms that the tunnel is <strong>active and ready</strong>.</p><p>Now, let&#8217;s try to access the webserver through the tunnel by sending a request to localhost:8080 on the client:</p><pre><code><code>$ curl localhost:8080</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!50eQ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!50eQ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 424w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 848w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 1272w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!50eQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png" width="907" height="320" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/e18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:320,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:40457,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!50eQ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 424w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 848w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 1272w, https://substackcdn.com/image/fetch/$s_!50eQ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fe18b255e-60b2-4e4a-8559-92dea3cb3a34_907x320.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And there we go, the tunnel works. The traffic was forwarded from our local port 8080 to the webserver&#8217;s port 80 via the SSH connection, <strong>bypassing the firewall restrictions</strong>.</p><h2><strong>Understanding the Two &#8220;localhost&#8221; Values</strong></h2><p>Before we move forward, there&#8217;s one point I really need to stress. A lot of people get confused about the <strong>two localhost values</strong> in the ssh -L command. So let&#8217;s clear that up properly.</p><p>The <strong>first localhost:8080</strong> refers to your <strong>local machine</strong>, the client where you are running the SSH command. This is the port you are opening on your own computer. You can even simplify it and write just <code>8080</code> instead of <code>localhost:8080</code>:</p><pre><code><code>$ ssh -N -L 8080:localhost:80 vagrant@webserver</code></code></pre><p>It works the same way. When you don&#8217;t specify an address for the local bind, SSH automatically uses the <strong>loopback interface</strong> (localhost). This is because, by default, SSH local port forwarding listens only on the client&#8217;s loopback interface (127.0.0.1), so including localhost is optional. To bind to another interface on the client, you must explicitly specify its IP or use option <strong>-g</strong>. This is useful if you want other machines to access the forwarded port on your laptop.</p><p>For example, I will terminate the previous tunnel by pressint CTRL+C and run the following:</p><pre><code><code>$ ssh -N -g -L 192.168.60.10:8080:localhost:80 vagrant@webserver</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!xO7J!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!xO7J!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 424w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 848w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 1272w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!xO7J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png" width="907" height="254" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:254,&quot;width&quot;:907,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:37831,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!xO7J!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 424w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 848w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 1272w, https://substackcdn.com/image/fetch/$s_!xO7J!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fad099795-6098-4e91-b731-7fcca30c0fc5_907x254.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>This will allow other machines on the same network to access port 8080 on your laptop (client). And the traffic will still be forwarded to the webserver&#8217;s port 80 via the SSH tunnel. Let&#8217;s test that using my host machine:</p><pre><code><code>$ curl http://192.168.60.10:8080</code></code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Qo-S!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Qo-S!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 424w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 848w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 1272w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png" width="905" height="404" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/dbaa16d3-0209-463c-acfd-740c485d797e_905x404.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:404,&quot;width&quot;:905,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:52865,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Qo-S!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 424w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 848w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 1272w, https://substackcdn.com/image/fetch/$s_!Qo-S!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fdbaa16d3-0209-463c-acfd-740c485d797e_905x404.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>And it works! The traffic is successfully forwarded through the SSH tunnel.</p><p>The <strong>second localhost:80</strong> refers to the <strong>target (destination) machine</strong> from the perspective of the SSH server. In this case, the SSH server is the <strong>webserver</strong>, so localhost on that side means the <strong>webserver</strong> itself. If the service were running on a different machine behind the SSH server, then you would replace localhost with that machine&#8217;s <strong>hostname</strong> or IP address. You&#8217;ll see exactly how this works when we cover SSH tunneling through a bastion host.</p><h3><strong>Visualizing the Traffic Flow</strong></h3><p>It&#8217;s one thing to run the command and see it work, and another to picture how the traffic actually moves. This diagram breaks the flow down step by step, from the client listening on port 8080, through the SSH tunnel, and finally to the service running on the remote machine.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!2Bl9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!2Bl9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 424w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 848w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 1456w" sizes="auto, 100vw"><img src="https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png" width="1456" height="1456" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1456,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:544195,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/180338061?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!2Bl9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 424w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 848w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 1272w, https://substackcdn.com/image/fetch/$s_!2Bl9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4a223016-4ef6-4e4d-8a38-b548b76858e5_4500x4501.png 1456w" sizes="auto, 100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>Quick Tip</h2><p>When you create an SSH tunnel, the session normally sits in the foreground and keeps your terminal busy. If you don&#8217;t want that, you can send the tunnel straight to the background by adding the <code>-f</code> option:</p><pre><code>$ ssh -f -N -g -L 192.168.60.10:8080:localhost:80 vagrant@webserver</code></pre><p>The <code>-f</code> flag tells SSH to move itself into the background just before running the command. This is handy when SSH will still prompt for a password or passphrase, but you don&#8217;t want the tunnel occupying your terminal afterward.</p><p>The only difference is how you stop it. When you run a tunnel in the foreground, you can simply press <code>CTRL + C</code> to close it. But once it&#8217;s in the background, you need to terminate the process manually.</p><p>You can find the process ID of the tunnel like this:</p><pre><code>$ lsof -i :8080</code></pre><p>Note the PID from the output, then end the tunnel with:</p><pre><code>kill &lt;PID&gt;</code></pre><p>This cleanly shuts down the background SSH tunnel without affecting anything else.</p><h2>Looking Ahead</h2><p>What we&#8217;ve covered here is only the first piece of what SSH tunnels can do. Local port forwarding gives you a private path into a service behind the SSH server, but there are situations where the direction needs to be reversed.</p><p>In the <a href="https://blog.sysxplore.com/p/part-2-ssh-remote-port-forwarding">next part </a>of this series, we&#8217;ll look at that opposite pattern, Remote Port Forwarding, and see how it lets a remote machine reach something running on your local system, even if you&#8217;re behind NAT or a firewall.</p><h2><strong>Thanks for reading!</strong></h2><p>If you enjoyed this content, don&#8217;t forget to leave a comment, like &#10084;&#65039; and subscribe to get more posts like this every week.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><p></p>]]></content:encoded></item><item><title><![CDATA[EP1: Networking in Linux - IP command]]></title><description><![CDATA[In Linux, almost everything about networking, interfaces, IP addresses, routing, and even the ARP cache, can be controlled from the terminal.]]></description><link>https://blog.sysxplore.com/p/ep1-networking-in-linux-ip-command</link><guid isPermaLink="false">https://blog.sysxplore.com/p/ep1-networking-in-linux-ip-command</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sun, 09 Nov 2025 10:52:20 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c790e8ac-7640-4e21-8469-d125963db8b1_1750x1250.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In Linux, almost everything about networking, interfaces, IP addresses, routing, and even the ARP cache, can be controlled from the terminal. For many years, tools like <code>ifconfig</code>, <code>route</code>, and <code>arp</code> handled these tasks, but those commands have long been deprecated. Their modern replacement is the <code>ip</code> command.</p><p><code>ip</code> is part of the <strong>iproute2</strong> suite, included by default in all modern Linux distributions. It&#8217;s a powerful all-in-one tool for managing network interfaces, IP addresses, routes, and neighbor tables, replacing older utilities like <code>ifconfig</code>, <code>route</code>, and <code>arp</code>.</p><p>You&#8217;ll use it to bring interfaces up or down, assign addresses, inspect routes, create network namespaces and even manipulate neighbor (ARP) tables.</p><p>In this episode, we&#8217;ll focus on using the <code>ip</code> command to manage network interfaces, addresses, routes, and connections on a Linux system.</p><h3>Peeking Inside the <code>ip</code> Command</h3><p>Before we start experimenting, let&#8217;s look at how the <code>ip</code> command is structured.</p><pre><code><code>ip [ OPTIONS ] OBJECT { COMMAND | help }</code></code></pre><p>At first glance, this may look dense, but it&#8217;s actually straightforward once you understand the pattern. The structure is always:</p><ol><li><p><strong>Options</strong> &#8211; Extra flags that change how <code>ip</code> behaves globally.</p></li><li><p><strong>Object</strong> &#8211; What part of the network you&#8217;re interacting with.</p><p>Each object represents a kernel networking subsystem. Some common ones are:</p><ul><li><p><code>link</code> &#8211; network interfaces (Ethernet, Wi-Fi, loopback)</p></li><li><p><code>address</code> &#8211; IPv4 or IPv6 addresses on those interfaces</p></li><li><p><code>route</code> &#8211; entries in the routing table</p></li><li><p><code>neighbor</code> &#8211; ARP or NDP neighbor cache</p></li><li><p><code>maddress</code> &#8211; multicast memberships</p></li><li><p><code>rule</code> &#8211; routing policy database</p></li></ul></li></ol><blockquote><p><strong>TIP</strong></p><p>You can use short forms too: addr for address, r for route, l for link, and so on.</p></blockquote><ol start="3"><li><p><strong>Command</strong> &#8211; The action you want to take on that object.</p><p>Each object supports its own set of commands:</p><ul><li><p><code>show</code> or <code>list</code> &#8211; display information</p></li><li><p><code>add</code> &#8211; create a new entry (address, route, etc.)</p></li><li><p><code>del</code> &#8211; remove an entry</p></li><li><p><code>replace</code> &#8211; update an existing one</p></li><li><p><code>help</code> &#8211; display valid options and syntax<code><br></code></p></li></ul></li></ol><h2>Managing Network Interfaces</h2><p>Every network device in Linux, whether wired, wireless, or virtual, is represented by an interface. These interfaces are managed through the <code>link</code> object of the <code>ip</code> command.</p><p>When you use <code>ip link</code>, you&#8217;re listing and controlling the network interfaces recognized by the system.</p><p>Let&#8217;s start exploring.</p><h3>Viewing All Interfaces</h3><p>To see all interfaces currently recognized by your system, run:</p><pre><code><code>ip link show</code></code></pre><p>You&#8217;ll get output similar to:</p><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CIUp!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 424w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 848w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 1272w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CIUp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png" width="1074" height="229" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/760c5589-4045-4d51-8a91-b816baebb370_1074x229.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:229,&quot;width&quot;:1074,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:55698,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/178288655?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CIUp!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 424w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 848w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 1272w, https://substackcdn.com/image/fetch/$s_!CIUp!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F760c5589-4045-4d51-8a91-b816baebb370_1074x229.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>Let&#8217;s decode that quickly:</p><ul><li><p>The number (<code>1:</code>, <code>2:</code>) is the interface index.</p></li><li><p><code>lo</code> and <code>enp0s3, enp0s8</code> are interface names.</p></li><li><p>Flags inside <code>&lt; &gt;</code> describe capabilities and state (<code>UP</code>, <code>BROADCAST</code>, <code>MULTICAST</code>, etc.).</p></li><li><p><code>mtu</code> is the <strong>maximum transmission unit</strong>, the largest packet size the interface can handle.</p></li><li><p><code>link/ether</code> shows the MAC address (hardware address).</p></li><li><p>The <code>state</code> tells whether the interface is currently <em>up</em> (active) or <em>down</em>.</p></li></ul><blockquote><p>NOTE</p><p><code>lo</code> is the <strong>loopback</strong> interface, a virtual interface the system uses to talk to itself. It&#8217;s always present and usually stays up.</p></blockquote><p></p><div><hr></div><p>Sysxplore is an indie, reader-supported publication.<br>I break down complex technical concepts in a straightforward way, making them easy to grasp. A lot of research goes into every piece to ensure the information you read is as accurate and practical as possible.</p><p>To support my work, consider becoming a <strong>free or paid subscriber</strong> and join the growing community of tech professionals.</p><p class="button-wrapper" data-attrs="{&quot;url&quot;:&quot;https://blog.sysxplore.com/subscribe?&quot;,&quot;text&quot;:&quot;Subscribe now&quot;,&quot;action&quot;:null,&quot;class&quot;:null}" data-component-name="ButtonCreateButton"><a class="button primary" href="https://blog.sysxplore.com/subscribe?"><span>Subscribe now</span></a></p><div><hr></div><p></p><h3>Bringing an Interface Down</h3><p>If you want to temporarily disable a network interface, use:</p><pre><code><code>$ sudo ip link set dev enp0s8 down</code></code></pre><div class="captioned-image-container"><figure><div class="image-link image2" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hjed!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 424w, https://substackcdn.com/image/fetch/$s_!hjed!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 848w, https://substackcdn.com/image/fetch/$s_!hjed!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 1272w, https://substackcdn.com/image/fetch/$s_!hjed!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hjed!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png" width="1076" height="229" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:229,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:46444,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/178288655?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hjed!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 424w, https://substackcdn.com/image/fetch/$s_!hjed!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 848w, https://substackcdn.com/image/fetch/$s_!hjed!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 1272w, https://substackcdn.com/image/fetch/$s_!hjed!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7f36a8fc-bbd0-403b-a820-ce8cdafdff6e_1076x229.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></div></figure></div><p>This shuts down packet transmission and reception on enp0s8 (notice the <strong>state</strong> is <strong>DOWN</strong>). It&#8217;s useful when testing configurations or disabling a specific connection without unplugging cables or removing devices.</p><p>After running it, the interface will no longer appear in <code>ip route show</code> outputs because it&#8217;s considered inactive by the kernel. The routing table only displays routes from active interfaces.</p><h3>Bringing an Interface Up</h3><p>When you bring an interface <em>up</em>, you&#8217;re telling the system that the device should start transmitting and receiving packets.</p><pre><code><code>$ sudo ip link set dev enp0s8 up</code></code></pre><p>This sends a netlink request that transitions the <code>enp0s8</code> interface to an <em>UP</em> state.</p><p>You can verify it:</p><pre><code><code>$ ip  -c link show enp0s8</code></code></pre><p>You should now see the <code>UP</code> flag and <code>state UP</code> in the output.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!GdGO!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!GdGO!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 424w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 848w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 1272w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!GdGO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png" width="1076" height="277" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:277,&quot;width&quot;:1076,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:72193,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://blog.sysxplore.com/i/178288655?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!GdGO!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 424w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 848w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 1272w, https://substackcdn.com/image/fetch/$s_!GdGO!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb0283077-ff7e-4023-9afd-74b7fa4c95a9_1076x277.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image buttonBase-GK1x3M"><svg aria-hidden="true" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" class="icon-noB79L"><g><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image buttonBase-GK1x3M"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2 icon-noB79L"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>And also notice, the interface route is now showing in the routing table.</p><h3>Renaming Interfaces</h3><p>Linux lets you rename interfaces, which can be useful for creating clear and predictable names when working with multiple network connections or during troubleshooting.</p>
      <p>
          <a href="https://blog.sysxplore.com/p/ep1-networking-in-linux-ip-command">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Part 3: Containers Are Just Linux Processes]]></title><description><![CDATA[In the previous part, we explored how PID namespaces isolate process trees, allowing each container to have its own &#8220;init&#8221; process and private view of running processes.]]></description><link>https://blog.sysxplore.com/p/part-3-containers-are-just-linux</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-3-containers-are-just-linux</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Tue, 04 Nov 2025 16:58:49 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/4e9575fd-027e-44f6-95a8-b1114d4a78a5_876x626.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the previous part, we explored how PID namespaces isolate process trees, allowing each container to have its own &#8220;init&#8221; process and private view of running processes. Now that you understand how process isolation works at the kernel level, let&#8217;s zoom out for a moment.</p><p>Before moving on to network namespaces, it&#8217;s important to grasp a key concept: <strong>conta&#8230;</strong></p>
      <p>
          <a href="https://blog.sysxplore.com/p/part-3-containers-are-just-linux">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Part 2: Linux Namespaces - PID Namespaces ]]></title><description><![CDATA[Process Isolation]]></description><link>https://blog.sysxplore.com/p/part-2-linux-namespaces-pid-namespaces</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-2-linux-namespaces-pid-namespaces</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Sat, 01 Nov 2025 06:03:55 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/c87d608e-8f30-4692-b18b-753ad5497039_876x626.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Welcome to the next part of our Linux Namespaces series.</p><p>In the previous part, we explored what Linux namespaces are, the different types available, and how they&#8217;re used by containers.</p><p>In this part, we&#8217;ll continue where we left off and take a closer look at one of the most fundamental namespace types, the <strong>PID namespace</strong>.</p><p>As you already know, every process r&#8230;</p>
      <p>
          <a href="https://blog.sysxplore.com/p/part-2-linux-namespaces-pid-namespaces">
              Read more
          </a>
      </p>
   ]]></content:encoded></item><item><title><![CDATA[Part 1: What Are Linux Namespaces]]></title><description><![CDATA[On a normal Linux system, everything seems to live in one big shared space.]]></description><link>https://blog.sysxplore.com/p/part-1-what-are-linux-namespaces</link><guid isPermaLink="false">https://blog.sysxplore.com/p/part-1-what-are-linux-namespaces</guid><dc:creator><![CDATA[TRÄW🤟]]></dc:creator><pubDate>Wed, 29 Oct 2025 18:38:27 GMT</pubDate><enclosure url="https://substack-post-media.s3.amazonaws.com/public/images/10935fd9-78e8-453d-b9db-c149491b33ed_876x626.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On a normal Linux system, everything seems to live in one big shared space.</p><p>Every process can see the same list of running programs, share the same network interfaces, and access the same filesystem hierarchy. If you open two terminals and run <code>ps aux</code>, both will display an identical process list because, at the kernel level, there&#8217;s only one global view o&#8230;</p>
      <p>
          <a href="https://blog.sysxplore.com/p/part-1-what-are-linux-namespaces">
              Read more
          </a>
      </p>
   ]]></content:encoded></item></channel></rss>