![]() |
INCOMPLETE: How to create your own Local WiiLink Server (Debian Linux) - Printable Version +- Mario Kart Wii Gecko Codes, Cheats, & Hacks (https://mariokartwii.com) +-- Forum: Guides/Tutorials/How-To's (https://mariokartwii.com/forumdisplay.php?fid=45) +--- Forum: Other (https://mariokartwii.com/forumdisplay.php?fid=49) +--- Thread: INCOMPLETE: How to create your own Local WiiLink Server (Debian Linux) (/showthread.php?tid=2419) |
INCOMPLETE: How to create your own Local WiiLink Server (Debian Linux) - Vega - 03-14-2025 How to create your own Local WiiLink Server (Debian Linux) IMPORTANT: At the moment, I'm having trouble getting the Server to work beyond the localhost machine (whether its LAN or Global). Therefore this tutorial is kind of useless. If someone can chime in, that would be great. No matter how I generate the Gecko Codes, I keep getting 20912/20913 when trying to connect. Therefore this tutorial will only work for connecting to the Wii Link server using Dolphin on the localhost machine. Chapters 13+ are for LAN and Global Access which I couldn't get to work. If you know how to fix this, please let me know! Chapter 1: Intro This tutorial will only teach you how to get your own WiiLink server up and running for localhost ONLY. Requirements:
There are two agents to the WiiLink Server (as a whole)
We will get the wfc-server running first, then worry about the wfc-patcher afterwards. Chapter 2: Update and Install Necessary Repo Packages Let's update your system and install some software. Code: sudo apt update We will install devkitpro. If you have devkitpro already installed, make sure it's fully updated. Code: wget https://apt.devkitpro.org/install-devkitpro-pacman Now that devkitpro is installed, we need to add the following lines... Code: export DEVKITPRO=/opt/devkitpro ...at the end of your /home/username/.bashrc file Save changes and exit. Chapter 3: Install & Configure Golang Debian 12's standard repo version of Golang won't work for compiling the wfc-server. Therefore, we need to install golang by downloading it from go.dev. Afaik, Go version 1.23.2 works fine for building the wfc-server. If you've installed golang in the past via standard Debian repos, we need to completely remove it. Code: sudo apt --purge autoremove golang Download GoLang 1.23.2 from this link: https://go.dev/dl/go1.23.2.linux-amd64.tar.gz Navigate to where the tar file downloaded on your computer, and run the following command Code: cd /where/you/saved/the/go/tar/file Golang has been installed, but we need to export its path. Add the following line.... export PATH=$PATH:/usr/local/go/bin ...at the very end for each of the following files...
Save changes and exit. Also, exit the current terminal you were using and open a new one. Run this command... Code: go version You should see you have version 1.23.2 of Go installed. Chapter 4: Compiling the WFC-Server Run the following commands~ Code: cd $HOME The executable will be built with the name "wwfc". This may take a few minutes to compile. Now we need to edit the permissions of the executable. Code: chmod +x ./wwfc Chapter 5: Postgresql We got the wfc-server compiled, but it needs a database to connect to in order to keep all the online profiles stored. Run the following commands~ Code: cd $HOME You are now in the postgresql application logged in with the user postgres. However, the user postgres has no password set. We need to set one. Type in the following command.. Code: \password Enter your desired password and note it down somewhere. Now we need to create a database. For this tutorial, we'll call it "mkdata" Code: CREATE DATABASE mkdata; At this point run the following command, you should see the mkdata database listed Code: \l Now we need to create a new role/user called wiilink Code: CREATE USER wiilink; To make sure the role was created, run this command Code: \du You should see two roles: postgres and wiilink And now we can quit psql Code: \q We need to import the schema.sql file located from the wfc-server repo into the mkdata database. Close terminal and open a new one. Code: sudo -u postgres psql -d mkdata < "/home/yourusername/wfc-server/schema.sql" There should be no error messages. Restart postgresql... Code: sudo service postgresql restart Chapter 6: Config.xml and test launch Make a copy of the config_example_.xml file and name it config.xml. Keep the original, don't delete it just in case you goof something up. Open the config.xml with any text editor. Underneath Database credentials, change the username to postgres, and change the password to what you've noted down from earlier Underneath Database information, change the database name to mkdata Save changes and exit. At this point we can test launch the server really quick. It must be launched with sudo. Code: cd $HOME/wfc-server There should be no errors. There should be all green status's except for 2 (front end & nas). The final message should be.. "FRONT END": connected to backend. To stop the server at any time, press CTRL+C. Go ahead and shut down the server. Chapter 7: Patcher Okay we got the server side of things completed, now we need to focus on the patcher. We need to create the unique gecko code that will allow you to connect to your server Code: cd $HOME In the wfc-patcher-wii directory, there is a make.sh file. Open the make.sh file with any text editor, and change every instance of "python" to "python3". Should be 5 total changes. Save changes and exit. Run the following terminal commands Code: cd $HOME/wfc-patcher-wii This can take a bit to complete. Slow computers expect 10+ minutes, fast computers expect 60 seconds if that. This will create the payload and gecko codes for all the compatible games, not just MKWii. Chapter 8: Move Payload and other new Items into the Server Run the following commands... Code: cd $HOME/wfc-server This will supply the newly created patcher-side files that the server needs. Chapter 9: Apply Cheat Code All cheat codes are located in $HOME/wfc-patcher-wii/patch/build So let's say you wanna use the NTSC-U MKWii game (RMCE01), you will need to find the RMCED00.txt file.
Open the txt file and copy the contents as a cheat code into your Dolphin Emulator for your game. Apply and save changes. Chapter 10: Full Test Alright time for a real test, first be sure postgresql is running... Code: sudo service postgresql status You should see a green dot along with other indicating info such as "ONLINE". Press q to exit the status message. If postgresql isn't running, turn it on.. Code: sudo service postgresql start If something is wrong, try rebooting it... Code: sudo service postgresql restart Okay now boot the server!! Code: cd $HOME/wfc-server Alright, now launch Dolphin (or a real Wii), be sure Cheat Code is applied. Obviously, use a license that does NOT have a FC attached to it. Go connect to Nintendo WFC. As you do that, watch the wwfc terminal. After some seconds, you should successfully connect and be greeted by the wiilink welcome message. If not, view the wwfc terminal. It will contain info/reasons as to why the connection failed. If you didn't connect at all (nothing happended on wwfc terminal), then something got screwed up in Chapter 6 and/or Chapter 8. Be sure you completed those chapters correctly. Chapter 11: Common Errors Servide (computer) side: If you see the message "E[BACKEND]:" in red font, that means you tried to launch the server without sudo. Launch it with sudo. If you see the message "panic: listen tcp 127.0.0.1:80: bind: address already in use", then stop the server and run this terminal command... sudo lsof -t -i tcp:80 -s tcp:listen | sudo xargs kill Relaunch server, should now work. Client (wii/dolphin) side: EC 20100: Cannot connect to server (incorrect domain patch or no patch was done). EC 20113: You didn't copy the files from wfc-patcher/dist into wfc-server/payload or the wrong files were placed in EC 20400: A payload stage1.bin file was found in wfc-server/payload but other files are missing EC 20912: Hash mismatch (do NOT use some other server's Gecko Code) EC 20913: Hash mismatch (do NOT use some other server's Gecko Code) EC 60000: You're using an FC that wasn't made on your server, use an approriate license Chapter 12: GUI Assitance for Database We're going to install some software so you can "see" your database content easier than using standard postgres terminal commands Open the following file with root or sudo: /etc/apt/sources.list And add this line at the end... deb http://deb.debian.org/debian bookworm-backports main Save changes and exit. Now let's update your repos. Code: sudo apt update Now we are going to install phppgadmin Code: sudo apt install -t bookworm-backports phppgadmin Once installed we need to edit its config file Using root or sudo, open this file.. /etc/phppgadmin/config.inc.php Scroll down to this line... $conf['extra_login_security'] = false; and change the "false" to "true" Save changes and restart postgressql Code: sudo service postgresql restart Now we can "see" our databases. Open any web browser and go to this address localhost/phppgadmin On the left toolbar, click on PostgreSQL Enter postgres as username and enter its password that you've noted down from earlier. Login You should see two databases: mkdata and posgres Click on mkdata and now you are in your mkwii database. Click public. You will see...
the sake table is for your Top 10 Leaderboards. The users table is all the FC's registered. This is also the table you can edit to place in bans and what not. Example: Click on users. Then at the top, click Browse. You will see all the profiles. You can then click Edit on one of them and edit what you need for whatever reason. NOTE: All chapters past this point should work in theory, but for the life of me, I can't get it to work. I keep getting EC 20912/20913 (wii side). Yes I made sure the domains I was using was edited in wwfcLoaderTool.s & patch/wwfcPatch.s when generating new Gecko Codes. Yes I made sure to update the server files. I even blasted open all ports and wildcarded all domains for DNS. Still didn't work. Chapter 13: LAN Expansion At the moment, only you (the localhost) can use the server. To expand it to other devices in your LAN, you will need to first punch open some ports on your ISP-Provided network-box/router. You will also need to know your machine's assigned LAN IP. Run this command Code: hostname -I The IPv4 address is what you need. In your ISP network-box/router open up the following ports for your machine. Use the IPv4 that you've just received to help find your machine on your network-box/router settings.
After that has been done, you need to open up those same ports on the Linux machine itself. We will use ufw as our firewall Code: sudo apt update Restart the firewall.. Code: sudo ufw enable We will need the dnsmasq package Code: sudo apt update Once installed, open up the /etc/dnsmasq.conf file with your preferred text editor Find the following line.. #address=/double-click.net/127.0.0.1 Do these 3 edits..
Save changes and exit. Restart dnsmasq. Code: sudo service dnsmasq restart Okay now lets reboot your networking and postgresql before launching the server... Code: sudo service networking restart Launch server! Code: cd $HOME/wfc-server If testing on real Wii: Boot up the Wii Console and go to your Connect Settings under Internet. Change Auto-Obtain DNS from No to Yes. Edit in your Machine's local IP for both DNS fields. Save connecting settings. If testing on Dolphin: Use a computer that is NOT running the server. Follow these steps at this tutorial - https://mariokartwii.com/showthread.php?tid=1184 However on step 4, enter in the IP of the Local Machine's IP (the one hosting the Server!) Also, omit doing step 7. And on step 8, use the cheat code that was generated in Chapter 8. When I've personally tried this, I was granted with 20912/20913 error codes. Maybe it will work for you. If you longer want the server on your Machine, remove dnsmasq from the Server Machine Code: sudo apt --purge autoremove dnsmasq Then, if you did testing on Dolphin via a different Compter and you no longer want the custom DHCP edits, remove the steps you did on the linked tutorial. Remove the created file and remove the two lines you appended on step 4 of the linked tutorial. Chapter 14: Global Access; Firewalls You will need a VPS and already know how to use it (connect to it via ssh and control it). It's best to start with a fresh VPS. Launch a new VPS, get Debian 12 installed on it. And do all the steps from Chapter 1 thru 6. Once you've completed just those chapters, let's continue... We need to allow incoming connections into your VPS. Run these terminal commands... Code: sudo apt update At this point we have a firewall within Debian OS that is allowing ALL connections thru. Now we need to edit the VPS firewall itself. Most VPS providers have their own propretiy firewall which supersedes the OS firewall. Most VPS providers will block all connections by default. Make a firewall for your VPS, and open/allow for ALL TCP & UDP connections for ALL ports. This is dangerous, but this is purely for testing. Once we've tested everything works, we will tighten up the firewall. Chapter 15: Global Access; Domain Name and DNS You will need a domain name that you have full access/control to. For this tutorial our example domain will be mkserver.com. Your Domain provider will allow you to configure the name servers of your Domain. These name servers are provided by your VPS provider. For example linode uses 5 name servers that use the template: nsX.linode.com. WIth X being 1 thru 5. Find out what your VPS name servers our and on your Domain Name providers website (under your account) apply those name servers. This can make 15 minutes to an hour to update throught the Internet. So take a lunch and/or showever etc to kill some time. Once time has passed by, log into your VPS Provider account. For your VPS there should be a seciton to edit Domains/DNS. Using our example domain you need to add the following domains/records
For the IPv4 AND IPv6 address of your VPS. And, yes the bottom one is JUST an asterisk. This will use a wildcard to allow ALL subdomains of any combination to work. This is dangerous, but this is for testing. THis will be updated to something safer afterwards. Save your changes and wait around 5 minutes. Afterwards do a hard reboot of your VPS. Chapter 16: Global Access; Extra Configuration Okay ssh into your VPS. Open up the config.xml file. The lines that say.. <gsAddress>127.0.0.1</gsAddress> <nasAddress>127.0.0.1</nasAddress> <nasAddressHttps>127.0.0.1</nasAddressHttps> Change their IP Addresses (127.0.0.1) changed to 0.0.0.0 Save changes and exit. This will allow incomings connections for the wiilink server (once they get thru the two firewalls). Now you will need to do Chapter 7 (The patcher). Once you do the python to phython3 edits, do NOT run the make.sh just yet! We need a few more edits. Open up the following two files in your wfc-patcher-wii repo
...and change every isntance of "wiilink24.com" & "nwfc.wiinoma.com", to "mkserver.com". Save changes, exit. Now we can finally run the patcher... Code: cd $HOME/wfc-patcher-wii Chapter 17: Global Access; re-doing other previous Chapters Now re-do Chapters 7 and 8. Once you have created your unique gecko codes, transfer the 4 cheat code txt files from your VPS to your local machine. This varies per VPS provider btw. You are expected to know already how to do this. I use sftp with my linode VPS's. Once the 4 txt files are on your local machine, grab the one for the region of MKWii you wanna use and apply that specific code to your Dolphin emulator (or real Wii if you prefer). Do NOT use the older gecko codes you've created before. Use the codes that you grabbed from your VPS!!!! IMPORTANT. Okay now go back into your VPS and boot up the wfc-server. Be sure postgresql is running beforehand. Once the wfc-server has booted and there are no errors, use Dolphin (on your local machine) or real Wii to test connecting to the VPS Server. Using a fresh (no-FC) license, connect to WFC. At this point in my personal journey I was welcomed with EC 20912 or EC 20913. If this works for you, LET ME KNOW!!! If you've connected congratz, you did it. Chapter 18: Global Access; refinements for safety Okay lets redo some quick steps in regards to security. On your VPS firewall, update it to ONLY allow the following ports TCP:
The UDP ports are already good to go (all opened) Save changes. We DON'T need to update UFW within the VPS. The VPS Provider's firewall supersedes it. Now go back and edit the VPS Domain/DNS settings to ONLY allow the following domains/records
Make sure this is for BOTH IPv4 and IPv6 Addresses. Save changes, take a 5 minute break to let time go by. Chapter 19: Global Access; FINAL TEST Now do a hard reboot on your VPS. Launch the wfc-server. Make sure there's no errors. Launch game (Wii or Dolphin), connect to WFC. If no EC's, congratz youre 100% complete! Enjoy your server! Chapter 20: Help If you were able to get this to work or know how to fix the 20912/20913 issues please let me know! Thank you. |