I want to limit connections per IP for a specific UDP port. I got it working for TCP, but somehow it doesn't work on UDP. These are my rules:

For TCP (working)

iptables -A INPUT -p tcp --syn --dport 7787 -m connlimit --connlimit-above 3 -j REJECT --reject-with tcp-reset
iptables -A INPUT -p tcp --syn --dport 7788 -m connlimit --connlimit-above 3 -j REJECT --reject-with tcp-reset

For UDP

iptables -A INPUT -p udp --dport 7787 -m connlimit --connlimit-above 3 -j REJECT
iptables -A INPUT -p udp --dport 7788 -m connlimit --connlimit-above 3 -j REJECT

According to the man pages this should work (atleast how I understand it), but I still get flooded by single IP's sometimes.

link|improve this question
feedback

migrated from stackoverflow.com Apr 1 at 7:54

This question came from our site for professional and enthusiast programmers.

2 Answers

Your question doesn't make sense, as UDP doesn't really have "connections". There's only one conntrack entry that gets set up for each source IP/port.

link|improve this answer
Thanks for your answer. I wasn't aware of that. What happends is that a client floods my gameserver with a lot of fake connections which fills up the server. Any other way to block this through iptables? – habl Apr 2 at 8:50
feedback

Well it sounds pretty much plausible that your client in question uses less than 3 NFCT connections to flood you.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.