Skip to content
Run a Server

How to Get a GSLT and Port Forward a Garry's Mod Server

Create a Garry's Mod Game Server Login Token with app ID 4000, add +sv_setsteamaccount, forward port 27015 and fix a server missing from the server list.

To get a Garry's Mod GSLT, log in at Steam's game server account page and enter app ID 4000. Add the token to your start line with +sv_setsteamaccount. Then forward port 27015, UDP and TCP, to the machine running the server.

What a GSLT Is

A Game Server Login Token, or GSLT, logs your server into Steam with its own account. It proves the server comes from a real copy of Garry's Mod and keeps fake servers out of the list. It also gives your server a fixed SteamID, so players can still find it if its IP address changes.

Every Garry's Mod server should have one. Since the May 2020 update, servers without a GSLT get a severe penalty in the server list ranking.

Create a Token

Your Steam account must meet Steam's rules before it can create a token:

  • It isn't community banned or locked.
  • It isn't a limited account.
  • It has a qualifying phone number registered.
  • It owns Garry's Mod.

Enter App ID 4000

In App ID of the base game, type 4000. That's Garry's Mod, even though the dedicated server you downloaded is app 4020.

Add a Memo

Type a Memo that tells you which server this token is for, such as "DarkRP main".

Create and Copy the Token

Click Create. The page reloads with a new row showing your memo, the login token and the app ID. Copy the login token.

Keep It Secret

Treat the token like a password. If your game server accounts are banned, Steam may restrict you from playing the game they're for.

Add the Token to Your Server

Put the token on the command line in your start script, then restart the server:

+sv_setsteamaccount YOURLOGINTOKENHERE

Rules for tokens:

  • One token per server. Two servers sharing one token disconnect players and print Connection to Steam servers lost. (Steam error code 6).
  • A bad token stops the server. An invalid or expired token stops the server from starting at all.
  • Your Steam password resets them. Changing your Steam password invalidates every token you own. Use Regenerate token on each row and update your start scripts.
  • You can create up to 1000. Steam sets that limit per account.

If the console shows Could not establish connection to Steam servers with result 18 or 106, regenerate the token or create a new one.

Which Ports to Open

PortProtocolWhat it's for
27015UDP and TCPThe game, server list queries and RCON. Change it with -port
27005UDPThe client port. Change it with -clientport
26900UDPSteam traffic, outgoing. Change it with -sport

Forward 27015, UDP and TCP, to the server. The other two are on Valve's list, but most home routers let outgoing traffic through already.

Running two servers on one machine? Give each its own port, such as -port 27016 for the second one, and forward that port too. Each server also needs its own GSLT.

Forward the Port

Every router's admin page looks different, but the steps are the same.

Give the Server a Fixed Local IP

In your router's settings, reserve a local IP address for the server, often called a DHCP reservation. Otherwise the address can change and your port forward stops working.

Add the Port Forward

Find the Port Forwarding section. Forward port 27015, both UDP and TCP, to the server's local IP.

Open the Firewall

Allow the port through the firewall on the server itself, using the commands below.

Windows Firewall usually asks the first time srcds starts. If you missed it, open PowerShell as administrator and add two rules:

New-NetFirewallRule -DisplayName "GMod Server UDP" -Direction Inbound -Protocol UDP -LocalPort 27015 -Action Allow
New-NetFirewallRule -DisplayName "GMod Server TCP" -Direction Inbound -Protocol TCP -LocalPort 27015 -Action Allow

When Port Forwarding Can't Work

Some internet providers put many homes behind one shared public IP, called CGNAT. Mobile providers often do this. Behind CGNAT, no port forward reaches you, and Valve says hosting may be impossible. Ask your provider for a public IP, or rent a VPS or game server instead.

Test From Outside

Pinging your own public IP from inside your home fails on some routers, even when the port is open. Ask a friend on another connection to join instead. In their game console they type:

connect 203.0.113.25:27015

Replace 203.0.113.25 with your server's public IP. If they get in, the port is open.

Why Your Server Isn't in the Server List

Next Steps

With the server listed, set it up for roleplay: Install DarkRP and an Admin Mod.

Want to see a big DarkRP server running? Join Justified: justified.gg

More in Run a Server

View all