Setup Your Own Local MKW Server
#1
Tutorial to Setup Your Own Local MKW Server


In this guide, I will teach you how to setup and run a mkw server for private network use. Anyone on your LAN network can access the server. There may be other added guides in the future to teach you how to make your server reachable to anyone from the outside world. But for now, this will be for local setup.

Requirements:
Experience with Wii Hacking and ISO Usage (have HBC installed, know how to run codes, etc)
Computer with Linux***
Experience with Linux in general (this isn't for Linux first-timers)
Working Local LAN Network

***This guide is specifically for Debian 9! I will include a small modification which should allow this to work on Ubuntu 14.04 LTS & 16.04 LTS, but I cannot guarantee that it will work. Once again, this has only been tested and verified on Debian 9. Any other Linux OS based on Debian 9 (that uses the same repositories) SHOULD also work for this guide.

It is best to start with a fresh installation of Debian 9. I have no idea what packages you already have installed on your Linux computer. They could conflict with the packages being installed on this guide.

Chapter  1. Update, Upgrade, Get Packages

Open a terminal. We need to get Debian fully updated and upgraded before we do anything.


sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get clean


If upgrades were done, reboot your computer.

Now run the following command to install the necessary pacakges.


sudo apt-get update && sudo apt-get install ufw apache2 python python-twisted dnsmasq zip unzip


Small modification for Ubuntu: replace 'python' with 'python-2.7'

Chapter 2. Configuring Firewall, Port Forwarding

The package ufw that was downloaded is a simplified front-end for manipulating Linux's IP-Tables. If you have any current IP-Table firewall settings, clear/flush them now. Be sure to back them up if desired. Run the following commands to get ufw setup with the proper port forwarding


sudo ufw default deny incoming
sudo ufw default allow outgoing


At this point we setup the basic default policies. Do this command now...


sudo ufw allow 80/tcp


There are more ports to open, but we need to test apache first. To make firewall changes take effect, run the following commands....


sudo ufw enable
sudo ufw status verbose


Your terminal should show on output that the TCP port 80 for both IPv4 and Ipv6 is enabled. Let's boot apache now.


sudo service apache2 start


Open up a web browser. Type in localhost for the web address. You should be greeted by the default Apache Welcome Index Page.

Ok so Apache works, and our firewall is working too. Now we need to punch open more ports. Just use the command that you did earlier for port 80/tcp, and do it for the following ports.

53
443
8000
9000
9001
9002
9003
9009
9998
27500
27900
27901
28910
29900
29901
29920

Alrighty, we're done with TCP ports. But most online gaming servers require the opening of UDP ports. We need all UDP ports opened. So run this command...


sudo ufw allow 2:65535/udp


All UDP ports are now opened. Let's reload the firewall for changes to take effect.


sudo ufw reload


Chapter 3: MKW Server package Download and configuring Apache

Go to this link - https://github.com/polaris-/dwc_network_server_emulator

Click on the green button that says 'Clone or download'. Click on Download Zip. The MKW server package is now downloaded.

Assuming your downloads go to the folder "/home/yourusername/Downloads", run the following command...


cd /home/yourusername/downloads
unzip dwc_network_server_emulator-master.zip


Or just use any GUI extractor/file-archiver to unzip it.

A folder with the same name as the .zip package will appear. Move that folder to a desired place. I personally move it to my main user directory (/home/yourusername). For demo purposes let's assume you move it to that directory.

Run this terminal command....


sudo cp /home/yourusername/dwc_network_server_emulator-master/tools/apache-hosts/* /etc/apache2/sites-available


The apache host files have now been copied over to their proper location. We need to make some changes to Apache's config file

Go to /etc/apache2/apache2.conf, and open up that file (with proper sudo permissions) with your preferred text editor.

Scroll all the way to the very bottom and add these two lines...


ServerName localhost

HttpProtocolOptions Unsafe

Save and exit.

Run the following terminal command...


sudo a2ensite


A menu will appear allowing you to select which options you want to enable. Simply enter "*" (without the quotations) and press enter. Apache host files are now enabled.

Now run this command....


sudo a2enmod proxy proxy_http


Apache's Proxy Modules are now enabled. Restart apache for all your new changes to take effect.


sudo service apache2 restart


Chapter 4. DNSMasq

We need to make some small changes on DNSMasq's config file...

Open up the file /etc/dnsmasq.conf usnig proper sudo permissions with your preferred text editor.

Scroll down thru the file and look for the following line....


#address=/double-click.net/127.0.0.1


First, you need to remove the '#'. Next change the '127.0.0.1' to your machine's local IP. This is the IP that your internet modem/router assigns to your machine for the lcoal LAN network. This is NOT your public IP. If you don't know the machine's local IP, run this...


hostname -I


If both IPv4 and IPv6 appear, you need the IPv4 (the number that doesn't use colons). For demo purposes, let's say our machine's local IP is 192.168.1.9.

So now the line in the config file would look like this....


address=/double-click.net/192.168.1.9


We're not done yet. Replace 'double-click.net' with nintendowifi.net. So now the line looks like this..


address=/nintendowifi.net/192.168.1.9


Save and exit. Restart DNSMasq for changes to take effect...


sudo service dnsmasq restart


Chapter 5 Admin Page Setup (optional)

This is totally optional. If you don't care to see what your Wiis' Local IP's and MAc Addresses are (w/ abiltiy to ban profiles), then skip to the next chapter.

Make a blank file in the /home/yourusername/dwc_network_server_emulator-master folder called adminpageconf.json

Enter in the following info for adminpageconf.json


{"username":"yourusernamehere","password":"yourpasswordhere"}


yourusernamehere = the username to log in as admin
yourpasswordhere = the password, duh

Do NOT remove the quotations!

Make changes, save and exit.

Chapter 6. First Time Server Boot

Run the following commands.....


sudo service apache2 restart
sudo service dnsmasq restart


This is done to make sure all changes to all configurations are enabled.. Now run this..


cd /home/yourusername/dwc_network_server_emulator-master
python master_server.py


Once you pressed enter, the python script will start. Wait about 30 full seconds. This is a first time boot and the storage server can take roughly that time to fully start up.

Alright, the SERVER IS BOOTED!!!

Let's do a quick test now. Open up a web browser and type localhost:9001

You should see just a small grid table with the labels Game ID and # Players. Congratz! The server is running and responding correctly!

Chapter 7. Wii Connection Test

Ok we got the computer side-of-things done. Now we need to do some things to the Wii.

Go to Wii Settings, then Internet Settings. Make a brand new connection. Once you have done the connection test and it is complete, go back into the that Connection. Select Change Settings. Scroll left/right until you see 'Auto-Obtain DNS'. Change Yes to No. Click on Advance Settings.

For both Primary and Secondary DNS, enter in your Machine's Local IP address. (The same one you had to enter in for the dnsmasq.conf file from chapter 4)

Save changes, then preform the required Connection Test.

Watch your Linux terminal screen as you do the connection Test. The terminal will spit out some information about receiving a request. Then the Wii should finalize the test and say it is successful. Once successful, exit out of Wii Settings.

Chapter 8.  Getting online with MKW on your server

There are a variety of different methods to test the MKW Wifi on your serer. For this guide, we will assume you have a clean unmodified ISO/WBFS. Do NOT use any ISOs that have been patched in the past for other servers!!!

Add your clean ISO/WBFS to your USB stick, however you usually do it. Plug USB into Wii. Launch HBC.

If you don't have USB Loader GX (revision 1256 or later), then you can use this cheat code HERE. This code disables the game's SSL connection which is required.

Once you are in USB Loader GX, go to Loader Settings, There is an option for Private Server. Change that to "NoSSL".

Boot your game! You will need to use a fresh license or a license that does NOT have an FC. Make required license.


Go online!!! Watch your Linux terminal screen as you connect online on MKW. A boatload of info will be displayed. After a short time, the info will stop and you will then be online. Congratz! The terminal screen will now do some occasional messages about "keep alive requests". This is normal.

Wink

Chapter 9. Some notes and Troubleshooting

To stop the MKW Server... just exit out of the Terminal Screen. If you are online while you do this, you will receive EC's 84010 or 91010.

To login into the Admin page.. visit localhost:9009 on your web browser.

General Troubleshooting:
Problem: The python script won't run!!!
Answer1: Be sure you have both python and python-twisted installed. Be sure you have configured the proxy for Apache correctly. Reboot Apache try again. Apache must be running BEFORE you start the script.

Problem: Script has started, but I can't even access the Stats Page!
Answer1: Be sure you have entered in your actual Machine's Local IP correctly on the dnsmasq.conf. Don't just copy what you see posted in this guide. 

Answer2: Instead of typing in localhost:9001 in the web browser, try replacing 'localhost' with your machine's local Ip

Problem: I can't access the Admin Page!
Answer1: Be sure there are no typos in the adminpageconf.json filename. Be sure you didn't accidentally remove any quotations within the file. 

Answer2: Instead of typing in localhost:9009 in the web browser, try replacing 'localhost' with your machine's local Ip

Problem: I keep getting error codes when making a Wii Connection test to the server!
Answer1: Don't forget to edit the Primary/Secondary Addresses. Be sure you didn't typo your Local IP when entering it in too.

Answer2: Did you remember to start the script?

Answer3: Be sure you have opened up all the necessary ports on UFW firewall. Be sure the firewall is running. Reload it to be sure. 

Troubleshooting MKW Specific EC's when connecting online:
20100:
Game was already patched (not clean)
You forgot to set the No SSL options on within USB Loader GX
(If not using USB Loader GX) You forgot to use the NoSSL cheat code
You forgot to enter in the Primary/Secondary DNS IP Addresses (or you made a typo entering them in)
A very very very crappy Internet connection can cause this EC too (you live in Somalia? lol)

234XX:
You forgot to add those small edits needed on the apache2.conf file
You were not on a clean installation of Linux and your apache configuration already had some files and/or SSL certs installed, so its blocking the connection

23502:
Apache is running but the script is not

5XXXX:
Crappy Internet connection, or you forgot to make an Internet connection in Wii Settings

60000:
You used a License with an FC already made on it. Use a brand new License.

84010 & 91010:
The script died or you accidentally closed it


Credits to Polaris!!!! (original python code writer/author for the dwc-network-emulator)
Reply
#2
Will you include a small extra section for (BeanJr's) CoWFC (fork)?
Reply
#3
No, I have no idea about the technical details of CoWFC.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)