<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mohamed Gad-Elrab on Medium]]></title>
        <description><![CDATA[Stories by Mohamed Gad-Elrab on Medium]]></description>
        <link>https://medium.com/@mhmgad?source=rss-4da4fc0dddae------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*NrutBOjPf6o4hrIk.jpeg</url>
            <title>Stories by Mohamed Gad-Elrab on Medium</title>
            <link>https://medium.com/@mhmgad?source=rss-4da4fc0dddae------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 20:11:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mhmgad/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Routed All My GL.iNet]]></title>
            <link>https://medium.com/@mhmgad/how-i-routed-all-my-gl-inet-f73562150fff?source=rss-4da4fc0dddae------2</link>
            <guid isPermaLink="false">https://medium.com/p/f73562150fff</guid>
            <category><![CDATA[glinet-router]]></category>
            <category><![CDATA[routing]]></category>
            <category><![CDATA[network]]></category>
            <category><![CDATA[vpn]]></category>
            <category><![CDATA[networking]]></category>
            <dc:creator><![CDATA[Mohamed Gad-Elrab]]></dc:creator>
            <pubDate>Tue, 08 Jul 2025 04:35:11 GMT</pubDate>
            <atom:updated>2025-07-08T04:35:11.141Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I Routed All My GL.iNet MT3000 Traffic Through a Remote Tailscale Exit Node — Without Breaking Local Access</h3><h3>💡 The Goal</h3><p>Setting up a GL.iNet MT3000 (aka Beryl AX) router to route all connected devices through a remote Tailscale exit node, so that any device connected to it over Wi-Fi would route traffic securely through a remote server — no extra Tailscale client needed on the devices.</p><p>Sounds simple, right?</p><p>sounds simple — until you realize it breaks local router access, DNS, and sometimes everything; hence, LAN clients still couldn’t browse the web.</p><p>After lots of trial and error, here’s the exact setup that worked for me, allowing:</p><ul><li>✅ All client devices connected to the MT3000 to route through the remote Tailscale exit node.</li><li>✅ Local access to the router interface (192.168.8.1) preserved</li><li>✅ DNS and web access functioning on all clients</li><li>✅ The whole thing surviving reboots</li></ul><h3>📦 The Setup</h3><ul><li><strong>Router</strong>: GL.iNet MT3000 (Beryl AX)</li><li><strong>Firmware</strong>: Stock GL.iNet firmware (OpenWRT-based)</li><li><strong>Tailscale Service: </strong>offerred by the router — theoretically, it can be installed via SSHing on the router.</li><li><strong>Remote exit node</strong>: Another Tailscale device on a different network (any cloud VM or instance with Tailscale installed and connected to your account, IP forwarding enabled, and DNS resolution is setup correctly)</li><li><strong>Goal</strong>: Make all client traffic route through the remote exit node — but still be able to access the router locally</li></ul><h3>🧱 The Problem</h3><p>Tailscale on the router connected fine to Tailscale account (<a href="https://docs.gl-inet.com/router/en/4/interface_guide/tailscale/">following the official docs</a>). Enabling exit node on the device also worked as described in the documentations</p><figure><img alt="Selecting exit node" src="https://cdn-images-1.medium.com/max/664/0*OtedeAyCj4t_FSTt.png" /></figure><p>I was able to verify it by:</p><ol><li>ssh into the GL router using</li></ol><pre>ssh root@192.168.8.1</pre><p>2. checking public IP of the router by calling <a href="http://ifconfig.me/">ifconfig.me</a> website from the terminal</p><pre>curl ifconfig.me</pre><p>If it works, you should see the public IP of the remote exit node.</p><p><strong>That was the case for me, but clients connected to the router still had no internet access</strong>.</p><p>I could also verify that the exit node’s traffic was working if I enabled it directly from my Android phone. So the issue had to be somewhere between the LAN and Tailscale — likely <strong>NAT</strong>.</p><h3>Diagnosing the Missing Pieces</h3><p>By SSHing into the router and checking iptables:</p><pre>iptables -t nat -L -v</pre><p>I confirmed there was <strong>no NAT (MASQUERADE) rule</strong> for LAN-to-Tailscale traffic.</p><p>Tailscale doesn’t automatically NAT traffic coming from LAN devices — and OpenWrt doesn’t either. You must do it yourself.</p><h3>✅ The Fix</h3><p>The main idea is to allow the traffic from the LAN to be tunneled to the remote exit node, with an expetion for the local traffic.</p><ol><li>Making sure that IP forwarding is enabled on the router</li><li>Set up iptables to NAT LAN client traffic through Tailscale virtual interfacetailscale0</li><li>Exclude local traffic (like access to 192.168.8.1) from being routed through the VPN</li><li>Make it all persistent using /etc/firewall.user</li></ol><h3>🛠️ Step-by-Step</h3><p>Lets go through it slowly,</p><p><strong>1. SSH to the router</strong></p><pre>ssh root@192.168.8.1 </pre><p><strong>2. Enable IP Forwarding</strong></p><p>Usually it is enabled, check that by</p><pre>cat /proc/sys/net/ipv4/ip_forward</pre><p>the forwarding value should be 1</p><p>if not, run</p><pre>echo 1 &gt; /proc/sys/net/ipv4/ip_forward</pre><p>Make it permanent:</p><pre>echo &quot;net.ipv4.ip_forward=1&quot; &gt;&gt; /etc/sysctl.conf</pre><p><strong>3. Configure Tailscale</strong></p><p>Start or restart Tailscale with:</p><pre>tailscale up --exit-node=100.x.x.x --exit-node-allow-lan-access</pre><p>Replace 100.x.x.x with your actual exit node Tailscale IP.</p><p><strong>4. Add Firewall Rules (Persistently)</strong></p><p>We would like to add the rules to the iptables, yet the router will reset the changes with every restart, so we need to make sure that our changes are re-applied every time.</p><p>For that, edit the firewall user script:</p><pre>vi /etc/firewall.use</pre><p>Paste in the following:</p><pre># Allow LAN clients to communicate with each other<br>iptables -A INPUT -i br-lan -j ACCEPT<br>iptables -A FORWARD -i br-lan -o br-lan -j ACCEPT<br><br><br># Allow forwarding between LAN and Tailscale<br>iptables -A FORWARD -i br-lan -o tailscale0 -j ACCEPT<br>iptables -A FORWARD -i tailscale0 -o br-lan -j ACCEPT<br><br># NAT traffic going out Tailscale (excluding local IPs)<br>iptables -t nat -A POSTROUTING -o tailscale0 ! -d 192.168.0.0/16 -j MASQUERADE<br><br># Drop invalid connections<br>iptables -A FORWARD -m conntrack --ctstate INVALID -j DROP</pre><p>Then apply the rules:</p><pre>/etc/init.d/firewall restart</pre><p><strong>NOTE: you might need to restart the router for the changes to take effect.</strong></p><h3>🧪 Test It</h3><p>Now connect a device (phone, laptop, etc.) to the MT3000’s Wi-Fi or LAN port and:</p><ul><li>Visit <a href="https://ifconfig.me/">ifconfig.me</a> → You should see the <strong>exit node’s IP</strong></li><li>Go to <a href="http://192.168.8.1/">192.168.8.1</a> → You should see the <strong>router UI</strong></li><li>Try browsing websites → Everything should load normally</li></ul><p>Finally, enjoy browsing!</p><p>Note: wrote with the help of ChatGPT!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f73562150fff" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>