Skip to contentSkip to conversation

port forwarding

DISCUSSION Maxim Berlin 3 participants 6 messages Dec 5, 2002 – Dec 7, 2002

lore
Share & tools
lore
#0 lore raw

Hello all,

Players at my office asks me to give them access to outside counterstrike server, UDP 21705. unfortunatelly, i am brand new in iptables, so i've
read the docs and started make rules, but they does not work.
Then i've tried simple
root@woody~/iptables>cat 1.sh
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -v -F -t nat
iptables -v -F
iptables -v -A FORWARD -p tcp --dport 205 -j ACCEPT
iptables -v -t nat -A PREROUTING -p tcp --dport 205 -j DNAT --to-destination 172.17.32.12:25

, then telnet to woody:205 and there is no refusal and no answer.

root@woody~/iptables>cat /proc/net/ip_conntrack
[...]
tcp 6 118 SYN_SENT src=172.17.32.5 dst=172.17.144.110 sport=2020 dport=205 [UNREPLIED] src=172.17.32.12 dst=172.17.32.5 sport=25 dport=2020 use=1

Can someone please tell me, what i am doing wrong? why [UNREPLIED]? should i create rule to pass packets back from 172.17.32.5 to client?

p.s. iptables v1.2.6a, kernel 2.4.18

Best wishes,
Maxim mailto:[email protected]

#1 lore raw

If they want to play on an external server then there is nothing required other than standard masquerading/nat

HOWEVER, if you resrtict outgoing (and return) ports then you need to allow UDP on port 21705
(I'm not sure if TCP is used at all?)

WARNING
if 3 or 4 people do a standard full server update at the same time it will fill your conntrack table and you will start dropping other connections for a while

Counterstrike is beyond the tiny limitation of a 64K conntrack table and since you cannot specifically say to timeout the counterstrike server update connections quickly (due to the fact that you will never need to do this - yeah I know that's wrong but ... that's what the netfilter developers say) you end up filling the conntrack table

You need to be able to set it to handle about 20,000 connections per user that is using Counterstrike but I think it is limited to only 64K - but I'm not 100% certain.

Anyone know for sure if there is a small limit in the size of the conntrack table? Hopefully there isn't ... but others have said otherwise. Maybe that has change recently?

Quoted 31 lines

Hello all,

Players at my office asks me to give them access to outside counterstrike server, UDP 21705. unfortunatelly, i am brand new in iptables, so i've read the docs and started make rules, but they does not work.
Then i've tried simple
root@woody~/iptables>cat 1.sh
#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -v -F -t nat
iptables -v -F
iptables -v -A FORWARD -p tcp --dport 205 -j ACCEPT iptables -v -t nat -A PREROUTING -p tcp --dport 205 -j DNAT --to-destination 172.17.32.12:25

, then telnet to woody:205 and there is no refusal and no answer.

root@woody~/iptables>cat /proc/net/ip_conntrack
[...]
tcp 6 118 SYN_SENT src=172.17.32.5 dst=172.17.144.110 sport=2020
dport=205 [UNREPLIED] src=172.17.32.12 dst=172.17.32.5 sport=25 dport=2020 use=1

Can someone please tell me, what i am doing wrong? why [UNREPLIED]? should i create rule to pass packets back from 172.17.32.5 to client?

p.s. iptables v1.2.6a, kernel 2.4.18

Best wishes,
Maxim mailto:[email protected]

#2 lore raw
Quoted 19 lines · Andrew Smith

If they want to play on an external server then there is nothing required other than standard masquerading/nat

HOWEVER, if you resrtict outgoing (and return) ports then you need to allow UDP on port 21705
(I'm not sure if TCP is used at all?)

WARNING
if 3 or 4 people do a standard full server update at the same time it will fill your conntrack table and you will start dropping other connections for a while

Counterstrike is beyond the tiny limitation of a 64K conntrack table and since you cannot specifically say to timeout the counterstrike server update connections quickly (due to the fact that you will never need to do this - yeah I know that's wrong but ... that's what the netfilter developers say) you end up filling the conntrack table

Quoted 6 lines

You need to be able to set it to handle about 20,000 connections per user that is using Counterstrike but I think it is limited to only 64K - but I'm not 100% certain.

Then what sort of idiot was there that wrote the counterstrike protocol?
I mean - 20.000 connections per user???? It's crazy! How about a good old TCP connection instead?

#3 lore raw
Quoted 27 lines
Quoted 19 lines · Andrew Smith

If they want to play on an external server then there is nothing required other than standard masquerading/nat

HOWEVER, if you resrtict outgoing (and return) ports then you need to allow UDP on port 21705
(I'm not sure if TCP is used at all?)

WARNING
if 3 or 4 people do a standard full server update at the same time it will fill your conntrack table and you will start dropping other connections for a while

Counterstrike is beyond the tiny limitation of a 64K conntrack table and since you cannot specifically say to timeout the counterstrike server update connections quickly (due to the fact that you will never need to do this - yeah I know that's wrong but ... that's what the netfilter developers say) you end up filling the conntrack table

Quoted 6 lines

You need to be able to set it to handle about 20,000 connections per user that is using Counterstrike but I think it is limited to only 64K - but I'm not 100% certain.

Quoted 3 lines

Then what sort of idiot was there that wrote the counterstrike protocol? I mean - 20.000 connections per user???? It's crazy! How about a good old TCP connection instead?

It's not the protocol - that's how it checks all 20,000 (more or less) servers currently available to determine the "ping" times so you can work out which ones would be best to play on.

It isn't a real "ping" it's just UDP packets going back and forth from your client to EACH server available to determine the performance if you were playing on them.
(That's why conntrack keeps track of them ... for too long)

Basically, you start CounterStrike, then tell it to get a server list and then it gets the "ping" times for each of the servers in the server list - often 20,000 of them
(yes there are only a handful of central list servers that have the active game server lists - and all game servers must register with the central servers if they want to be known for anyone to play on the net)
Then you choose the server you want and start playing

When you play a game that 50ms means the difference between winning and losing - you need to know which servers are responding well to your connection - and no other computer can find that out for you.

Signature · 4 lines
-Cheers
-Andrew

MS ... if only he hadn't been hang gliding!
#4 lore raw
Quoted 22 lines
Quoted 3 lines

Then what sort of idiot was there that wrote the counterstrike protocol? I mean - 20.000 connections per user???? It's crazy! How about a good old TCP connection instead?

It's not the protocol - that's how it checks all 20,000 (more or less) servers currently available to determine the "ping" times so you can work out which ones would be best to play on.

It isn't a real "ping" it's just UDP packets going back and forth from your client to EACH server available to determine the performance if you were playing on them.
(That's why conntrack keeps track of them ... for too long)

Basically, you start CounterStrike, then tell it to get a server list and then it gets the "ping" times for each of the servers in the server list - often 20,000 of them
(yes there are only a handful of central list servers that have the active game server lists - and all game servers must register with the central servers if they want to be known for anyone to play on the net)
Then you choose the server you want and start playing

Quoted 3 lines

When you play a game that 50ms means the difference between winning and losing - you need to know which servers are responding well to your connection - and no other computer can find that out for you.

but is the client checking all 20.000 servers continously, or just at startup?

Signature · 6 lines
Roy Sigurd Karlsbakk, Datavaktmester
ProntoTV AS - http://www.pronto.tv/
Tel: +47 9801 3356

Computers are like air conditioners.
They stop working when you open Windows.
#5 lore raw
Quoted 22 lines
Quoted 22 lines
Quoted 3 lines

Then what sort of idiot was there that wrote the counterstrike protocol? I mean - 20.000 connections per user???? It's crazy! How about a good old TCP connection instead?

It's not the protocol - that's how it checks all 20,000 (more or less) servers currently available to determine the "ping" times so you can work out which ones would be best to play on.

It isn't a real "ping" it's just UDP packets going back and forth from your client to EACH server available to determine the performance if you were playing on them.
(That's why conntrack keeps track of them ... for too long)

Basically, you start CounterStrike, then tell it to get a server list and then it gets the "ping" times for each of the servers in the server list - often 20,000 of them
(yes there are only a handful of central list servers that have the active game server lists - and all game servers must register with the central servers if they want to be known for anyone to play on the net)
Then you choose the server you want and start playing

Quoted 7 lines
Quoted 3 lines

When you play a game that 50ms means the difference between winning and losing - you need to know which servers are responding well to your connection - and no other computer can find that out for you.

but is the client checking all 20.000 servers continously, or just at startup? --
Roy Sigurd Karlsbakk, Datavaktmester

Of course it is only when you request the list or request an update of the net times for the list of game servers. The problem is that netfilter conntrack keeps track of the connections for too long - they are only needed for a VERY short time.
Normally you want long tracking, in this case you certainly do not, for the game server status'.
Thus if you have a good connection, all 20,000 can happen within the conntrack timout period and thus all 20,000 end up in the conntrack table.
If you have 3 or 4 people doing this at the same time (this can be common to have a few people logging in to play together at the same time) then you can get more than 60,000 connections in the conntrack table ... which means it's full if it goes over 64K

Signature · 4 lines
-Cheers
-Andrew

MS ... if only he hadn't been hang gliding!