<?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"><channel><title><![CDATA[decentralize.tech]]></title><description><![CDATA[Building the open web, one layer at a time. I write about the infrastructure of trust: verifiable compute and storage, censorship-resistant identity, and AI sys]]></description><link>https://decentralizetech.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6a7df36e6d4f1a0cc7658357/29704910-b0b9-4b82-9705-1ccdfac56e0f.png</url><title>decentralize.tech</title><link>https://decentralizetech.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Fri, 04 Dec 2026 22:09:49 GMT</lastBuildDate><atom:link href="https://decentralizetech.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Chained Anonymity Stack]]></title><description><![CDATA[A layered architecture guide: nested VPN tunnels, a self-hosted proxy, staged DNS, Yggdrasil peering, and Tor integration—with verification steps.]]></description><link>https://decentralizetech.hashnode.dev/chained-anonymity-stack</link><guid isPermaLink="true">https://decentralizetech.hashnode.dev/chained-anonymity-stack</guid><category><![CDATA[yggdrasil]]></category><category><![CDATA[mullvad]]></category><category><![CDATA[protonvpn]]></category><category><![CDATA[tor]]></category><category><![CDATA[OpenWRT]]></category><category><![CDATA[cybersecurity]]></category><category><![CDATA[privacy]]></category><category><![CDATA[networking]]></category><category><![CDATA[Linux]]></category><dc:creator><![CDATA[Decentralize.tech]]></dc:creator><pubDate>Mon, 30 Nov 2026 13:10:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6a7df36e6d4f1a0cc7658357/ee4a92b7-bc9f-4c41-870a-58a5bd77de92.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>ProtonVPN → Mullvad → Proxy → Yggdrasil ⇄ Tor, with staged DNS and a planned OpenWRT migration</h3>
<p><em>Abstract: this document specifies a layered network-anonymity topology in which two independently operated VPN tunnels, a self-hosted proxy hop, the Yggdrasil mesh network, and the Tor network are composed into a single chain, with DNS resolution partitioned into two tiers mapped to distinct positions in the chain. Part I establishes the terminology and the rationale for each layer; Part II is the implementation, with annotated commands; Part III covers operations, verification, failure containment, and the subsequent migration to an OpenWRT router platform. Explanations are written to be accessible to operators encountering these components for the first time.</em></p>
<hr />
<h1>Part I — Design Foundations</h1>
<h2>1. Glossary of terms and acronyms</h2>
<table>
<thead>
<tr>
<th>Term</th>
<th>Stands for</th>
<th>Meaning</th>
</tr>
</thead>
<tbody><tr>
<td><strong>VPN</strong></td>
<td>Virtual Private Network</td>
<td>An encrypted tunnel between a device and a server operated by a VPN company. All traffic travels through the tunnel, so the local network provider observes only "encrypted connection to the VPN server."</td>
</tr>
<tr>
<td><strong>ISP</strong></td>
<td>Internet Service Provider</td>
<td>The company providing physical internet access. It knows the subscriber's identity and observes all traffic entering/leaving the premises.</td>
</tr>
<tr>
<td><strong>IP / IPv4 / IPv6</strong></td>
<td>Internet Protocol, versions 4 and 6</td>
<td>The internet's addressing system. IPv4 addresses take the form <code>89.14.2.7</code>; IPv6 addresses take the form <code>2a01:4f8::1</code>. An "IP address" is the identity traffic carries.</td>
</tr>
<tr>
<td><strong>DNS</strong></td>
<td>Domain Name System</td>
<td>The system translating names (<code>example.org</code>) into IP addresses. Unencrypted DNS allows whoever handles the queries — often the ISP — to log which sites are being looked up.</td>
</tr>
<tr>
<td><strong>DoT</strong></td>
<td>DNS over TLS</td>
<td>DNS queries wrapped in TLS encryption, preventing intermediaries from reading looked-up names.</td>
</tr>
<tr>
<td><strong>DoH</strong></td>
<td>DNS over HTTPS</td>
<td>Alternative to DoT; DNS carried inside ordinary HTTPS.</td>
</tr>
<tr>
<td><strong>TLS</strong></td>
<td>Transport Layer Security</td>
<td>The encryption protocol behind HTTPS; encrypts a connection between two endpoints.</td>
</tr>
<tr>
<td><strong>WireGuard</strong></td>
<td>—</td>
<td>A modern VPN protocol: compact, fast, cryptographically sound. Supported by both ProtonVPN and Mullvad; the recommended protocol for chaining.</td>
</tr>
<tr>
<td><strong>wg / wg-quick</strong></td>
<td>WireGuard tooling</td>
<td><code>wg</code> is WireGuard's Linux command tool; <code>wg-quick</code> is a helper script that brings up a WireGuard interface from a config file (<code>wg-quick up mv0</code>).</td>
</tr>
<tr>
<td><strong>OpenVPN</strong></td>
<td>—</td>
<td>An older VPN protocol. Functional, but heavier; slower and clumsier inside chains. WireGuard preferred.</td>
</tr>
<tr>
<td><strong>SOCKS5</strong></td>
<td>Socket Secure v5</td>
<td>A simple proxy protocol: a middleman server forwarding traffic on a client's behalf. Provides no encryption of its own — it relays. Consequently it is placed <em>inside</em> encrypted tunnels in this design.</td>
</tr>
<tr>
<td><strong>Proxy</strong></td>
<td>—</td>
<td>Any middleman server forwarding traffic. A proxy sees where traffic came from and where it goes, unless the content inside is already encrypted.</td>
</tr>
<tr>
<td><strong>Tor</strong></td>
<td>The Onion Router</td>
<td>A network of volunteer relays. Traffic is wrapped in three layers of encryption; each relay peels one and knows only the previous and next hop. <code>.onion</code> addresses are hidden services reachable only via Tor. The standard local proxy port is <code>9050</code>.</td>
</tr>
<tr>
<td><strong>Arti</strong></td>
<td>—</td>
<td>The Rust reimplementation of Tor, under active development; can replace the C <code>tor</code> daemon.</td>
</tr>
<tr>
<td><strong>Yggdrasil</strong></td>
<td>—</td>
<td>An experimental encrypted mesh network. Participating nodes link directly to each other; traffic routes across the mesh over IPv6-range addresses in <code>0200::/7</code>. Node identity is a cryptographic key, not an account; no central authority assigns or revokes addresses.</td>
</tr>
<tr>
<td><strong>Peer / peering</strong></td>
<td>—</td>
<td>In Yggdrasil: another node to which a machine directly connects. A "public peer" is a node operated by volunteers for newcomers to attach to.</td>
</tr>
<tr>
<td><strong>Mesh network</strong></td>
<td>—</td>
<td>A network where nodes connect to neighbors and route for each other, rather than all traffic flowing through a central provider.</td>
</tr>
<tr>
<td><strong>MTU</strong></td>
<td>Maximum Transmission Unit</td>
<td>The largest packet size a link can carry, in bytes (typical internet: 1500). Every tunnel layer consumes bytes for its own headers ("overhead"), so nested tunnels require progressively smaller MTUs. Misconfigured MTUs cause silent packet loss.</td>
</tr>
<tr>
<td><strong>MSS clamping</strong></td>
<td>Maximum Segment Size</td>
<td>A firewall technique rewriting TCP handshakes so sessions agree on packet sizes fitting every tunnel layer. Remedy for "ping works, bulk transfer stalls" symptoms.</td>
</tr>
<tr>
<td><strong>TUN</strong></td>
<td>(virtual) Tunnel interface</td>
<td>A software network card. VPNs and Yggdrasil each create one (e.g. <code>ygg0</code>, <code>tun-proton0</code>). Traffic sent to a TUN is handed to the controlling program rather than a physical wire.</td>
</tr>
<tr>
<td><strong>netns</strong></td>
<td>Network namespace</td>
<td>A Linux kernel feature granting a process a private copy of networking: its own routes, firewall, and DNS configuration. Effectively a sealed sub-computer within the machine. Central to the stacking method in this proposal.</td>
</tr>
<tr>
<td><strong>iptables / nftables</strong></td>
<td>—</td>
<td>Linux kernel firewall tooling. <code>iptables</code> is legacy syntax; <code>nftables</code> its successor; ufw and firewalld are front-ends over both.</td>
</tr>
<tr>
<td><strong>ufw</strong></td>
<td>Uncomplicated Firewall</td>
<td>Debian/Ubuntu firewall front-end.</td>
</tr>
<tr>
<td><strong>firewalld</strong></td>
<td>Firewall daemon</td>
<td>Fedora/RHEL/SUSE firewall front-end.</td>
</tr>
<tr>
<td><strong>NAT / masquerade</strong></td>
<td>Network Address Translation</td>
<td>Rewriting packet addresses in transit so multiple machines or namespaces share one outgoing identity.</td>
</tr>
<tr>
<td><strong>VPS</strong></td>
<td>Virtual Private Server</td>
<td>A rented virtual machine in a datacenter (~$3–6/month). Used here to host a self-operated proxy.</td>
</tr>
<tr>
<td><strong>kill switch</strong></td>
<td>—</td>
<td>Firewall logic blocking all connectivity unless the VPN tunnel is up. Failure mode: no connectivity, not exposure.</td>
</tr>
<tr>
<td><strong>leak</strong></td>
<td>—</td>
<td>Any situation where traffic or DNS bypasses the chain with the real identity. IPv6 leaks are the most common class.</td>
</tr>
<tr>
<td><strong>exit / exit node</strong></td>
<td>—</td>
<td>The last hop of a tunnel or mesh, where traffic re-emerges toward its destination. "Exit IP" is the address destinations observe.</td>
</tr>
<tr>
<td><strong>entry / guard</strong></td>
<td>—</td>
<td>The first hop of a Tor circuit.</td>
</tr>
<tr>
<td><strong>E2EE</strong></td>
<td>End-to-End Encryption</td>
<td>Encryption where only the two endpoints can read content; intermediate carriers cannot.</td>
</tr>
<tr>
<td><strong>DAITA</strong></td>
<td>Defense against AI-guided Traffic Analysis</td>
<td>A Mullvad feature padding traffic to defeat statistical traffic analysis.</td>
</tr>
<tr>
<td><strong>obfs4</strong></td>
<td>Obfuscator transport 4</td>
<td>A Tor pluggable transport disguising Tor traffic as random noise to defeat censorship.</td>
</tr>
<tr>
<td><strong>dnscrypt-proxy</strong></td>
<td>—</td>
<td>A DNS forwarder supporting DoT/DoH and anonymized relays; deployed twice in this design, once per DNS tier.</td>
</tr>
<tr>
<td><strong>systemd</strong></td>
<td>—</td>
<td>Linux's init/service manager. Units (<code>.service</code> files) define programs started at boot in dependency order.</td>
</tr>
<tr>
<td><strong>resolv.conf</strong></td>
<td>—</td>
<td>The file designating the system's DNS server. Each network namespace can have its own — the mechanism behind the two-tier DNS in Phase 7.</td>
</tr>
<tr>
<td><strong>HJSON</strong></td>
<td>Human JSON</td>
<td>Yggdrasil's relaxed configuration format: JSON tolerant of comments and omitted quotes.</td>
</tr>
<tr>
<td><strong>CLI / GUI</strong></td>
<td>Command-Line / Graphical User Interface</td>
<td>Terminal versus point-and-click operation.</td>
</tr>
<tr>
<td><strong>yggdrasilctl</strong></td>
<td>—</td>
<td>Yggdrasil's status/control command (<code>getSelf</code>, <code>getPeers</code>).</td>
</tr>
<tr>
<td><strong>proxychains-ng</strong></td>
<td>—</td>
<td>Tool forcing a single application's connections through a defined SOCKS proxy chain.</td>
</tr>
<tr>
<td><strong>tun2socks / redsocks</strong></td>
<td>—</td>
<td>Transparent redirectors: capture all traffic on an interface and push it into a SOCKS proxy, requiring no per-application configuration.</td>
</tr>
</tbody></table>
<h2>2. The mental model: what a chained topology physically is</h2>
<p><strong>Without any tunnel,</strong> every packet carries two facts: its destination and its origin. The origin is the real IP address, assigned by the ISP and tied to a subscriber's identity. Every party on the path — ISP, transit carriers, destination — observes both. This architecture is likely overkill for most usecases, but intended to thoroughly protect anonymity of users in high-risk situations.</p>
<p><strong>With one VPN tunnel,</strong> packets travel to the VPN server first, then onward to the destination, wrapped in encryption en route. Consequences:</p>
<ul>
<li>The ISP observes only "encrypted traffic to the VPN server."</li>
<li>The destination observes only "traffic from the VPN server's IP."</li>
<li>The VPN server observes <em>both sides</em> — the real IP and the destinations. A single VPN is therefore a shift of trust, not an elimination of it.</li>
</ul>
<p><strong>With a chain,</strong> tunnels are nested inside tunnels. Each layer removes one witness:</p>
<pre><code class="language-markdown">ISP ──&gt; [Layer 1: firewall + ProtonVPN] ──&gt; [Layer 2: Mullvad] ──&gt; [Layer 3: proxy]
            │                                          │
ISP sees: only Proton's IP              Proton sees: only Mullvad's IP
                                        Mullvad sees: only the proxy
                                        Proxy sees: only Yggdrasil peers
                                        Yggdrasil sees: the mesh node key
</code></pre>
<p>To reconstruct a session end-to-end, operators at <em>multiple</em> layers must retain logs and correlate them — independent companies (Swiss and Swedish jurisdictions respectively), a self-operated server, and community mesh nodes. Not impossible for a global-scale adversary, but a categorically higher bar than trusting a single vendor. You don't have to trust my word for shit, always do your own research.</p>
<p><strong>Boundary conditions of the design.</strong> Stated plainly:</p>
<ul>
<li>Content that is not itself end-to-end encrypted (cleartext HTTP) remains readable at the final exit. The chain protects identity and metadata, not unencrypted payloads.</li>
<li>Traffic <em>volume and timing</em> remain visible to every layer. An adversary at the local link can observe that activity exists; the chain obscures what it is and where it terminates.</li>
<li>A globally capable adversary observing many internet points simultaneously can attempt cross-layer timing correlation. The chain raises the cost substantially without eliminating the class of attack. Operational Security is fundamental.</li>
</ul>
<h2>3. Layer-by-layer rationale</h2>
<p>Each layer exists because the preceding layer <em>creates</em> a new witness; the next layer is intended to remove, or at least compartamentalize that witness.</p>
<p><strong>Layer 0 — Base firewall (ufw/firewalld/etc). The kill switch that makes every other layer meaningful.</strong> Applications reconnect aggressively. If a tunnel dies for thirty seconds — daemon crash, suspend/resume, link flap — every application re-establishes connections over the bare link, exposing the real IP. The base firewall imposes a standing rule: <strong>nothing leaves the machine except toward the VPN's own servers.</strong> With tunnels up, traffic flows through tunnel interfaces; with them down, the machine is simply offline. Offline is the intended failure mode. Without this layer, all subsequent layers are cosmetic — one crash away from exposure.</p>
<p><strong>Layer 1 — ProtonVPN (outer tunnel). Removes the ISP as witness.</strong> The ISP holds the most physical knowledge of any adversary: identity, address, payment records, and visibility of every unencrypted byte leaving the premises. One tunnel reduces its view to "encrypted connection to Proton server X." Residual limitation: Proton then observes the real IP and the destinations — the motivation for the next layer.</p>
<p><strong>Layer 2 — Mullvad (inner tunnel). Removes Proton as witness.</strong> Nested inside the Proton tunnel, Mullvad traffic presents itself to Proton as an opaque connection to a Mullvad server. Proton no longer sees destinations; Mullvad cannot see the home IP. Two independent companies in different jurisdictions must both log and collude to reconstruct a session. Residual limitation: Mullvad observes destinations. Incidental benefit: each VPN exit IP is shared by thousands of simultaneous users, placing traffic in a crowd at every layer.</p>
<p><strong>Layer 3 — Self-operated SOCKS5 proxy. Introduces a witness under the operator's control.</strong> Between Mullvad and the mesh, a small self-rented server adds a hop whose logs are held by no third party. Its cryptographic contribution is modest (the surrounding tunnels already encrypt content); its value is operational independence — a hop that can be relocated, rotated, or destroyed at will, and whose retention policy is trivially "none." If server operation is undesirable, this layer may be omitted and Tor (Layer 5) absorbs most of its function. Design constraint: <strong>free proxies are excluded categorically</strong> — they are commonly operated by parties that sniff, log, or modify traffic, and embedding an unknown adversary inside the chain negates the architecture.</p>
<p><strong>Layer 4 — Yggdrasil. The destination network.</strong> All prior layers are transport. Yggdrasil is the objective: a decentralized mesh in which node identity is a locally generated keypair (no registration, no revocation authority), peerings are encrypted, and routing is distributed. Its existence shapes the lower layers: traffic to Yggdrasil peers should present as unremarkable TLS connections to arbitrary servers, since the mesh itself is periodically blocked by filtering networks — hence the wrappers.</p>
<p><strong>Layer 5 — Tor. Two complementary orientations.</strong> Orientation A (Yggdrasil <em>over</em> Tor): the node connects to peers via Tor hidden services. Neither the Mullvad exit nor any intermediary learns which peers are chosen, and peers observe no routable IP at all. Orientation B (Tor <em>over</em> Yggdrasil): Tor entry traffic rides the mesh, so Tor guard relays observe a mesh address and local observers cannot fingerprint Tor usage. The orientations defend against different adversaries; Phase 6 specifies both.</p>
<p><strong>The two-tier DNS. Because DNS resolution is itself a witness.</strong> Every name lookup telegraphs the next connection to whoever answers it. DNS therefore obeys the same layering as traffic:</p>
<ul>
<li><strong>Tier 1 — 1.1.1.1 (Cloudflare), on the bare link, DoT-encrypted.</strong> Before any tunnel exists, the system must resolve the names of VPN endpoints, the proxy, and peers. This bootstrap traffic necessarily traverses the physical link; it is directed to Cloudflare under DoT so the ISP observes only contact with Cloudflare, never the names. Only infrastructure names resolve here — never end-user browsing.</li>
<li><strong>Tier 2 — 9.9.9.9 (Quad9), inside the innermost tunnel, DoT-encrypted.</strong> Once the chain is up, all other resolution traverses it, so the resolver — which unavoidably learns lookup habits — observes the Mullvad/proxy exit IP, never the home IP.</li>
</ul>
<p>The placement rule follows directly: the bootstrap resolver sits nearest the ISP; the resolving-it-all resolver sits nearest the exit tunnel. Section Phase 7 enforces this mechanically rather than by convention.</p>
<h2>4. The OpenWRT end-state</h2>
<p><a href="https://openwrt.org/">OpenWRT</a> is a Linux distribution for routers. In the target state, the chain executes on the router rather than the workstation: every device on the LAN inherits the protection transparently, with no per-device configuration. Divergences from the workstation build (hardware capacity, package availability, DNS placement on the router's resolver) are flagged where they occur.</p>
<h2>5. Operational expectations</h2>
<ul>
<li><strong>Latency.</strong> Six encapsulation layers plus Tor routinely produce multi-second page loads. This follows from round-trips through physically distant relays and is inherent, not pathological.</li>
<li><strong>Complexity.</strong> Each layer multiplies failure modes, and inner-layer failures masquerade as outer-layer ones. Incremental construction with verification at each phase (Part III) is mandatory.</li>
<li><strong>IPv6 is the dominant leak class.</strong> Common rule sets cover IPv4 only; a single missing IPv6 deny permits the real address to bypass every tunnel simultaneously. The verification procedure makes <code>curl -6</code> checks non-negotiable after every phase.</li>
<li><strong>MTU misconfiguration mimics link flakiness.</strong> Silent packet loss inside nested tunnels produces "connected but transfers stall" symptoms costly to diagnose unprepared. The Phase 5 MTU table prevents it.</li>
<li><strong>Productized alternatives exist and should be evaluated first.</strong> ProtonVPN offers <a href="https://protonvpn.com/support/secure-core-vpn/">Secure Core</a> (a supported two-hop design) and <a href="https://protonvpn.com/support/tor-over-vpn/">Tor-over-VPN</a> entry servers; Mullvad supports <a href="https://mullvad.net/en/support/multihop-with-socks5-proxies/">multihop via SOCKS5</a>. These cover part of the proposed architecture with vendor support. The hand-built chain is justified where full path ownership and Yggdrasil composability are required; the comparison should be made deliberately, not by default.</li>
</ul>
<hr />
<h1>Part II — Implementation</h1>
<p>Phases are ordered; each assumes the previous phase is <em>verified</em>, not merely attempted.</p>
<h2>Phase 0 — Firewall discovery</h2>
<pre><code class="language-bash">systemctl is-active ufw firewalld 2&gt;/dev/null
ls -d /etc/ufw /etc/firewalld 2&gt;/dev/null
command -v ufw firewall-cmd
</code></pre>
<p>Whichever reports <code>active</code> is the system's firewall manager. <strong>If both are installed, remove one</strong> (<code>sudo apt purge firewalld</code> / <code>sudo dnf remove ufw</code>): two managers writing into the same kernel netfilter produce rule-ordering races presenting as intermittent network outages. All subsequent syntax is given as ufw first, firewalld equivalents after.</p>
<p>Record interface names (<code>ip -br link</code>) — a physical interface (<code>eth0</code>, <code>wlan0</code>, <code>enp3s0</code>…) plus tunnel interfaces appearing in later phases. Re-run after each tunnel comes up.</p>
<h2>Phase 1 — Base firewall and outer kill switch</h2>
<p><strong>Objective:</strong> default posture becomes deny-everything (in and out); exceptions are carved for (a) traffic to the VPN servers themselves, permitting tunnel formation, and (b) traffic on tunnel interfaces once they exist. All else is dropped.</p>
<h3>ufw</h3>
<pre><code class="language-bash">sudo ufw default deny incoming          # nothing may connect inbound…
sudo ufw default deny outgoing          # …and nothing leaves unless a rule below permits it

# Loopback: processes communicating on-machine. Required — Tor, local DNS proxies,
# and dnscrypt all operate over loopback.
sudo ufw allow out on lo
sudo ufw allow in on lo

# Local network (LAN services, printers). Restrict 192.168.0.0/16 to the actual subnet in production.
sudo ufw allow out to 192.168.0.0/16
sudo ufw allow in from 192.168.0.0/16   # remove if inbound LAN access is not required

# The kill-switch rule: the ONLY permitted unencrypted egress is WireGuard traffic
# to the Proton server. Obtain the server IP from the Proton client after first connect.
sudo ufw allow out udp to &lt;PROTON_ENDPOINT_IP&gt; port 51820 proto udp

# Tunnel interfaces, as they come into existence:
sudo ufw allow out on tun-proton0       # adjust to the interface Proton actually creates
sudo ufw allow out on mullvad0          # adjust after Phase 3
sudo ufw allow out on ygg0              # created in Phase 5
sudo ufw allow in on tun-proton0        # return traffic from Proton's side
sudo ufw allow in on mullvad0

sudo ufw enable
sudo ufw status verbose
</code></pre>
<h3>firewalld equivalents</h3>
<pre><code class="language-bash">sudo firewall-cmd --set-default-zone=drop
sudo firewall-cmd --permanent --zone=trusted --add-interface=tun-proton0
sudo firewall-cmd --permanent --zone=trusted --add-interface=mullvad0
sudo firewall-cmd --permanent --zone=trusted --add-interface=ygg0
sudo firewall-cmd --permanent --direct --add-rule ipv4 filter OUTPUT 0 -p udp -d &lt;PROTON_ENDPOINT_IP&gt; --dport 51820 -j ACCEPT
sudo firewall-cmd --reload
</code></pre>
<p><strong>Kill-switch semantics:</strong> the sole unencrypted doorway is the VPN endpoint. Tunnel failure → default-deny reasserts → silence instead of exposure. This asymmetry is the security model's core.</p>
<p><strong>Interaction constraint:</strong> Mullvad's daemon ships its own nftables-based kill switch. Two rule writers on one kernel cause precedence instability. Resolution adopted here: the base firewall (Phase 1) is the sole kill switch; Mullvad's application-level kill switch remains disabled; Phase 3's namespace isolation provides the equivalent guarantee structurally.</p>
<h2>Phase 2 — ProtonVPN: the outer tunnel</h2>
<ol>
<li>Install the <a href="https://protonvpn.com/support/linux-ubuntu-vpn/">Proton VPN Linux app</a> (daemon + GUI).</li>
<li>In settings: protocol <strong>WireGuard</strong>, kill switch <strong>enabled</strong>, auto-connect <strong>enabled</strong>.</li>
<li>Record the tunnel interface name (<code>ip -br link</code>; commonly <code>tun-proton0</code> or similar) and the server IP for Phase 1's rule.</li>
<li>Verify before proceeding:</li>
</ol>
<pre><code class="language-bash">curl -4 https://am.i.mullvad.net/ip     # must show a Proton exit IP
curl -6 https://am.i.mullvad.net/ip     # must NOT show the home IPv6
</code></pre>
<p>(The Mullvad check endpoints are public IP-echo services usable with any VPN.)</p>
<p><strong>Secure Core consideration:</strong> Proton's <a href="https://protonvpn.com/support/secure-core-vpn/">Secure Core</a> routes traffic through a hardened second hop first. Where acceptable, Secure Core plus <a href="https://protonvpn.com/support/tor-over-vpn/">Tor-over-VPN</a> replaces part of this architecture with a supported product; the hand-built chain is preferred where full path ownership and Yggdrasil integration are requirements. The choice should be an explicit design decision.</p>
<h2>Phase 3 — Mullvad: the inner tunnel</h2>
<p><strong>The conflict:</strong> Mullvad's daemon manages routing and firewall state; Proton's daemon already does. Two daemons asserting on one routing table conflict. Two solutions:</p>
<h3>Option A (recommended): network namespace isolation</h3>
<p>Mullvad receives its own private network copy (a netns) whose only exit is the Proton tunnel. Within the namespace, Mullvad exercises full routing authority; structurally, all its traffic must exit through Proton. The daemons coexist because they no longer share a routing table.</p>
<p>Setup, annotated (wrap in a systemd oneshot unit for persistence):</p>
<pre><code class="language-bash"># 1. Create the namespace "mullvadns":
sudo ip netns add mullvadns

# 2. A virtual ethernet pair — one end on the host, one end in the namespace:
sudo ip link add veth-host type veth peer name veth-inner
sudo ip link set veth-inner netns mullvadns

# 3. Addresses on the pair (private range, machine-internal only):
sudo ip addr add 10.200.200.1/30 dev veth-host
sudo ip link set veth-host up
sudo ip netns exec mullvadns ip addr add 10.200.200.2/30 dev veth-inner
sudo ip netns exec mullvadns ip link set veth-inner up
sudo ip netns exec mullvadns ip link set lo up
sudo ip netns exec mullvadns ip route add default via 10.200.200.1   # the namespace's only egress

# 4. Host side: NAT namespace traffic out the Proton tunnel:
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -s 10.200.200.0/30 -o tun-proton0 -j MASQUERADE
</code></pre>
<p>Install Mullvad's app package (supplies daemon and <a href="https://mullvad.net/en/help/mullvad-cli/">CLI</a>), then run the daemon <em>inside</em> the namespace:</p>
<pre><code class="language-bash">sudo mkdir -p /etc/netns/mullvadns
sudo mount --bind /run /etc/netns/mullvadns/run     # exposes the daemon's runtime socket directory
sudo ip netns exec mullvadns mullvad-daemon &amp;
</code></pre>
<p>All Mullvad commands are then issued inside the namespace (per the <a href="https://mullvad.net/en/help/mullvad-cli/">Mullvad CLI guide</a>):</p>
<pre><code class="language-bash">sudo ip netns exec mullvadns mullvad account login &lt;ACCOUNT_NUMBER&gt;
sudo ip netns exec mullvadns mullvad relay set tunnel-protocol wireguard
sudo ip netns exec mullvadns mullvad relay set location se          # country[/city[/host]]
sudo ip netns exec mullvadns mullvad connect
sudo ip netns exec mullvadns mullvad status
</code></pre>
<p>All downstream services (proxy redirector, Yggdrasil, Tor) run inside the same namespace — the mechanism by which their traffic traverses Mullvad. systemd services declare <code>NetworkNamespacePath=/run/netns/mullvadns</code> to join automatically.</p>
<p>Namespaced DNS scaffolding (consumed in Phase 7):</p>
<pre><code class="language-bash">sudo mkdir -p /etc/netns/mullvadns
echo "nameserver 127.0.0.53" | sudo tee /etc/resolv.conf             # host: stub → Cloudflare DoT (tier 1)
echo "nameserver 127.0.0.53" | sudo tee /etc/netns/mullvadns/resolv.conf
# (Phase 7 redirects the namespace's resolver to Quad9 through the chain — tier 2)
</code></pre>
<h3>Option B (simpler): wg-quick through Proton</h3>
<p>Dispense with Mullvad's daemon; apply a generated <a href="https://mullvad.net/en/help/wireguard-on-linux/">Mullvad WireGuard config</a> (<a href="https://mullvad.net/en/account/wireguard-config">generator</a>):</p>
<p><code>/etc/wireguard/mv0.conf</code>:</p>
<pre><code class="language-ini">[Interface]
PrivateKey = &lt;Mullvad WG private key&gt;
Address = 10.xx.xx.xx/32, fc00:bbbb:.../128
DNS = none                       # mandatory: Phase 7 owns DNS; wg-quick must not touch resolv.conf
MTU = 1380                       # 1500 minus WG overhead; rides inside Proton's tunnel

[Peer]
PublicKey = &lt;Mullvad server key&gt;
AllowedIPs = 0.0.0.0/0, ::/0     # route ALL traffic (IPv4 + IPv6) into this tunnel
Endpoint = &lt;mullvad-server-ip&gt;:51820
</code></pre>
<pre><code class="language-bash">sudo wg-quick up mv0
</code></pre>
<p><code>wg-quick</code> auto-installs a host route to the endpoint, preventing the tunnel from routing through itself. Trade-offs: no account rotation, no DAITA, no application kill switch — but far fewer moving parts and no daemon conflict. Option A favors features and composition; Option B favors robustness and simplicity. Both are architecturally sound.</p>
<h3>IPv6 in the namespace (Option A)</h3>
<p>Where the LAN provides IPv6, mirror the namespace setup with IPv6 addresses on the veth pair and <code>ip6tables</code> NAT, or disable IPv6 inside the namespace if unneeded. Part III's verification detects any error — but the design decision belongs in this phase, not the debug log.</p>
<h2>Phase 4 — Proxy layer</h2>
<h3>Proxy selection criteria</h3>
<p>Ranked for this application:</p>
<ol>
<li><strong>Jurisdiction and logging:</strong> operators with no-log policies, ideally outside the operator's own jurisdiction. A self-hosted VPS provides the strongest guarantee — the operator <em>is</em> the operator, and a zero-retention configuration is trivial.</li>
<li><strong>Protocol:</strong> SOCKS5 is the interoperability standard (compatible with Mullvad multihop, proxychains, tun2socks, and Yggdrasil's <code>socks://</code> peering). HTTP CONNECT proxies are weaker and less universally supported.</li>
<li><strong>Payment and attribution:</strong> anonymous payment (cryptocurrency, prepaid instruments) minimizes the operator's ability to attribute the server.</li>
<li><strong>Reputation:</strong> for commercial providers, prefer established firms with transparency reports or warrant canaries. Free proxies are excluded — their business model monetizes the traffic itself (injection, sniffing).</li>
</ol>
<p>Structural options: self-hosted VPS running dante-server or <a href="https://github.com/3proxy/3proxy">3proxy</a> (strongest recommendation); vetted commercial SOCKS5; Mullvad's own <a href="https://mullvad.net/en/support/multihop-with-socks5-proxies/">SOCKS5 multihop partners</a>. Where Tor is present in the chain regardless, Tor may <em>serve as</em> the proxy layer, eliminating this tier as a simplification.</p>
<h3>Integration</h3>
<p><strong>(a) Per-application — proxychains-ng</strong> (wraps individual commands):</p>
<pre><code class="language-bash"># /etc/proxychains.conf
strict_chain
proxy_dns            # DNS traverses the chain, not around it
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks5 127.0.0.1 1080            # tun2socks/redsocks local listener, or direct VPS SOCKS5 address
</code></pre>
<p>Test: <code>proxychains4 curl https://example.org</code>. Explicit and per-process only.</p>
<p><strong>(b) Transparent, whole-namespace — tun2socks or redsocks</strong> inside <code>mullvadns</code>. These create a TUN device; traffic routed into it is pushed to the SOCKS5 upstream:</p>
<pre><code class="language-bash"># tun2socks sketch (executed inside mullvadns):
sudo ip netns exec mullvadns tun2socks --netif-address 10.201.0.1/24 \
    --address 127.0.0.1:1080
sudo ip netns exec mullvadns ip route replace default via 10.201.0.1
# services in the namespace then route via SOCKS5 automatically
</code></pre>
<p>This form is required for daemons (Yggdrasil) that cannot be individually wrapped.</p>
<p><strong>(c) Mullvad multihop-with-SOCKS5</strong> (pairs with Option B): Mullvad natively supports <a href="https://mullvad.net/en/support/multihop-with-socks5-proxies/">entry via a SOCKS5 proxy</a> — proxy first, then Mullvad tunnel. This reorders the chain (the proxy becomes the outermost hop, and thus observes the real IP). The ordering must follow from the threat model, not convenience.</p>
<h2>Phase 5 — Yggdrasil</h2>
<p>Install <code>yggdrasil</code> (<a href="https://yggdrasil-network.github.io/installation.html">installation</a>); generate keys and configuration:</p>
<pre><code class="language-bash">sudo yggdrasil -genconf &gt; /etc/yggdrasil.conf   # keypair generation + commented config
</code></pre>
<p>Principal edits in <code>/etc/yggdrasil.conf</code>:</p>
<pre><code class="language-hjson">Peers: [
  # select 2–3 from https://github.com/yggdrasil-network/public-peers
  # e.g.:  tls://xx.xx.xx.xx:xxxx
  # for Tor peering (Phase 6): socks://127.0.0.1:9050/&lt;peer&gt;.onion:port
]
</code></pre>
<p>Design rules:</p>
<ul>
<li><strong>Peers are selected near the chain's exit, not near the home ISP</strong> — traffic reaches peers from the exit, so geographically coherent peers sit near the Mullvad/proxy egress.</li>
<li><code>IfName: ygg0</code> fixes the TUN interface name.</li>
<li><code>NodeInfoPrivacy: true</code> suppresses host metadata advertisement to mesh members.</li>
<li>Multicast discovery remains disabled unless other Yggdrasil nodes share the local LAN.</li>
</ul>
<p>Execute the daemon inside <code>mullvadns</code> (Option A) or on the host after <code>wg-quick</code> (Option B). Verify:</p>
<pre><code class="language-bash">yggdrasilctl getSelf    # mesh address (02xx:…) and keys
yggdrasilctl getPeers   # active peerings
</code></pre>
<h3>MTU budget</h3>
<p>Each layer consumes header space; interfaces must be sized so the innermost packet fits the outermost link:</p>
<table>
<thead>
<tr>
<th>Layer</th>
<th>Suggested MTU</th>
<th>Rationale</th>
</tr>
</thead>
<tbody><tr>
<td>Physical NIC</td>
<td>1500</td>
<td>Ethernet default</td>
</tr>
<tr>
<td>Proton tunnel (WG)</td>
<td>1420</td>
<td>−80 WireGuard/transport overhead</td>
</tr>
<tr>
<td>Mullvad tunnel (WG)</td>
<td>1380</td>
<td>−40 WG overhead</td>
</tr>
<tr>
<td>SOCKS (userspace)</td>
<td>—</td>
<td>tun2socks handles segmentation</td>
</tr>
<tr>
<td>ygg0</td>
<td>1320</td>
<td>Yggdrasil overhead + safety margin</td>
</tr>
<tr>
<td>Tor (when used)</td>
<td>~1240 effective</td>
<td>Tor cell overhead + reliability headroom</td>
</tr>
</tbody></table>
<p>Symptom of oversizing: connections establish but large transfers stall. Remedy — MSS clamping alongside the Phase 1 rules:</p>
<pre><code class="language-bash">sudo iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
</code></pre>
<h2>Phase 6 — Tor integration (two architectures)</h2>
<h3>Architecture 1 — Yggdrasil <em>over</em> Tor (peering via Tor hidden services)</h3>
<p>A first-class Yggdrasil capability: peer URIs accept <code>socks://</code>/<code>sockstls://</code> prefixes dialing peers through a SOCKS proxy — pointed at Tor:</p>
<pre><code class="language-hjson">Peers: [
  socks://127.0.0.1:9050/&lt;yggdrasil-peer&gt;.onion:port
  sockstls://127.0.0.1:9050/&lt;yggdrasil-peer&gt;.onion:port
]
</code></pre>
<p>Public Tor-hidden Yggdrasil peers are catalogued in the community repository (<a href="https://github.com/yggdrasil-network/public-peers/blob/master/other/tor.md">public-peers → other/tor.md</a>) and at aggregators such as <a href="https://sysop.link">sysop.link</a>. Requirements: <code>tor</code> running with <code>SocksPort 9050</code>; <code>IsolateSOCKSAuth</code> where separate circuits per peer are desired.</p>
<p>Properties: peers observe a Tor exit rather than the Mullvad IP; the chain's exit observes only Tor traffic; Tor bootstraps <em>through the entire chain</em> (slow but fully wrapped). This orientation delivers anonymity for the Yggdrasil layer itself.</p>
<h3>Architecture 2 — Tor <em>over</em> Yggdrasil (chain exit → mesh → Tor guard)</h3>
<p>Tor's client traffic is routed into <code>ygg0</code>, with Yggdrasil carrying it to a Tor-capable node — community documentation covers <a href="https://devzone.org.ua/post/vstanovlennia-onion-routera-arti-z-pidkliuchenniam-do-merezi-tor-cherez-yggdrasil">Arti over Yggdrasil bridges</a> in detail. Properties: Tor guards observe a Yggdrasil address rather than the exit IP; observers at the exit see only mesh traffic. Preferred where concealing Tor usage from the chain's exit is a requirement, at the cost of operational complexity.</p>
<p><strong>Deployment recommendation:</strong> Architecture 1 first — a configuration-file edit plus the <code>tor</code> daemon. Architecture 2 is a refinement adopted when exit-facing concealment of Tor usage is required.</p>
<h3>Tor daemon baseline (either architecture)</h3>
<p><code>/etc/tor/torrc</code> (minimal client):</p>
<pre><code class="language-plaintext">SocksPort 127.0.0.1:9050
SafeLogging 1
# Optional — Architecture 2 / censored networks:
# ClientTransportPlugin obfs4 exec /usr/bin/obfs4proxy
# Bridge obfs4 &lt;ip&gt;:&lt;port&gt; &lt;cert&gt; iat-mode=0
</code></pre>
<h2>Phase 7 — DNS assembly</h2>
<p>Per Part I §3: tier 1 (Cloudflare DoT) on the bare link for bootstrap; tier 2 (Quad9 DoT) inside the chain for all other resolution. Implementation:</p>
<ol>
<li><strong>Host level:</strong> install <a href="https://github.com/DNSCrypt/dnscrypt-proxy">dnscrypt-proxy</a> (instance A) with <code>server_names = ['cloudflare']</code>, DoT enforced, listening on <code>127.0.0.53</code> (or feeding <code>systemd-resolved</code>). This bootstrap resolver must be reachable <em>before</em> any tunnel exists.</li>
<li><strong>Namespace level:</strong> second dnscrypt-proxy instance (instance B) inside <code>mullvadns</code>, <code>server_names</code> selecting Quad9 over DoT, listening on <code>127.0.0.53</code> <em>within the namespace</em>. Instance B's traffic exits via the namespace (→ Mullvad → …), so Quad9 observes the chain's exit IP.</li>
<li><strong>Namespace DNS inheritance:</strong> <code>/etc/netns/mullvadns/resolv.conf</code> points at instance B. Processes started in the namespace resolve via Quad9-through-the-chain automatically; host processes use Cloudflare-on-the-bare-link. The tier assignment is enforced by the kernel, not by per-application configuration.</li>
</ol>
<p>Verification:</p>
<pre><code class="language-bash">sudo ip netns exec mullvadns dig +short txt whoami.ds.akahelp.net   # Quad9 resolver identity
dig +short txt whoami.ds.akahelp.net                                  # host resolver, distinct identity
</code></pre>
<hr />
<h1>Part III — Operations</h1>
<h2>Verification procedure (post-phase, non-negotiable)</h2>
<pre><code class="language-bash"># Identity, IPv4 AND IPv6, per layer:
curl -4 https://am.i.mullvad.net/ip ; curl -6 https://am.i.mullvad.net/ip   # host / outer tunnel
sudo ip netns exec mullvadns curl -4 https://am.i.mullvad.net/ip            # inner tunnel
curl --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/        # Tor functionality

# DNS leak tests:
sudo ip netns exec mullvadns dig +short whoami.ds.akahelp.net txt
dig +short whoami.ds.akahelp.net txt

# Comprehensive leak regression:
sudo ip netns exec mullvadns curl -s https://ipleak.net/json/

# Path-MTU sanity (binary-search the -s value downward on failure):
ping -M do -s 1272 -c3 &lt;outer-host&gt;
</code></pre>
<p><strong>Hard rule:</strong> any IPv6 check returning the home allocation halts the build until remediated — such a leak bypasses every layer simultaneously.</p>
<h2>Boot ordering and failure containment</h2>
<p>Services start in dependency order, and a dead service takes its dependents down with it:</p>
<pre><code class="language-plaintext">ufw/firewalld → dnscrypt(A)+stub → protonvpn → netns-setup → mullvad-daemon → tun2socks → yggdrasil → tor
</code></pre>
<p>Rules: every service <code>Requires=</code> its predecessor; <code>BindsTo=</code>/<code>PartOf=</code> propagate failure — Proton down ⇒ Mullvad down; Mullvad down ⇒ Yggdrasil/Tor down. An inner layer must never survive an outer failure and quietly continue over a shallower chain. A failed outer tunnel produces <em>no traffic</em>, not <em>fallback traffic</em>. The Phase 1 firewall enforces this even where service ordering fails — belt and suspenders.</p>
<p>Post-boot hygiene: <code>journalctl -u yggdrasil</code>, <code>journalctl -u tor</code>, <code>mullvad status</code>; <code>After=</code>-ordering defects manifest as boot-time race failures.</p>
<h2>OpenWRT migration (target state)</h2>
<ul>
<li><strong>Hardware governs feasibility.</strong> Nested WireGuard + Yggdrasil + Tor performs real cryptography per packet; consumer MIPS/ARMv7 routers will bottleneck. Specification: x86_64 or strong ARMv8 (Raspberry Pi 5 class, MT7986 class).</li>
<li><strong>Package landscape:</strong> <code>wireguard-tools</code> and <code>tor</code> are standard; Yggdrasil via community feeds or self-built; no ProtonVPN daemon — WireGuard configs directly (Proton supports <a href="https://protonvpn.com/support/wireguard-configurations/">config export</a>; Mullvad maintains <a href="https://mullvad.net/en/help/router/">router support</a>).</li>
<li><strong>DNS tiers relocate naturally:</strong> the router's dnsmasq/Unbound forwarders replace the two dnscrypt instances — one resolver (Cloudflare) reachable from the WAN side for bootstrap, another (Quad9) bound to the tunnel side and distributed to LAN clients via DHCP. The tier logic survives intact; the plumbing moves.</li>
<li><strong>Firewall:</strong> OpenWRT's <code>fw4</code> (nftables) ports the Phase 1 logic — default-deny, tunnel-interface allowances, kill-switch exception — same concepts, new grammar.</li>
</ul>
<p>Migration order: stabilize the full chain on the workstation, snapshot all configuration, translate to OpenWRT, retain the workstation as fallback and debug environment.</p>
<h2>Concluding assessment</h2>
<p>This is a research-grade topology, not a consumer product: debugging is expected, and phase verification is non-negotiable. Two productized alternatives warrant periodic re-evaluation as vendors evolve: Proton's <a href="https://protonvpn.com/support/secure-core-vpn/">Secure Core</a> plus <a href="https://protonvpn.com/support/tor-over-vpn/">Tor-over-VPN</a> covers the outer chain with vendor support, and Mullvad's <a href="https://mullvad.net/en/support/multihop-with-socks5-proxies/">SOCKS5 multihop</a> formalizes the proxy tier. The hand-built stack prevails where path ownership and Yggdrasil composability are requirements — a conclusion that should rest on evidence, reviewed annually.</p>
<h2>Sources &amp; further reading</h2>
<ul>
<li>Mullvad CLI guide: <a href="https://mullvad.net/en/help/mullvad-cli">mullvad.net/en/help/mullvad-cli</a> · WireGuard configs: <a href="https://mullvad.net/en/help/wireguard-on-linux/">mullvad.net/en/help/wireguard-on-linux</a> · Multihop via SOCKS5: <a href="https://mullvad.net/en/support/multihop-with-socks5-proxies/">mullvad.net/en/support/multihop-with-socks5-proxies</a> · Router support: <a href="https://mullvad.net/en/help/router/">mullvad.net/en/help/router</a></li>
<li>Proton VPN Linux app: <a href="https://protonvpn.com/support/linux-ubuntu-vpn/">protonvpn.com/support/linux-ubuntu-vpn</a> · Secure Core: <a href="https://protonvpn.com/support/secure-core-vpn/">protonvpn.com/support/secure-core-vpn</a> · Tor over VPN: <a href="https://protonvpn.com/support/tor-over-vpn/">protonvpn.com/support/tor-over-vpn</a> · WireGuard config export: <a href="https://protonvpn.com/support/wireguard-configurations/">protonvpn.com/support/wireguard-configurations</a></li>
<li>Yggdrasil: <a href="https://yggdrasil-network.github.io/">yggdrasil-network.github.io</a> · Public peers incl. Tor catalogue: <a href="https://github.com/yggdrasil-network/public-peers/blob/master/other/tor.md">github.com/yggdrasil-network/public-peers → other/tor.md</a> · Peer index: <a href="https://sysop.link">sysop.link</a> · Arti-over-Yggdrasil guide: <a href="https://devzone.org.ua/post/vstanovlennia-onion-routera-arti-z-pidkliuchenniam-do-merezi-tor-cherez-yggdrasil">devzone.org.ua</a></li>
<li>Tooling: <a href="https://github.com/rofl0r/proxychains-ng">proxychains-ng</a> · <a href="https://github.com/DNSCrypt/dnscrypt-proxy">dnscrypt-proxy</a> · <a href="https://github.com/xjasonlyu/tun2socks">tun2socks</a> · <a href="https://openwrt.org/">OpenWRT</a></li>
<li>Resolvers: <a href="https://quad9.net/">quad9.net</a> (DoT/DoH endpoints) · <a href="https://one.one.one.one/">one.one.one.one</a> (Cloudflare)</li>
</ul>
]]></content:encoded></item></channel></rss>