For a guide on using console commands, see Server Console.
How to Setup up a Dedicated Server
This guide will tell you how to set up a dedicated server that can be connected to by other people. This guide is for Windows 7 and Windows XP users.
Firstly, you must find out your IP address. Click Start and type in CMD in the "Search programs and files" bar. This will bring up the command prompt. For Windows XP go to the Start menu then All Programs then Accessories and finally click on Command Prompt. Type in ipconfig in the Command Prompt and press enter to bring up your network information. Find the network adapter you are using and write down the IPv4 address as well as the default gateway IP.
If you are having trouble with the CMD prompt, you can just go here and your IP address will be the large white letters inside the box that contains the proxy, city, etc.: whatismyip.com
Once you have your IP and default gateway, open up
an internet browser and enter the default gateway IP in the address bar. This should bring up a login screen for your router. Enter the username and password. This should be 'admin' (this depends on what brand and model is, if the username and password don't work, find the model of your router and go to portforward.com, and filter results down to your particular router) for both, if you have never changed the settings for the router before. If you do not know, then check your router's user manual or go to the router manufacturer's website and look up the manual for your router. Once you are in your router interface locate the port forwarding options. Create a new rule with your computer's IPv4 address, put "7777 to 7777" for the port range, and allow TCP & UDP. Optionally, if you can set a name for the rule, name it Terraria. Save your changes.
Now your router should be ready to forward connections to your computer, but your computer may reject them because of a firewall. If so, you must add an exclusion to your Firewall. This exclusion should be for incoming TCP and UDP connections for local ports 7777.
Now you should be ready. Go to your Terraria folder in your Steam folder and click on "TerrariaServer." Now load any world you want for multiplayer, set the max players, set the port to 7777, and then make a password if you wish. You should be set for people to connect to your server. It is advised that you know some of the Server Console commands or type in "help" to get a list of commands in the console.
Finally, open up a search engine in your webbrowser and type in whatsyouripaddress and find a website that will give you your external IP address. This is then IP that you will give to your friends to connect to your server with port 7777,
Otherwise you can try Terraria Dedicated Server GUI.
Multiple servers on one machine
It is possible to run multiple server processes on a single system. The process is largely the same as for running a single server, but the following factors must be kept in mind;
- Each process must use a separate port. This can be as simple as adding one to each subsequent server's port, (meaning the second server uses 7778, a third uses 7779, and so on) but each server must use a different port. It is probably simplest to do this using a special serverconfig.txt file for each process.
- As a corollary, each server process must be accommodated in the port-forwarding configuration of the network's router. Again, exactly how this must be done varies depending on the router's manufacturer and model.
- Terraria is very RAM-intensive. A single server running a small-sized map requires almost 300MB of RAM by itself, while a large-sized map requires close to 650MB. In both cases, these figures involve no connected players; Connected players will increase the amount of RAM used, though it is not clear to what extent. This problem is exacerbated if the system will be used for other purposes at the same time. A suggested configuration is to subtract one gigabyte from the system's total physical RAM, and run no more than one server for every gigabyte of memory remaining.
- Similarly, the more server processes running on a single system, the greater the demands on the CPU. Like with RAM, it is suggested to run no more than one process on a system for each CPU core it has.