logo

Keith Irwin


Wireguard and the Tildeverse

tldr: Configuring a massive wireguard VPN for both intratilde and intertilde communications is relatively easy and provides massive improvements in security and usability.

Background

One day in 2019, I parked my big rig at my favorite Ohio truck stop and took my dogs for a walk. I was putting a bag of their poop in a dumpster like a good citizen when I peeked into the bin and saw a black desktop computer. It was a gaming PC in near-working order. When I got a load to Texas, I brought it to my friends house and we fixed it up and connected it.

Photo of my friend doing some hardware work on the dumpster server

Thus, our shared server was born. We upgraded the hardware and started running services like gameservers and groupware on it. I thought about extending its services to family and friends and friends of friends, maybe even recruiting some fellow nerds to help with administration. Then I discovered tildes in the end of 2020. I'm either going to extend our server into a full tilde or wiggle my way into an admin role on an existing tilde.

The first thing I noticed is a lack of VPN on most tildes. We used wireguard heavily on our server and this kind of network overlay provided numerous advantages. In this article, I will "sell" wireguard as a useful tech for use in tildes. Then I will discuss potential network topologies and use cases for both intra-tilde and inter-tilde communications. This is the vast bulk of this article: describing the massive benefit. Finally, I will provide some unanswered questions and a launchpoint for future discussions.

Why wireguard is the bee's knees

If you haven't used wireguard before, your opinion of it may be that, "it's like OpenVPN, but faster, I guess." You're right, but it's a big deal. Have you ever gotten lag on your game and said "Oh wait, let me disconnect from my VPN," to get a speed boost? Pre-wireguard VPNs had too much overhead to provide a proper drop-in replacement for a clearnet connection.

I've run netcat speedtests to compare UDP transmission speeds over the same network path using wireguard and a straight IP connection. The VPN connection was able to transmit something like 93% of the data in the same amount of time. (The percentage will differ wildly depending on how many clearnet hops apart the two hosts are. I got these numbers using a connection from my laptop in Colorado to our server in Texas).

This means that there's no longer any reason to even provide public connections to internal services: you can completely close ports to the internet, which vastly reduces the attack vector on a server. Imagine, lots of tildes are currently running services (like nextcloud) that are protected by nothing more than a user's potentially awful password. On our dumpster-dived server, we only opened ports 80, 443, and 25 (70, 1965 coming soon). IMAP, SSH, nextcloud, gameservers, etc were all closed to the public internet. Since wireguard clients are available for mac, linux, android, windows, and iphone, we didn't have any problem checking or sending emails from our phones or whatever.

Wireguard runs at the kernel level and is managed, mostly, by standard unix tools (ip link, ip addr, ip route, iptables). This makes it easy to apply different rules to different zones, like how you would manage WAN and LAN on your home router. With wireguard, we can create an arbitrary network topology with different rules for intra- and inter-tilde IP traffic, regardless of the underlying link layers. Using your OS's built-in firewall. Opps, I'm drooling.

Intratilde topology

Now let's do some use cases. Assume a standard client-server model, with a wireguard overlay network on the 10.0.77.0/24 IPv4 space.

Diagram of a network map showing a central server '~' and connected clients 'A-B'

Each of the clients A-E, drawn with circles, are laptops and phones of users. They may be behind firewalls. Their NAT router might not let them open ports. It might be a cell phone with wildly varying IP addresses and no port forwarding whatsoever.

The square in the center is our tilde server. It has a static IP and can open ports freely.

So what can we do using the wireguard network that wasn't possible with the clearnet? Let's say I'm user A and an admin of the tilde.

The Intertilde

Let's look at what's possible with an intertilde topology.

Network diagram showing a network of networks

Using the same conventions as above, we can see three interconnected tildes on a wireguard network of wireguard networks. The "clearnet" cloud represents open ports to the clearnet; it is assumed that all hosts have an upstream connection to the clearnet.

Note that some users are in multiple tildes. For example, user C might have IPs 10.0.77.4 AND 10.0.42.8 and can connect to their different tilde servers using 10.0.77.1 and 10.0.42.1. On unix, this kind of routing is easy. And this user can theoretically connect to any service on any tilde server or client, if all the nodes on a route there will allow it.

The three tildes' admins in this diagram have been assigned the 10.0.X.0/24 namespace, where X is 42, 69, and 77. I will refer to them as ~42, ~69 and ~77, respectively.

Since there is no central tilde, tildes can manage and block connections between themselves (again, using their built-in firewalls). Tilde admins can report nefarious tildes and connect or disconnect between each other freely. In this way, bad tildes can be completely removed from the network through unanimous exclusion.

A final advantage to having an intertilde network is that global tildeverse services can be hosted across multiple tildes using redundancy technologies like round-robining.

Things to discuss

Domain names

I've had great success using domains names with custom TLDs on my own wireguard network with both self-hosted nameservers and modification of /etc/hosts. Since I use the ki9.us domain, I use .ki9 as my wireguard TLD. That way I can host my website publicly at www.ki9.us and my development server privately at www.ki9.

What I'm trying to say is, with custom DNS servers (only available on the network), we can have arbitrary sub-domaining in addition to arbitrary subnet addressing. Since the tildeverse already lives at tildeverse.org, why not use .tildeverse? This would allow for

For the tildiverse:

For tildes:

For users:

For example:

We could also use the .tilde domain for this, since it's not available on the clearnet anyway.

Address convention

We basically have three options for internal IP addressing, ranging from easiest to most future-proof: IPv4, both, or IPv6. We can provide IPv6 internally even if the underlying network (our ISP) does not provide IPv6 because the wireguard connection just tunnels through the external IPv4.

If we provide IPv4, let's use the entire 10.X.X.X space and split the subnet mask at CIDR /20. This would allow for 4,094 tildes with 4,094 clients each. That would let a tilde with ~1000 users allocate 4 addresses to each user device.

First steps

Since wireguard's only been around for a few years, and I've been using it for a few years, I guess I'm an expert! I am ready to help build this thing, if folks are interested. The game plan, I imagine, would be:

  1. Establish tildeverse RFCs for the network's address and domain conventions.

  2. Reassign the current tildeverse ~Net IP addresses to use the full 10.X.X.X space (there seems to only be four tildes in the net right now so we can nip this in the bud)

  3. Provide resources (a wiki?) to teach tilde admins how to set up wireguard on their tilde, including articles for various intratilde and intertilde topologies.

Discussion

I'm sure other people have input. I'm just getting into IRC, so feel free to hit me up on tilde.chat IRC at #tildenet.


^ 2021/02

< 01/28 02/11 02/13 >