Routing UDP traffic with udp2raw to play Minetest
October 19, 2024 | View Comments
This article is about using a new tool I found called udp2raw, that allows me to work around firewalls that don't like high port numbers (ports above 1024, or unregistered port numbers), and/or that don't allow you to use UDP.
If you're only interested in the specifics of udp2raw, you can jump right ahead to the section called Using udp2raw to bypass firewalls.
I love Minetest; it's better than Minecraft, and free!
I've recently come to enjoy playing Minetest, which is a Minecraft-inspired open source voxel game engine, available for Linux, Windows, and macOS.
My interest in Minetest came about when I had to discover the horrible world that is Minecraft these days. Imagine that Minecraft on the Nintendo Switch, for instance, requires you to have two accounts, one with Nintendo, one with Microsoft, and to log in frequently using two-factor authentication via the same horrible authentication mask that you have to use for Azure.
Also, Minecraft costs a ton of money, which you have to multiply for each one of your family members wanting to play.
Enter the world of Minetest. Easy to install, it gives you a list of public servers to choose from. Register one time with a password, then log in with your username and password forever after, without hassle. This is why we love open source software!
Also, Minetest gives users and creators much more freedom to explore. Having had the luxury to start from a clean slate, Minetest seems much more structured with regard to how to build mods. I have only dabbled with mods in Minecraft, and I can tell you, it is one confusing exercise, let alone that there's two entirely separate versions of Minecraft in use, Bedrock and Java edition. Compare this mess with the beauty of Minetest modding docs and an extension mechanism that uses a real programming language, and you'll be easily convinced that Minetest is more fun in the long run for the hacker. 👾
Using udp2raw to bypass firewalls
Now when I tried playing Minetest the other day from a public network that only allowed TCP traffic on some common ports like 80 and 443, I was out of luck connecting to my own Minetest server that I run on a server. Here's a little recipe that describes how to run a fine tool called udp2raw to bypass said firewall. I'm collecting these instructions in the hope that they're useful for someone else, and for my future self as well, and because it took me long enough to figure this out!
The instructions below are for Linux, but there's also macOS and Windows releases of udp2raw.
First, let's grab a release of udp2raw from Github, on both your local machine and on the server that's running your game server, e.g. minetestserver.
mkdir -p ~/lib/udp2raw
cd ~/lib/udp2raw
wget https://github.com/wangyu-/udp2raw/releases/download/20230206.0/udp2raw_binaries.tar.gz
tar xzfv udp2raw_binaries.tar.gz
Once you have udp2raw binaries downloaded on both, run this on your local machine:
sudo ./udp2raw_x86 -c -l0.0.0.0:30001-r <your-server's-ip-here>:8080 -k "your_password_here" --raw-mode faketcp
And on the game server, run the counterpart:
sudo ./udp2raw_x86 -s -l0.0.0.0:8080 -r 127.0.0.1:30001 -k "your_password_here" --raw-mode faketcp
You should now be able to connect to localhost on port 30001 to successfully connect to the server! Have fun.