Setting up a VM and your own tmwa server (anyone can do it)

Ask for help regarding any technical issue or report any bug or OS independent issues.
Post Reply
User avatar
meway
TMW Classic
TMW Classic
Posts: 1737
Joined: 04 Jan 2009, 05:02
Location: Detroit MI

Setting up a VM and your own tmwa server (anyone can do it)

Post by meway »

Setting up a tmwa development environment with LAN settings on windows.

Before we get started you will need download a few things. We will be using VM to make things easier. This tutorial assumes you don't know anything. Follow the instructions to a T and you will happily be playing on your own tmwa server in no time. First lets explain how we will be using LAN (Local Area Network). We will be setting up server access to our LAN so that we can use the mana+ client to connect with the server on multiple computers connected to one router.

i.e: My server is a desktop machine that has ubuntu server edition on it with tmwa configured and my laptop has the mana world (mana+). My router assigns all computers connected to my LAN (router) similar IP's. My desktop machine is given the ip address (192.168.1.104) and my laptop (192.168.1.34). I can play on the desktop machine with my laptop I just need to tell the client (mana+) to connect to 192.168.1.104 (my desktop computer) on port 6901. We will talk about ports later. now lets get started


Things to Download

~VirtualBox

~Ubuntu server edition

~The Mana World (mana+)


Once you have VirtualBox installed and Ubuntu server edition downloaded we can begin.

Start by opening Oracle VM VirtualBox Manager and Press "New" Next you will choose the "name" of your Virtual Machne. Change type to "Linux" It should automaticly select "ubuntu" for your "version" if it didn't go ahead and do this. I recommend giving your VM 512mb to work with and 8gb of HDD space although we don't need this much.


Open your new VM. At the top of the window you will need to select "Devices" than > "CD/DVD Devices"> "Choose a virtual CD/DVD disk file". Browse to your iso image (ubuntu server edition you downloaded) and select that. You may need to restart your VM to continue to installation. Install ubuntu server edition. If you are prompted to install extra servers, OpenSSH, LAMP, ect... you really don't need these at the moment but you can go ahead and select OpenSSH if your familiar with it.


You will be prompted to "login" <put your username here> and than "password" Your password will not display when you type it out for security reasons so be sure you are typing the correct password and press enter. Once you are logged in type: Sudo apt-get update (This will insure your system is up to date). Now install vim with the same method: sudo apt-get install vim. Now type. sudo apt-get install git-core (this is a tool we use to communicate with an online database to download files). Now type sudo apt-get install make (this is the tool to compile the software). After you have completed these steps go ahead and follow the instructions found on http://wiki.themanaworld.org/index.php/How_to_Develop and come back when you reach "updating the server".


How to navigate.

Its probably a good idea to get familiar with navigating through files. "dir" will show you all files and sub folders in the current folder your in. "ls" does this as well but with color codes folders, zip files, normal files ect.. Go ahead and try them. Type: cd tmw-ea

You will now be in the tmw-ea directory. When you type ls or dir you will see an eathena-data and an eathena folder. cd stands for "change directory" when you type: cd .. (this is "cd<space><period><period>") It puts you back into the previous directory. Ok we are ready to continue to configuring


How to configure LAN and learn vim

First lets start off by typing:"ifconfig". if the address after "inet addr" is 10.0.2.15 that is good. If not assume any time we say 10.0.2.15 after this you should replace it with what ever number is after your "inet addr" line. Now lets hop on windows(host os). Open run and type cmd or go ahead and open your command prompt.type "ipconfig" (ifconfig and ipconfig are different) we want to know your computers lan ip. In this example Mine is "192.168.1.104" your subnetmask, (i.e: mine is "255.255.255.0") and your default gateway,(i.e: Mine is "192.168.1.1") ok now back to the linux machine.


Lets navigate to our first configuration directory (type: cd tmw-ea/eathena-data/login/conf/ )

///Note: we are not setting up ladmin in this tutorial end note///

You should now be in a directory named "conf" (type: vim lan_support.conf ) this will open lan_support.conf with a terminal based text editor called vim.


Learn how to use vim's basic functions

Press "down" until you find "lan_char_ip: 127.0.0.1"

We are going to replace this with your computers LAN IP found in ipconfig on cmd prompt (i.e mine was 192.168.1.104)"

Press your shift and i, you should now be in "insert mode" You can now alter text inside the document as you would normally. Go ahead replace 127.0.0.1 with your LAN IP. once you have finished navigate to "lan_map_ip" you should also change this IP to your LAN IP. (you should be able to find your subnet mask and your subnet in the same place. your subnet in this case is our default gateway mine was 192.168.1.1.)

navigate down to "subnet:" and change the ip to your subnet than down to subnetmask and change it to match your subnetmask if it doesn't already

Press the "esc" key on your keyboard than "colon" than type "w" and press "enter". (w stand for write) you just saved your first config file. now type "colon" "q" and press "enter" to exit the document.

now lets navigate to eathena-data again (remember "cd .." do this twice)

Once you are in the eathena-data directory (type: cd world/conf ). lets open lan_support.conf with vim. (remember to open a file with vim its "vim "AndFileNameHere") so type "vim lan_support.conf" scroll down to "lan_char_ip:" replace this with the ip we found using ifconfig (i.e mine was 10.0.2.15 yours should have been the same but if not you should have taken note) Now scroll down to lan_map_ip and do the same. I will assume you now know what to do with subnet and subnetmask as well. After you have completed the configuration "esc", "write" ( :w ) and "quit" (:q)

we have another configuration file to do in this directory. Go ahead and open with vim char_local.conf. Change Login_ip and char_ip to your lan IP (mine was 192.168.1.104) once you have finished escape write and quit.

We will now navigate back to the "world" directory. once you are in the "world" directory type: cd map/conf . we are now in the conf directory. Open with vim map_local.conf and change char_ip: and map_ip: (127.0.0.1) to your LAN IP (mine was 192.168.1.104) esc, write, quit when your finished.


Networking/port forwarding

At the top of your VM click "devices" and than "network adapters" after the new menu pops up click the button that says "port forwarding". There is a + sign Make a new entery in this format. "Protocol" TCP "Host IP" your LAN IP (mine 192.168.1.104 "host port" 6901 "guest IP" your ifconfig IP (should be 10.0.2.15) "guest port" 6901. (ie. It should look similar to this

Rule1 TCP 192.168.1.104. 6901 10.0.2.15 6901) Press + and do the same thing you did as before but use port 6122 instead of using 6901. Press + again and do this for 5122. Press "ok" to get back into your terminal . Type "cd" and press "enter" (this will put you in your home directory) ///note: to connect with two different computers you must also port forward in your router settings found at http/ your.default.gateway end note you also may have firewalls that block ports as well.///


Starting your server.

Type cd tmw-ea/eathena-data. Once you are in the eathena-data folder your ready to begin.

Type ./login-server& (If you see any red letters at any point you did something wrong in a lan_support.conf) Type ./char-server& After it has loaded type ./map-server&.


Connecting with your client (mana+)

Ok you should have mana+ installed now on your windows os or "host os" start it up and add a custome server by pressing the "add" button. Use your LAN IP and the port 6901 than you should be able to log into your server! congratz your finished and ready to play!.
Last edited by meway on 08 Apr 2013, 04:51, edited 7 times in total.
User avatar
Nard
Knight
Knight
Posts: 1113
Joined: 27 Jun 2010, 12:45
Location: France, near Paris

Re: Setting up a VM and your own tmwa server (anyone can do

Post by Nard »

This should apply to ANY machine and OS where VirtualBox is available: MacOS, but also various Unix based OSes.
Ubuntu server is not required (maybe preferable); you can use any version.

edit:
I plan to make a server setup wiki page, based on the older How to Develop one. I will use the information you give; thanks! :D .

I'd like also to provide information to make the server a public one and a set of sample config files.
I am not sure if this would cover all needs but I think the sets should include at least (please replace with sample IPs):
  • tmw-server/eathena-data/login/
    1. lan_support.conf
    2. ladmin_local.conf
  • tmw-server/eathena-data/world/conf/
    1. lan_support.conf
    2. char_local.conf
  • tmw-server/eathena-data/world/map/conf/
    1. map_local.conf
    2. magic.conf
Basic configuration sets (in addition to those which are given in examples):
  1. server has direct connect to internet (router as bridge of modem :P)
  2. server←→LAN←→Router←→WAN (with route example: which ports do I have to forward? (This can include the VM machine case)
"The language of everyday life is clogged with sentiment, and the science of human nature has not advanced so far that we can describe individual sentiment in a clear way." Lancelot Hogben, Mathematics for the Million.
“There are two motives for reading a book; one, that you enjoy it; the other, that you can boast about it.” Bertrand Russell, Conquest of Happiness.
"If you optimize everything, you will always be unhappy." Donald Knuth.
User avatar
wushin
TMW Adviser
TMW Adviser
Posts: 1759
Joined: 18 Dec 2012, 05:56
Location: RiverBest, Brew City, Merica
Contact:

Re: Setting up a VM and your own tmwa server (anyone can do

Post by wushin »

If you got a DDrwt or any standard router ports 6901,6122, & 5122 need to be open.

If you are using a box with iptables as a router/gateway.
#Router Additions to standard linux router using iptables.

##(These will not just work by themselves, please know what your doing before you go locking yourself out of ssh.)##

#Firewall on router
iptables -A PREROUTING -d <External IP>/32 -i <External IFace> -p tcp -m tcp --dport 6901 -j DNAT --to-destination <Internal IP>:6901
iptables -A PREROUTING -d <External IP>/32 -i <External Iface> -p tcp -m tcp --dport 6122 -j DNAT --to-destination <Internal IP>:6122
iptables -A PREROUTING -d <External IP>/32 -i <Externarl Iface> -p tcp -m tcp --dport 5122 -j DNAT --to-destination <Internal IP>:5122
iptables -A POSTROUTING -d <Internal IP>/32 -o <Internal Iface> -j MASQUERADE

iptables -A INPUT -p tcp -m multiport --dports 6901,6122,5122 -j ACEPPT
iptables -A FORWARD -d <Internal IP>/32 -i eth1 -o eth0 -p tcp -m multiport --dports 6901,6122,5122 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT

#Client Machine (By default it should already be accepting on ports unless they were closed.)
### Not Sure if I'm doing it right, but it works? I know there is another way of doing it.
iptables -A INPUT -p tcp --dport 6901 -j ACCEPT
iptables -A INPUT -p tcp --dport 6122 -j ACCEPT
iptables -A INPUT -p tcp --dport 5122 -j ACCEPT
The secret to getting all the important stuff done is doing nothing.
Post Reply