Here is an example start command for TF2. This assumes you want to stack all of your servers on a single IP, which is what I do:

./srcds_linux -game tf -ip 1.2.3.4 +clientport 27017 +hostport 27117 +tv_port 27217 -steamport 26017 +replay_port 27417 -strictportbind -pidfile /whatever/server.pid -maxplayers 26 +map cp_dustbowl

IMPORTANT: Order of arguments matters.  +map must be last.

Where

CLIENTPORT="27017"
HOSTPORT="27117"
TVPORT="27217"
STEAMPORT="26017"
REPLAYPORT="27417"



IMPORTANT: For this example above, I used 17 for the last two digits on the assigned daemon ports. You MUST stagger your ports by 2, due to a bug with STEAMPORT where it will take whatever you give it and +1.

In other words, only use all odd numbers (1, 3, 5, 7,...). This gives you the opportunity to stack up to 50 servers on a single IP.

For example, I specified the STEAMPORT above to be 26017, but it will actually use 26018.

Note the use of "-strictportbind", which means the srcds_run process will exit if ports are already in use. However, the srcds_linux script will auto-restart the process by default. You may wish to disable autorestart, or replace the srcds_linux script with your own script.



Under this scheme, here is what a set of iptables rules might look like:

-A filt_in_srcds -p tcp -m tcp --dport 27100:27199 --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j ACCEPT -A filt_in_srcds -p udp -m udp --dport 26000:26099 -m state --state NEW -j ACCEPT -A filt_in_srcds -p udp -m udp --dport 27000:27099 -m state --state NEW -j ACCEPT -A filt_in_srcds -p udp -m udp --dport 27100:27199 -m state --state NEW -j ACCEPT -A filt_in_srcds -p udp -m udp --dport 27200:27299 -m state --state NEW -j ACCEPT -A filt_in_srcds -p udp -m udp --dport 27400:27499 -m state --state NEW -j ACCEPT
-A filt_in_srcds -j RETURN


Have fun.



Landon Orr wrote:
Currently I'm trying to host multiple servers on one machine. It's a very
beefy machine, two 16-core AMD processors and 64 gigs of memory, so I'd
like to run quite a bit of servers, 30+ if possible. However, I'm running
into an issue when I spin up more than fiver servers or so. Right now I'm
having issues with ports overlapping, as in the servers try to request a
port but it's already in use. For the first five they would just use the
next port up. However, it seems that a server uses two ports (correct me if
I'm wrong) 27015 and 27020. After five servers, the next server tries to
use 27015, it's in use so it tries 27020 and then it gives up.

I know when you use the srcds_run command, there is a way to specify the
port to use, but I can't remember the command. Also, how many ports do I
have to specify? Just two, or are there more than that?
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlds_linux


--
# Jesse Molina
# Mail = je...@opendreams.net
# Cell = 1-602-323-7608



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
https://list.valvesoftware.com/cgi-bin/mailman/listinfo/hlds_linux

Reply via email to