Difference between revisions of "Linux dedicated server/fr"

From Team Fortress Wiki
Jump to: navigation, search
m (template now deprecated template: Please don't remove this - (tracking key))
Line 1: Line 1:
 +
{{trans}}
 +
{{DISPLAYTITLE:Serveur Dédié Linux}}
 +
{{ambox | type = notice | image = Ambox_notice.png | contents = '''Ce guide''' prend en compte que vous savez comment utiliser la '''ligne de commande sous Linux'''.}}
 +
 +
Linux est l'une des deux plates-formes actuellement prises en charge par l'outil de Valve serveur dédié (HLDS), l'autre étant [[Windows Dedicated Server|Microsoft Windows]]. L'installation de base et la configuration d'un '''serveur dédié Linux''' est la même pour toutes les distributions, mais de petits détails, tels que les noms de paquets, répertoires, etc peuvent différer d'une distribution à l'autre. Il est recommandé que vous vérifiez les dépôts de votre distribution pour les paquets nécessaires avant de continuer.
 +
 +
== Comment lire cet article ==
 +
Cet article a été écrit selon la syntaxe de documentation Linux standard, ce qui signifie que:
 +
 +
* Une commande préfixée par <code>#</code> est destinée à être exécuté comme '''root'''. La plupart des distributions ont un compte root séparée; pour d'autres distributions comme Ubuntu, Linux Mint, CrunchBang, etc le préfixe '''sudo''' assure que la commande est exécutée en tant que root.
 +
* Une commande préfixée par <code> $ </ code> est destinée à être exécuté comme '''utilisateur'''.
 +
* <code>./</code> signifie "répertoire courant".
 +
 +
== Configuration requise ==
 +
Un certain nombre d'exigences existent afin d'exécuter un serveur ''Team Fortress 2'' sur la plate-forme Linux:
 +
 +
* Accès en écriture au répertoire de travail courant
 +
* <code>Glibc >= 2.3.6</ code>
 +
* Environ 9 Go d'espace disque disponible (pour un serveur barebones sans cartes personnalisées, des sons, etc)
 +
* Dans le cas d'une distribution '''64-bit''' les packages '''lib32gcc1''' ou '''ia32-libs''' doivent être installés:
 +
Sur CentOS 64-bits exécuter:
 +
 +
<code> # yum install libgcc.i686 glibc.i686 </code>
 +
 +
Sur Debian/Ubuntu/Linux Mint 64-bit exécuter:
 +
 +
<code> $ sudo apt-get install ia32-libs lib32gcc1 </code>
 +
 +
Sur ArchLinux 64-bit exécuter:
 +
 +
<code> $ sudo pacman-Sy lib32gcc1 ia32-libs</code>
 +
 +
* Si vous effectuez l'installation sur CentOS, vous devrez utiliser cette commande avant <code>yum install ncompress</ code>
 +
* Si vous effectuez l'installation sur FreeBSD (ce qui n'est pas du tout Linux), vous devez activer la compatibilité avec Linux dans le noyau et installer un système de base via la collection des ports. Instructions pour vous aider à démarrer sont situés [http://www.ian-justman.com/wiki/index.php?title=HowTos:SRCDS_under_FreeBSD ici].
 +
 
== Installation ==
 
== Installation ==
 +
Il y a un certain nombre de façons différentes de faire fonctionner un serveur dédié. Dans cet article, nous supposons qu'un utilisateur spécifique (''tf2server'') a été créé dans le seul but de gérer un serveur de Team Fortress 2. Pour créer un utilisateur, exécutez la commande suivante en tant que root:
  
 +
# adduser tf2server
  
 +
Vous serez invité à entrer un nom, un mot de passe, ainsi que d'autres informations; remplir ce formulaire comme il vous plaît. Puis changez d'utilisateur, en utilisant la commande '''su''':
  
  sudo apt-get install lib32gcc1 (pour les systèmes 64bits)
+
  $ su -l tf2server
wget http://www.steampowered.com/download/hldsupdatetool.bin
 
chmod +x hldsupdatetool.bin
 
./hldsupdatetool.bin
 
tapez yes
 
./steam
 
./steam -command update -game tf -dir .
 
  
== Démarrage ==
+
Prochaine étape, créer un répertoire et y entrer. Vous pouvez l'appeler comme vous voulez, j'ai choisi "hlds" (pour Half-Life Dedicated Server):
  
  cd orangebox
+
  $ mkdir hlds && cd hlds
./srcds_run -game tf +map cp_badlands
 
  
== Astuces ==
+
La prochaine chose que nous devons faire est de télécharger l'outil de mise à jour serveur dédié (hldsupdatetool.bin), et changer les permissions pour être exécutable, ce qui nous permet de télécharger le binaire Steam nécessaire pour télécharger notre server. Enfin, nous lançons le binaire.
  
# Le serveur dédié ne nécessite pas les privilèges root pour s'installer ou se lancer. Pensez à créer un nouveau compte utilisateur pour le serveur dédié (par exemple <tt>hlds</tt>).
+
$ wget http://storefront.steampowered.com/download/hldsupdatetool.bin && chmod +x hldsupdatetool.bin
# Si votre serveur est lancé sur une architecture 64bits, vous devrez peut-être installer des paquets propre a un système 32bits. Sous Debian, un simple <tt>sudo aptitude install ia32-libs</tt> devrait faire l'affaire.
+
$ ./hldsupdatetool.bin
# <tt>server.cfg</tt> se trouve dans <tt>orangebox/tf/cfg</tt>. Pour plus d'informations sur la configuration de votre serveur dédié, voyez [[Dedicated server configuration]].
 
# N'oubliez pas d'ouvrir les ports 27000-27015 dans votre pare-feu, si vous en possédez un.
 
  
==Voir aussi (en anglais)==
+
When we run the binary, we're prompted to accept Valve's Terms and Conditions for using the update tool; after reading and agreeing to the terms included, type "yes", and hit Enter. The next thing to happen is that the ''steam'' binary should extract. Run it to download the latest version of the HLDS Update Tool:
  
 +
$ ./steam
 +
Checking bootstrapper version ...
 +
Getting version 50 of Steam HLDS Update Tool
 +
Downloading. . . . . . . . . . . .
 +
Steam Linux Client updated, please retry the command
 +
 +
Do as prompted; repeat the same command. All we need to do now is to download the gameserver files, and launch it.
 +
 +
Create another directory, which will house the actual files of the gameserver (inside /home/tf2server/hlds). We'll call this one ''gameserver''.
 +
 +
$ mkdir gameserver
 +
 +
Next up, let's ask Steam to download the Team Fortress 2 game files into that folder, using the following command.
 +
 +
$ ./steam -command update -game tf -dir gameserver
 +
 +
This runs the ''update'' command of the game ''tf'' (Team Fortress 2) into the directory ''gameserver/''. Sit back and wait, this may take some time.
 +
 +
== Running the server ==
 +
We're almost done. The server is installed. The only thing left is to run it, using a number of arguments. Change to the <code>gameserver/orangebox/</code> directory. In this folder, create a file called <code>steam_appid.txt</code> and put in there only the following number:
 +
 +
440
 +
 +
Next, in the same <code>orange box</code> folder, there should be a script called <code>srcds_run</code>, which is what launches the game. A basic use of this script '''could''' be:
 +
 +
$ ./srcds_run -game tf -autoupdate -steambin /home/tf2server/hlds/steam -maxplayers 24 +map cp_badlands
 +
 +
This launches a ''Team Fortress 2'' server with a maximum of 24 players on [[Badlands (Control Point)|Badlands]] which will download updates automatically. There are many more ways of configuring the server and running it, but this covers the basics.
 +
 +
=== screen ===
 +
Many server operators choose to run the server under [http://www.gnu.org/software/screen/ <code>screen</code>], as it allows you to switch between the console and the shell at will, as well as end your SSH session without killing the server. It can be installed via your distribution's package manager. The server can then be run with:
 +
 +
$ screen -m -S {{botignore|tf2}} ./srcds_run ''parameters''
 +
 +
where ''parameters'' is your normal <code>srcds_run</code> parameters. You can use {{key|Ctrl}}+{{key|A}}+{{key|D}} to minimize the console, and <code>screen -r tf2</code> to bring it back up. {{key|Ctrl}}+{{key|D}} will terminate the session (make sure you use the killserver console command first) and {{key|Ctrl}}+{{key|A}}+{{key|[}} will allow you to scroll through it. See the [http://www.gnu.org/software/screen/manual/screen.html manual] for more commands and parameters.
 +
 +
=== Automated startup at server boot ===
 +
In the event of unexpected power outages, it might be usefull to automatically restart your server. The following example Debian LSB init script can be used to automatically restart the server. Note that  <code>screen</code> is used. This script should be named TF2-server and can be put in the folder /etc/init.d. After doing that, run:
 +
 +
$ update-rc.d TF2-server defaults
 +
 +
This should ensure a proper startup of the server after each reboot.
 +
 +
<pre>
 +
#!/bin/sh
 +
 +
### BEGIN INIT INFO
 +
# Provides:          tf2server
 +
# Required-Start:    $remote_fs
 +
# Required-Stop:    $remote_fs
 +
# Default-Start:    2 3 4 5
 +
# Default-Stop:      0 1 6
 +
# Short-Description: Team Fortress 2 server
 +
# Description:      Starts a Team Fortress 2 server
 +
### END INIT INFO
 +
 +
NAME="Team Fortress 2"
 +
USER="tf2server"
 +
SCREENREF="tf2"
 +
BINARYPATH="/home/tf2server/hlds/gameserver/orangebox"
 +
BINARYNAME="srcds_run"
 +
PIDFILE="tf2server.pid"
 +
 +
OPTS="-game tf -autoupdate -steambin /home/tf2server/hlds/steam +maxplayers 32 +ip 0.0.0.0 +map mvm_decoy"
 +
 +
cd "$BINARYPATH"
 +
 +
running() {
 +
    if [ -n "`pgrep -f $BINARYNAME`" ]; then
 +
        return 0
 +
    else
 +
        return 1
 +
    fi
 +
}
 +
 +
start() {
 +
    if ! running; then
 +
        echo -n "Starting the $NAME server... "
 +
        start-stop-daemon --start --chuid $USER --user $USER --chdir $BINARYPATH --exec "/usr/bin/screen" -- -dmS $SCREENREF $BINARYPATH/$BINARYNAME $OPTS
 +
        pgrep -f $BINARYNAME > $PIDFILE
 +
        if [ -s $PIDFILE ]; then
 +
            echo "Done"
 +
        else
 +
            echo "Failed"
 +
            rm $PIDFILE
 +
        fi
 +
    else
 +
        echo "The $NAME server is already started."
 +
    fi
 +
}
 +
 +
stop() {
 +
    if running; then
 +
        echo -n "Stopping the $NAME server... "
 +
        kill `cat $PIDFILE`
 +
        while running; do
 +
            sleep 1
 +
        done
 +
        rm $PIDFILE
 +
        echo "Done"
 +
    else
 +
        echo "The $NAME server is already stopped."
 +
    fi
 +
}
 +
 +
case "$1" in
 +
    start)
 +
        start
 +
    ;;
 +
    stop)
 +
        stop
 +
    ;;
 +
    restart)
 +
stop
 +
        start
 +
    ;;
 +
    status)
 +
        if running; then
 +
            echo "The $NAME server is started."
 +
        else
 +
            echo "The $NAME server is stopped."
 +
        fi
 +
    ;;
 +
    *)
 +
        echo "Usage: $0 (start|stop|restart|status)"
 +
        exit 1
 +
esac
 +
exit 0
 +
</pre>
 +
 +
== iptables rules ==
 +
<pre>
 +
-A INPUT -i venet0 -p tcp -m tcp --dport 27015 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p tcp -m tcp --dport 27005 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p udp -m udp --dport 27015 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p udp -m udp --dport 27005 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p tcp -m tcp --dport 27016 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p tcp -m tcp --dport 27017 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p tcp -m tcp --dport 27018 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p tcp -m tcp --dport 27019 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p tcp -m tcp --dport 27020 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p udp -m udp --dport 27016 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p udp -m udp --dport 27017 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p udp -m udp --dport 27018 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p udp -m udp --dport 27019 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
-A INPUT -i venet0 -p udp -m udp --dport 27020 -m state --state NEW,ESTABLISHED -j ACCEPT
 +
</pre>
 +
 +
*Note: may be shortened if you have multiports extension.
 +
 +
== Troubleshooting ==
 +
; My server doesn’t show up in the LAN tab of my client’s server browser.
 +
; I cannot access my loadout when playing on this server.
 +
: Are you still able to connect using <code>[https://developer.valvesoftware.com/wiki/List_of_TF2_console_commands_and_variables#C connect <ip-address>]</code> in the [https://developer.valvesoftware.com/wiki/Console Developer Console]?
 +
: During startup, does your server report the following?
 +
* Unable to load Steam support library.*
 +
* This server will operate in LAN mode only.*
 +
: When you connect with your client, does the server say the following?
 +
NULL ISteamGameServer in ConnectClient. Steam authentication may fail.
 +
 +
Cannot verify load for invalid steam ID […]
 +
: If so, then both of these problems have the same solution: Make sure you have a <code>steam_app.txt</code> file containing the number <code>440</code> in your <code>orange box</code> folder. See ''[[#Running the server|Running the server]]'', above.
 +
 +
; My server doesn’t auto-update on startup.
 +
: When starting up, does your server say the following?
 +
WARNING: Failed to locate steam binary.
 +
WARNING: Could not locate steam binary:, ignoring.
 +
: If so, then you need point <code>srcds_run</code> to the location of your Steam binary, using the <code>-steambin</code> argument. See ''[[#Running the server|Running the server]]'', above.
 +
 +
== Tips ==
 +
# The first run of <tt>./steam</tt> may hang while checking the bootstrap version.  You will need to retry several times until it completes.
 +
# <tt>server.cfg</tt> goes in <tt>orangebox/tf/cfg</tt>. For more information on configuring your dedicated server, see [[Dedicated server configuration]].
 +
# If you want people outside of your network to be able to connect – that is, you’re not just running a LAN server – remember to open ports 27000-27015 to incoming traffic in your firewall .
 +
# If you don't have a firewall, get one. Exposing your server to the internet without a firewall is very risky.
 +
# Get an error like: "-bash: ./hldsupdatetool.bin: No such file or directory"? If on Debian, try installing lib32gcc1. "apt-get install lib32gcc1"
 +
 +
== See also ==
 
* [[Windows dedicated server]]
 
* [[Windows dedicated server]]
 
* [[Dedicated server configuration]]
 
* [[Dedicated server configuration]]
[[Category: Servers/fr]]
+
 
 +
[[Category: Servers]]

Revision as of 19:40, 23 January 2013

Linux est l'une des deux plates-formes actuellement prises en charge par l'outil de Valve serveur dédié (HLDS), l'autre étant Microsoft Windows. L'installation de base et la configuration d'un serveur dédié Linux est la même pour toutes les distributions, mais de petits détails, tels que les noms de paquets, répertoires, etc peuvent différer d'une distribution à l'autre. Il est recommandé que vous vérifiez les dépôts de votre distribution pour les paquets nécessaires avant de continuer.

Comment lire cet article

Cet article a été écrit selon la syntaxe de documentation Linux standard, ce qui signifie que:

  • Une commande préfixée par # est destinée à être exécuté comme root. La plupart des distributions ont un compte root séparée; pour d'autres distributions comme Ubuntu, Linux Mint, CrunchBang, etc le préfixe sudo assure que la commande est exécutée en tant que root.
  • Une commande préfixée par $ </ code> est destinée à être exécuté comme utilisateur.
  • ./ signifie "répertoire courant".

Configuration requise

Un certain nombre d'exigences existent afin d'exécuter un serveur Team Fortress 2 sur la plate-forme Linux:

  • Accès en écriture au répertoire de travail courant
  • Glibc >= 2.3.6</ code>
  • Environ 9 Go d'espace disque disponible (pour un serveur barebones sans cartes personnalisées, des sons, etc)
  • Dans le cas d'une distribution 64-bit les packages lib32gcc1 ou ia32-libs doivent être installés:

Sur CentOS 64-bits exécuter:

# yum install libgcc.i686 glibc.i686

Sur Debian/Ubuntu/Linux Mint 64-bit exécuter:

$ sudo apt-get install ia32-libs lib32gcc1

Sur ArchLinux 64-bit exécuter:

$ sudo pacman-Sy lib32gcc1 ia32-libs

  • Si vous effectuez l'installation sur CentOS, vous devrez utiliser cette commande avant yum install ncompress</ code>
  • Si vous effectuez l'installation sur FreeBSD (ce qui n'est pas du tout Linux), vous devez activer la compatibilité avec Linux dans le noyau et installer un système de base via la collection des ports. Instructions pour vous aider à démarrer sont situés ici.

Installation

Il y a un certain nombre de façons différentes de faire fonctionner un serveur dédié. Dans cet article, nous supposons qu'un utilisateur spécifique (tf2server) a été créé dans le seul but de gérer un serveur de Team Fortress 2. Pour créer un utilisateur, exécutez la commande suivante en tant que root:

# adduser tf2server

Vous serez invité à entrer un nom, un mot de passe, ainsi que d'autres informations; remplir ce formulaire comme il vous plaît. Puis changez d'utilisateur, en utilisant la commande su:

$ su -l tf2server

Prochaine étape, créer un répertoire et y entrer. Vous pouvez l'appeler comme vous voulez, j'ai choisi "hlds" (pour Half-Life Dedicated Server):

$ mkdir hlds && cd hlds

La prochaine chose que nous devons faire est de télécharger l'outil de mise à jour serveur dédié (hldsupdatetool.bin), et changer les permissions pour être exécutable, ce qui nous permet de télécharger le binaire Steam nécessaire pour télécharger notre server. Enfin, nous lançons le binaire.

$ wget http://storefront.steampowered.com/download/hldsupdatetool.bin && chmod +x hldsupdatetool.bin
$ ./hldsupdatetool.bin

When we run the binary, we're prompted to accept Valve's Terms and Conditions for using the update tool; after reading and agreeing to the terms included, type "yes", and hit Enter. The next thing to happen is that the steam binary should extract. Run it to download the latest version of the HLDS Update Tool:

$ ./steam
Checking bootstrapper version ...
Getting version 50 of Steam HLDS Update Tool
Downloading. . . . . . . . . . . .
Steam Linux Client updated, please retry the command

Do as prompted; repeat the same command. All we need to do now is to download the gameserver files, and launch it.

Create another directory, which will house the actual files of the gameserver (inside /home/tf2server/hlds). We'll call this one gameserver.

$ mkdir gameserver

Next up, let's ask Steam to download the Team Fortress 2 game files into that folder, using the following command.

$ ./steam -command update -game tf -dir gameserver

This runs the update command of the game tf (Team Fortress 2) into the directory gameserver/. Sit back and wait, this may take some time.

Running the server

We're almost done. The server is installed. The only thing left is to run it, using a number of arguments. Change to the gameserver/orangebox/ directory. In this folder, create a file called steam_appid.txt and put in there only the following number:

440

Next, in the same orange box folder, there should be a script called srcds_run, which is what launches the game. A basic use of this script could be:

$ ./srcds_run -game tf -autoupdate -steambin /home/tf2server/hlds/steam -maxplayers 24 +map cp_badlands

This launches a Team Fortress 2 server with a maximum of 24 players on Badlands which will download updates automatically. There are many more ways of configuring the server and running it, but this covers the basics.

screen

Many server operators choose to run the server under screen, as it allows you to switch between the console and the shell at will, as well as end your SSH session without killing the server. It can be installed via your distribution's package manager. The server can then be run with:

$ screen -m -S tf2 ./srcds_run parameters

where parameters is your normal srcds_run parameters. You can use Ctrl+A+D to minimize the console, and screen -r tf2 to bring it back up. Ctrl+D will terminate the session (make sure you use the killserver console command first) and Ctrl+A+[ will allow you to scroll through it. See the manual for more commands and parameters.

Automated startup at server boot

In the event of unexpected power outages, it might be usefull to automatically restart your server. The following example Debian LSB init script can be used to automatically restart the server. Note that screen is used. This script should be named TF2-server and can be put in the folder /etc/init.d. After doing that, run:

$ update-rc.d TF2-server defaults

This should ensure a proper startup of the server after each reboot.

#!/bin/sh

### BEGIN INIT INFO
# Provides:          tf2server
# Required-Start:    $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Team Fortress 2 server
# Description:       Starts a Team Fortress 2 server
### END INIT INFO

NAME="Team Fortress 2"
USER="tf2server"
SCREENREF="tf2"
BINARYPATH="/home/tf2server/hlds/gameserver/orangebox"
BINARYNAME="srcds_run"
PIDFILE="tf2server.pid"

OPTS="-game tf -autoupdate -steambin /home/tf2server/hlds/steam +maxplayers 32 +ip 0.0.0.0 +map mvm_decoy"

cd "$BINARYPATH"

running() {
    if [ -n "`pgrep -f $BINARYNAME`" ]; then
        return 0
    else
        return 1
    fi
}

start() {
    if ! running; then
        echo -n "Starting the $NAME server... "
        start-stop-daemon --start --chuid $USER --user $USER --chdir $BINARYPATH --exec "/usr/bin/screen" -- -dmS $SCREENREF $BINARYPATH/$BINARYNAME $OPTS
        pgrep -f $BINARYNAME > $PIDFILE
        if [ -s $PIDFILE ]; then
            echo "Done"
        else
            echo "Failed"
            rm $PIDFILE
        fi
    else
        echo "The $NAME server is already started."
    fi
}

stop() {
    if running; then
        echo -n "Stopping the $NAME server... "
        kill `cat $PIDFILE`
        while running; do
            sleep 1
        done
        rm $PIDFILE
        echo "Done"
    else
        echo "The $NAME server is already stopped."
    fi
}

case "$1" in
    start)
        start
    ;;
    stop)
        stop
    ;;
    restart)
	stop
        start
    ;;
    status)
        if running; then
            echo "The $NAME server is started."
        else
            echo "The $NAME server is stopped."
        fi
    ;;
    *)
        echo "Usage: $0 (start|stop|restart|status)"
        exit 1
esac
exit 0

iptables rules

-A INPUT -i venet0 -p tcp -m tcp --dport 27015 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p tcp -m tcp --dport 27005 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p udp -m udp --dport 27015 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p udp -m udp --dport 27005 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p tcp -m tcp --dport 27016 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p tcp -m tcp --dport 27017 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p tcp -m tcp --dport 27018 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p tcp -m tcp --dport 27019 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p tcp -m tcp --dport 27020 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p udp -m udp --dport 27016 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p udp -m udp --dport 27017 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p udp -m udp --dport 27018 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p udp -m udp --dport 27019 -m state --state NEW,ESTABLISHED -j ACCEPT
-A INPUT -i venet0 -p udp -m udp --dport 27020 -m state --state NEW,ESTABLISHED -j ACCEPT
  • Note: may be shortened if you have multiports extension.

Troubleshooting

My server doesn’t show up in the LAN tab of my client’s server browser.
I cannot access my loadout when playing on this server.
Are you still able to connect using connect <ip-address> in the Developer Console?
During startup, does your server report the following?
*	Unable to load Steam support library.*
*	This server will operate in LAN mode only.*
When you connect with your client, does the server say the following?
NULL ISteamGameServer in ConnectClient. Steam authentication may fail.
…
Cannot verify load for invalid steam ID […]
If so, then both of these problems have the same solution: Make sure you have a steam_app.txt file containing the number 440 in your orange box folder. See Running the server, above.
My server doesn’t auto-update on startup.
When starting up, does your server say the following?
WARNING: Failed to locate steam binary.
WARNING: Could not locate steam binary:, ignoring.
If so, then you need point srcds_run to the location of your Steam binary, using the -steambin argument. See Running the server, above.

Tips

  1. The first run of ./steam may hang while checking the bootstrap version. You will need to retry several times until it completes.
  2. server.cfg goes in orangebox/tf/cfg. For more information on configuring your dedicated server, see Dedicated server configuration.
  3. If you want people outside of your network to be able to connect – that is, you’re not just running a LAN server – remember to open ports 27000-27015 to incoming traffic in your firewall .
  4. If you don't have a firewall, get one. Exposing your server to the internet without a firewall is very risky.
  5. Get an error like: "-bash: ./hldsupdatetool.bin: No such file or directory"? If on Debian, try installing lib32gcc1. "apt-get install lib32gcc1"

See also