Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Apr 1 '12 at 7:54

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

2 Answers 2

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.

share|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 '12 at 8:50

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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