Coen Stange

Software Engineer @ Tesla

I'm a software engineer with a strong passion for functional programming and a solid background in continuous integration, continuous delivery, and Kubernetes. Outside of work, I'm a proud father of two beautiful daughters.

Socials
Wii Server

🐱 View on Github

🎮 View server statusNetBSD Wii bsdfetch

This server runs on the Nintendo Wii. I was inspired by this blogpost that I found on Hackernews from Alex Haydock about hosting his blog on a Wii. It's a great read, similar to the author I got excited that the Wii got offical NetBSD images shared from their homepage.

To start off on this server adventure, I retrieved the Wii from a family member. In case that anyone feels nostalgic for some Wii games then we luckily also have a Wii U that has backwards compatibility for Wii games. Talking about nostalgia, hearing the Wii channel music took me back. I quickly found my own Mii on the old family Wii.

Mii

Time to get NetBSD on it! I can thank my teenager self of adding the Homebrew channel on the Wii. I downloaded the Wii image from the NetBSD website and flashed the image to the SD card. I put the SD card in the Wii and started NetBSD from the Homebrew channel. Getting into a NetBSD shell from a Wii with Homebrew already on it is childsplay. In Alex's post he mentions he keeps a sensor bar and Wii mote around in case the server restarts and manually have to start NetBSD from the homebrew channel. I have read in the Hackernews comments that it is possible to directly load into NetBSD with BootMii/Priiloader. I tried both, and in the end what ended up working for me was Priiloader, in Priiloader I could configure the Wii to always boot into NetBSD directly. It is possible to get back into the normal Wii menu's while holding the Reset button on the start of the Wii. After playing around with BootMii and Priiloader the SD card likely got corrupted, but the SD card was quickly flashed to a fresh image again. Great, I do not need the Wii sensor bar and a Wii mote anymore, just an USB keyboard and a TV.

I bought a cheap USB-Ethernet dongle from Amazon, and while searching I scrolled over some products because they are USB 3.0. The first result I found with USB 2.0 worked like a charm, ironically the Amazon listing explicitly said the dongle would not work with Nintendo Wii or PS5.

USB ethernet

To get the Server working I looked into using Go and Rust becausy they have great toolchains to cross-compile to other platforms and are lightweight. Understandably the Nintendo Wii is not a priority for these languages. I gave a shot building gcc crosscompiler on the desktop, when I looked the NetBSD package manager also did not have the crosscompiler for PowerPC I was looking for. From the Wii I could see with what flags the compiler was build using "gcc -v", looking at all the dependencies required to compile gcc I went looking for simpler options.

Simple applications I could compile from the Wii itself, I ended up using darkhttpd. It edited it a little bit so I could serve Next.JS static website because the urls for pages do not have the HTML file extension. I also added a server status page that gives details about the Wii and its resource usage. I quickly noticed that that the statuspage is quite slow, so I added a simple caching mechanism to save the response for a short time. The server is single threaded, but I utilized the Node/Go trick of just running more instances of it.

The Wii is running from my personal home, I do not really want that IP broadcast to the rest of the world. For that reason I still got a Virtual Private Server and have a reverse proxy towards my home. I chose Hetzner for their growing reputation and I quite like that they offer ARM servers. I port forwarded multiple ports for multiple instances only to the IP address of the Hetzner VPS. So even if someone scans all IPv4 of the world in 6 minutes the website would not be found without the VPS first. I think setting an IP address whitelist for portforwading is available in routers available by most ISP's, luckily in the Netherlands there is "vrije modemkeuze" allowing consumers to pick their own router. It should make switching internet providers more easily, but at the moment there is no way to deny or to return the ISP box without ending the contract.

For buying the domainname I went with Cloudflare because their prices are competitive. I set the DNS records to the Hetzner VPS IP address. After some waiting and DNS cache flushes the VPS was found. On the Hetzner VPS I set up a Caddy instance, I configured it to reverse proxy to all the IP addresses and ports used by the Wii. The Caddy instance load balances between the multiple instances running on the Wii. I expected that I needed to perform more configuration for SSL, but even without any configuration Caddy automatically generated the valid SSL certificates.