<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>VPN | no dogma blog</title><link>https://nodogmablog.bryanhogan.net/tag/vpn/</link><atom:link href="https://nodogmablog.bryanhogan.net/tag/vpn/index.xml" rel="self" type="application/rss+xml"/><description>VPN</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Sun, 08 Nov 2026 00:00:00 +0000</lastBuildDate><image><url>https://nodogmablog.bryanhogan.net/media/icon_hu9c23d68d4e9f1f9acfa8237e5c2ea674_3344_512x512_fill_lanczos_center_3.png</url><title>VPN</title><link>https://nodogmablog.bryanhogan.net/tag/vpn/</link></image><item><title>Connecting a Raspberry Pi to Ubuntu when Using a VPN and Sharing the Internet Connection</title><link>https://nodogmablog.bryanhogan.net/2026/11/connecting-a-raspberry-pi-to-ubuntu-when-using-a-vpn-and-sharing-the-internet-connection/</link><pubDate>Sun, 08 Nov 2026 00:00:00 +0000</pubDate><guid>https://nodogmablog.bryanhogan.net/2026/11/connecting-a-raspberry-pi-to-ubuntu-when-using-a-vpn-and-sharing-the-internet-connection/</guid><description>&lt;p>&lt;em>&lt;strong>This is not a standalone post - you should read an &lt;a href="https://nodogmablog.bryanhogan.net/2026/11/sharing-internet-access-from-a-ubuntu-laptop-to-a-raspberry-pi/">earlier post&lt;/a> to understand how to connect a Raspberry Pi to Ubuntu using a direct Ethernet cable, and how to share the internet connection from Ubuntu to the Raspberry Pi.&lt;/strong>&lt;/em>&lt;/p>
&lt;h2 id="the-vpn-problem">The VPN Problem&lt;/h2>
&lt;p>&lt;em>&lt;strong>There are some generalizations here, and you may need to adjust the steps for your specific VPN.&lt;/strong>&lt;/em>&lt;/p>
&lt;p>VPNs usually route all traffic through the VPN. This means the Raspberry Pi may not be assigned a DHCP address and may not be able to access the internet via that Ubuntu machine.&lt;/p>
&lt;h3 id="the-dhcp-problem">The DHCP Problem&lt;/h3>
&lt;p>There are a couple of choices here: you can assign a static IP address to the Raspberry Pi, but that means you need a monitor and keyboard, and my goal is to avoid using them.&lt;/p>
&lt;p>Instead, go to your VPN and add ports 67 and 68 on UDP to your allowlist. This will let the Raspberry Pi get a DHCP address from the Ubuntu machine.&lt;/p>
&lt;p>If your Pi is connected, pull the Ethernet cable and reconnect it, and it should get a DHCP address.&lt;/p>
&lt;p>Then use the following command to check the address assigned to the Raspberry Pi -&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">sudo cat /var/lib/NetworkManager/dnsmasq-*.leases&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>You still may not be able to access the internet, though.&lt;/p>
&lt;h3 id="the-internet-problem">The Internet Problem&lt;/h3>
&lt;p>Again, this is going to depend on your VPN, but I needed to allow forwarding on the VPN interface.&lt;/p>
&lt;p>Because I don&amp;rsquo;t often connect a Pi directly to my Ubuntu machine, I am happy to do it only when I need to.&lt;/p>
&lt;p>You can turn on forwarding with the following on all network interfaces using -&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">sudo sysctl -w net.ipv4.ip_forward&lt;/span>=&lt;span style="color:#5a2">1&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>If you want to turn it on only for the VPN interface, you need to know the name of the interface, which you can find with -&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">ip addr&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>The name might be something like &lt;code>tun0&lt;/code>. If you don&amp;rsquo;t know the name, you can turn off the VPN, run the above command again, and see which interface disappears. Now you have the name of the VPN interface.&lt;/p>
&lt;p>Then you can turn on forwarding for that interface with -&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#fff;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cfg" data-lang="cfg">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#000">sysctl net.ipv4.conf.tun0.forwarding&lt;/span>=&lt;span style="color:#5a2">1&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
&lt;p>This command does not survive reboots, you will need to run in again the next time you need forwarding.&lt;/p></description></item></channel></rss>