How to set up a private Team Fortress 2 server with Meshnet

Discover how to set up your own Team Fortress 2 server using Meshnet on Windows and Linux and enjoy private gaming sessions with your friends.

Introduction

Team Fortress 2 (TF2), an online multiplayer first-person shooter developed by Valve Corporation, remains a favorite among its active and loyal community members even after more than a decade. Creating your own dedicated TF2 server not only provides enhanced stability and control compared to external servers but also enriches your gaming experience with exclusive maps, game modes, and other features. Additionally, a dedicated server is an excellent opportunity to give new life to an old PC.

Nonetheless, managing a public server can lead to potential vulnerabilities in your home network. Meshnet offers an effective solution that removes the necessity of opening ports and revealing your IP address. With Meshnet, you can establish a secure virtual network that links devices from around the globe, simulating a local area network (LAN) connection between remote participants.

This guide will show how to host a private TF2 game from within the game itself as well as how to set up a TF2 dedicated server on Linux and Windows systems, with instructions to connect using Meshnet.

Launch a private TF2 game without a dedicated server

If you're looking for a quick and simple way to create a private game without setting up a dedicated server, you can do so directly from the game.

Before you begin

To ensure that your devices can communicate with each other, enable Meshnet on your host machine and any other devices that will connect to your game.

Configure a private TF2 game session

  1. Launch the TF2 game on your computer.

  2. From the main menu, select Find a game > Create server.

  3. Start a server with any random map. Once the server loads, open Console by pressing the ~ (tilde) key.

  4. Run the following commands, replacing <meshnet_ip_address> with your device's Meshnet IP address and <map_name> with the name of the map you want to use:

    sv_lan 0
    ip <meshnet_ip_address>
    heartbeat
    map <map_name>

    Example

After the server reloads with the specified map, other players can connect to your private game using your device's Meshnet IP address. For further details, see the Connect to the TF2 server section below.

Note

If you can't access Console, make sure it is enabled in the game's settings:

  1. In the main menu, click the gear button at the bottom of the screen to open Options.

  2. Under Keyboard, select Advanced, and then select Enable developer console and click OK.

Create a TF2 dedicated server on Windows and Linux

The TF2 server software is compatible with Windows and Linux, allowing you to create a private server on either system. This article covers the steps for both platforms.

Before you begin

Ensure you have the following:

  1. A computer with a stable internet connection running Linux or Windows.

  2. At least 20GB of free storage space for the game files.

  3. A minimum of 8GB of RAM or, preferably, 16GB for optimal performance.

  4. Meshnet is enabled on both your server machine and any devices that will be connecting to it.

Create a basic TF2 dedicated server with SteamCMD

The steps below outline how to install and configure the server software, create a configuration file, and launch the server with customized settings.

Note

This user guide is based on installing the server on Windows 11.

Download and install SteamCMD

To download and install SteamCMD, which is a command-line tool used to manage dedicated server files, follow these steps:

  1. Create a new folder on your computer where you want to install SteamCMD. For example: D:\tf2_server

  2. Download the SteamCMD for Windows from the Valve Developer Community website. Look for the download link under the “Windows” section.

  3. Extract the contents of the downloaded ZIP file to the folder you created.

  4. Double-click the steamcmd.exe file to launch the application.

  5. If the Windows security alert box appears, select both the private and public networks options and then click the Allow access button to allow incoming connections through the firewall.

The SteamCMD tool will automatically update and, upon completion, will be ready to accept commands.

Download and install the TF2 server

Now that you have SteamCMD installed, it's time to download and install the TF2 server files.

  1. You can log in anonymously to SteamCMD to download TF2 dedicated server files by entering the following command:

    login anonymous

    Example:

    To log in to SteamCMD with your Steam account, enter the following command and replace <username> and <password> with your Steam account credentials:

    login <username> <password>

  2. Specify the installation directory for the TF2 server files by entering force_install_dir followed by the path to the installation folder of your choice. For example:

    force_install_dir D:\tf2_server\tf2\

  3. Download and install the server files by entering this command:

    app_update 232250

    The download process may take several hours to complete because the dedicated server content is quite large. Once the "Success!" message appears, it means that the server files are fully downloaded and installed.

  4. Exit SteamCMD by entering the following command:

    quit

Configure the server

After installing the server files, the next step is to configure the server settings.

  1. Navigate to the tf\cfg\ directory within the folder where you installed the TF2 server.

  2. Create a new text file named server.cfg and open it with a text editor, such as Notepad.

  3. Add the following lines to the file, replacing the placeholders with your desired settings, where:

    • <your_server_name> is your server display name.

    • <time_in_minutes> is the maximum time in minutes a map can be played before switching to the next map.

      hostname "<your_server_name>"
      mp_timelimit "<time_in_minutes>"

      Example

  4. Save and close the text editor.

The server.cfg file allows you to store custom settings for your server. To learn more about additional configuration parameters, visit the TF2 Wiki's dedicated server configuration page.

Launch the server

Now that your server is configured, you can start it by creating a batch file to simplify the process.

  1. Create a new text file in the tf2server folder in the folder where you installed the server. You can name it start_tf2.bat or choose another name for the file.

  2. Open the file with a text editor and add the following line:

    srcds.exe -console -game tf +sv_pure 1 +randommap +maxplayers 24

    These lines contain key server settings that can be modified according to your preferences:

    • To set a specific map, replace +randommap with +map followed by the name of your preferred map. For example: +map ctf_2fort.

    • To limit the number of players who can connect to the server, adjust the maxplayers value.

    • To control custom content from clients, set sv_pure to the desired value. 1 restricts most custom content to ensure a consistent gaming experience.

  3. Save the file and exit the text editor.

  4. To launch the server, double-click the start_tf2.bat file you’ve just created.

  5. If the Windows security alert box appears, select both the private and public networks options and then click the Allow access button to allow incoming connections through the firewall.

Now, your TF2 server should start with the specified settings.

Tip To stop the server, type quit or exit in the console window and press Enter.

To ensure your server runs smoothly, regularly update the server files.

Connect to the TF2 server

To connect to the newly created server, follow these steps:

  1. Copy the Meshnet IP address of the server computer from the NordVPN app by clicking it.

  2. Launch the TF2 game on your computer.

  3. Open Console by pressing the ~ (tilde) key and then typing the following command, replacing <server_ip> with the copied Meshnet IP address:

    connect <server_ip>

    Example

  4. Click Submit.

Once connected to your server, you and your Meshnet peers can enjoy playing Team Fortress 2 together.

Last updated

© 2024 Nord Security. All Rights Reserved.