Part 2 : The Firewall configuration

Here we will go briefly over how to configure iptables to use with Left 4 Dead 2 (and other Steam games in general).  This is a short and basic guide

This is part 2 of a 4 part series on how to set up and config a Left 4 Dead 2 dedicated server on CentOS Linux.

Part 1 : Setting up the environment and installing the server

Part 2 : Firewall configuration

Part 3 : Monitoring the dedicated server.

Part 4 : Extras.  Host and MOTD banners, Exclusive servers and lobby.

If you’re linux box is on the internet you most likely have a firewall on it.  If not, then you should really put a firewall on it.  Steam uses alot of ports ( ), so you need to add exceptions to your firewall for these ports.  For Example here is how you would go about doing it for iptables. Open “/etc/sysconfig/iptables” in an editor of your choice and put these lines somewhere in there.

 # Steam Ports
 # Game Client Traffic + Matchmaking and HLTV
 -A INPUT -p udp -m udp --dport 27000:27030 -j ACCEPT
 # Steam Downloads
 -A INPUT -p tcp -m tcp --dport 27014:27050 -j ACCEPT
 # Other ports for Steam
 -A INPUT -p udp -m udp --dport 4380 -j ACCEPT
 -A INPUT -p udp -m udp --dport 3478 -j ACCEPT
 -A INPUT -p udp -m udp --dport 4379 -j ACCEPT
 -A INPUT -p udp -m udp --dport 4380 -j ACCEPT

This should enable the use of all Steam features (steam download, voice and matchmaking).  I’m sure some of these are not used by dedicated servers but I haven’t had time to look into this further.  It’s a good rule of thumb to sort the rules in iptables in the order of their use on the machine,  if your machine is primarily a web server then putting port 80 early in the list of rules is a good way to save few CPU cycles,  and if your machine is a dedicated Steam server then putting the steam ports as early as possible will save CPU cycles.  It’s also a good idea to begin the iptables with this :

 # Accept everything fromt he loopback device
 -A INPUT -i lo -j ACCEPT
 # Accept stuff that has already been established or is related

Having the Related, established this early ensures that connections that are related to other connections or already established to your machine won’t have to travel a long list of rules before they are accepted.

this is it for Part 2,  make sure to check out Part 3.

Tagged with:

2 Responses to Left 4 Dead 2 Dedicated Server on Linux : Part 2

  1. Armando says: