Team Fortress 2

Team Fortress 2

Not enough ratings
Steam Networking (Peer-to-Peer) for TF2 Dedicated Server
By yesnt
Just like clients, the TF2 DS can also be configured to host a P2P server. This can be useful if you want to host a server with SourceMod installed.
   
Award
Favorite
Favorited
Unfavorite
Details, requirements and caveats
Servers using Steam Networking's P2P behave like normal servers, except they're assigned a fake IP on startup. The IP is printed to the console after the "Connection to Steam servers successful" message:

Connection to Steam servers successful. Public IP to Steam is [...]. Assigned anonymous gameserver Steam ID [A:1:...:...]. VAC secure mode is activated. FakeIP allocation succeeded: 169.254.134.215:57528, 57529

This is the IP people wanting to join will need to use to join your server. P2P servers are shown on the server browser, so make sure to set a password to prevent randoms from joining.
FastDL works normally when joining a P2P server, so if you have a FastDL web server, you can use it.

You will need an up-to-date TF2 Dedicated Server. This guide assumes you store your server's launch arguments in a "srcds.bat" file.

Caveats:
  • The assigned fake IP and port changes every time the server starts or a hard level change (using "map" instead of "changelevel") is made
  • Players won't be able to add your server to their Favorites
  • RCON won't work ("Unable to connect to remote server")
Enabling P2P
Open your srcds.bat file and add the following parameter to your srcds.exe launch command:

+sv_use_steam_networking 1

Example: if you have a launch command that looks like this:
srcds_win64.exe -console -game tf +map ctf_2fort +maxplayers 32
you can add the parameter to the end, like this:
srcds_win64.exe -console -game tf +map ctf_2fort +maxplayers 32 +sv_use_steam_networking 1

You will know early on if it's working if the message "Requesting FakeIP as per -enablefakeip" is printed to the console while the server is starting.
5 Comments
Santana 19 hours ago 
Trying to make a dedicate server through this way indeed works however why does my ping for me being the host is even high, this did not happen when i did it through the client, any tips?
yesnt  [author] Mar 14 @ 1:17am 
I'm not aware of such thing existing - not even using a GSLT makes the IP persistent. The closest solution I can think of is setting a tag unique to your server, but that requires people to remember that tag
sage | eu.tf2pickup.es Mar 13 @ 6:14pm 
is there any way to get a "permanent identifier" even when using fake IP? ive read somewhere else that there was something you could do but cant remember where
yesnt  [author] Feb 27 @ 5:34am 
if you're connected, your friends can join through the Friends tab. you can also share the fake IP with them
Bloodfire Feb 27 @ 4:31am 
Can friends join such server?