Note: The steps in this guide are similar for setting up listen servers on other games running on the Source Engine (TF2, HL2:DM, CS:S).
So, you’ve got your hands on Garry’s Mod, joined some servers, but now you want to host your own multi-player game.
The actual process of hosting a multi-player game is quite simple, but the problem is that many people’s networks aren’t configured for hosting multi-player games right off the bat. This guide will help you to set up your network correctly and host a listen server (if you wish to set up a dedicated 24/7 server, there are some guides on the GMod wiki).
The Problem: You want to host a Garry’s Mod server, but your computer/network isn’t letting you. The chances are your ports have not been forwarded and your computer is not set up with a static internal IP address.
So what can you do?
Okay, now that you have a static LAN IP, you need to allow your router and firewall to accept connections on specific ports. First of all, make sure that Garry’s Mod is not blocked on your firewall. If you don’t know how to change your firewall settings, go here for Mac, and here for XP. For Vista, go here and for Windows 7, go here.
Great! Now you gotta “open” or “forward” port 27015 (server) and port 27005 (client) on your router (if you’re not using a router, but instead your modem is connected directly to your computer, you can skip this step). These ports are the default ports on Garry’s Mod, so unless you’ve changed them, it should work. Find your router here, and follow one of the guides to forwarding ports. If you can’t find a guide there, google “forward ports <router model>” and you should find something easily.
Here’s few things that might help you:
- The IP you enter will be the same one you chose as your static IP earlier.
- For the protocol type, choose both TCP and UDP, just in case.
- Some routers don’t like port ranges, so if it doesn’t work, just try forwarding the port individually.
- If you get an option for public port and private port, just use the port you are trying to forward, in this case, 27015.
- Make sure the actual forward is enabled and set to always, unless you want custom timings.
- If you are on a D-Link router you may have to use Virtual Server instead of port forwarding. Using both together may cause port conflicts.
At this point if you’ve done everything correctly, you should be able to host multi-player games by starting a game through “Create Multiplayer”.
In the case people can’t join:
- Make sure the game is not a LAN game by starting the game with Local Network Game unchecked. Alternatively, open up the console by pressing the ~ key AFTER you have started a multi-player game. Type in sv_lan 0. Then put it into effect by a map change. Type in map <mapname> to change the level. If your console is not enabled, you can do so by going to your keyboard settings clicking on advanced, and enabling the developer console.
- Make sure you’ve configured your network correctly. Start a multi-player game, then open the Steam browser. Go to either http://www.yougetsignal.com/tools/open-ports/ or http://www.canyouseeme.org/ and test port 27015. If it fails, you need to go back and fix your settings.
- There’s an issue with friends not being able to join your game. Instead of using the server browser or Steam friends list, tell your friend to connect by opening the console, and typing connect <yourexternalipadress>. To find out your external IP, click here. Note that this is your EXTERNAL IP and if you have a dynamic IP, it can change over time.
And that’s it! Hopefully after this guide you should be up and running fine.
Useful console commands when running a server:
- map <mapname> (use this to change the level)
- quit (quickest way to quit the game)
- kick <playername? (kicks a player from the game)
- kill (suicide command)
- bind <key> <command> (use to bind a command to a key)
Pressing the up or down arrow key will cycle through commands already entered.