# How do I set up a Terraria multiplayer server?

I am trying to set up a Terraria server that my friend and I can play on. We are both playing the Steam version. I believe I have it running, but when I send them an invite through Steam, it doesn't work. They say that it just keeps loading but never goes anywhere.

I have tried searching how to set up a multiplayer server on YouTube, but the instructions they give either aren't clear or they don't work.

How do I determine what my IP and port are? Is this my public IP, or is it like a 'world' IP or something? Do we need to download and set up a VPN? Or is there an easier way to get this working without downloading anything?

• Hi @amazingruler1 - I have edited your question to be clearer, and incorporated the information from your duplicate question too. I hope this helps. – Robotnik Nov 3 '20 at 4:13
• Not an answer, but an additional data point: My wife and I play Terraria together and before the 1.4 update, it was basically 50:50 if joining worked or not. We often had to restart Terraria on the server and sometimes even the whole computer. Mind you, we are on the same network. Can't say anything about 1.4 though, because we now use a dedicated Linux server – Sentry Nov 4 '20 at 16:58
• This is very helpful Thank you! – amazingruler1 Nov 4 '20 at 17:27

Even if you know your port and public IP, there are a few things you need to consider if you want to host a server.

### Firewall

Your router (the thing that connects your home network to the internet) has a firewall that blocks any incoming traffic that isn't a response to some outgoing traffic. This is to protect your home network from possible attacks from the outside.

However, when you set up a server, you're expecting people from the outside connecting to it. As a result, you must tell your router that connection attempts from the outside should be allowed. There are 3 ways to do this:

1. Port forwarding: You are telling your router that only messages to a specific port or range of ports is allowed to go through the firewall, and should be forwarded to a specific computer (your server). This is the recommended approach as it limits the range of attacks that can be launched against your server.

2. Automatic port forwarding (UPnP): Same as before, but much more convenient as your devices can now open ports on their own. This can leave your home network vulnerable if a malevolent actor somehow gains access to your home network. Examples include but are not limited to: Malware, hacked WiFi, insecure devices that forget to close ports when they're done, etc. Note that the software (the Terraria server software) must support this feature to make use of it.

3. Demilitarized Zone (DMZ): The DMZ is a zone in your home network that is fully open to the outside. By putting your server in the DMZ, you are essentially leaving it outside of your firewall's protection, enabling anyone to access your server using any port. You should only use a DMZ if you know exactly what you're doing, both in terms of networking as well as in terms of security. In some home routers, the DMZ is not isolated from your home network. In that case, if your DMZ gets compromised, it'll compromise the rest of your home network.

How to enable/disable or configure port forwarding, UPnP or DMZ depends on your router.

Remember that your server may also have its own firewall, so even if you've opened a port on your router's firewall, your server may itself be refusing the connection. The solution here is to allow your software (the Terraria server software) to bind to the ports it needs.

### Dynamic IP addresses and leasing

Due to the limited amount of IPv4 addresses (and IPv4's enduring popularity), the public IP address you have now may change at any moment. When and how often it changes depends on many factors.

If this happens to you, your friend will need to know your new public IP address to connect again. To avoid this, you can use a so-called dynamic Domain Name System (dynamic DNS, or DDNS). Your server will periodically contact the DDNS server, which will assign a URL (such as example.com) to your current public IP address.

For additional safety, it's recommended to request a certificate from a Certificate Authority (CA) such as Let's Encrypt, so your friend can be sure they're connected to your server, and not to some malicious server pretending to be you.

# Port

You should be able to find the port in the console window that your server starts in (I would get the V6).

# IP (Local)

To find the IP you can go to CMD and type ipconfig and grab the Temp IPV6 (or V4 if you got the V4 port)

# IP (Public)

Just google “what is my ip”

• The IP from ipconfig is a local IP. The asker is probably more interested in their public IP, which they might be able to find by going to (for example) whatismyip.com – Schism Nov 2 '20 at 21:20
• @schism added it – Penguin Nov 2 '20 at 23:10
• Thank you, really appreciate it! – amazingruler1 Nov 4 '20 at 2:34