Linux Netfilter discussions
 help / color / mirror / Atom feed
* Iptables and rate limiting per ip address
@ 2006-10-13  6:59 Brendan S (Scratch User)
  2006-10-13  8:01 ` Gáspár Lajos
  0 siblings, 1 reply; 2+ messages in thread
From: Brendan S (Scratch User) @ 2006-10-13  6:59 UTC (permalink / raw)
  To: netfilter

Hi  

I am an iptables beginner. I want to set up my firewall to rate limit incoming packets based on a particular source IP address (but not any other IP).

I understand that there are dstlimit and hashlimit options for iptables.  It is not clear to me whether these apply the same limit (x packets/sec) to each ip address (ie all IP addresses limited at x packets/sec) or whether their action can be applied to a single address (I suspect the former).

If it is the latter, can the hashlimit switch be limited by (eg) -s?   Alternatively can I jump past the rule for other ip addresses?

Would either of these work?
...
-A src_limit -s !<limit_ip> -j ACCEPT
-A src_limit -m hashlimit --hashlimit 2/min --hashlimit-burst 10 --hashlimit-mode srcip,dstport --hashlimit-name per_src --hashlimit-htable-gcinterval 60000 --hashlimit-htable-expire 300000 -j ACCEPT

...
or

-A src_limit -s <limit_ip> -m hashlimit --hashlimit 2/min --hashlimit-burst 10 --hashlimit-mode srcip,dstport --hashlimit-name per_src --hashlimit-htable-gcinterval 60000 --hashlimit-htable-expire 300000 -j ACCEPT

Thanks


Brendan




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-13  8:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-13  6:59 Iptables and rate limiting per ip address Brendan S (Scratch User)
2006-10-13  8:01 ` Gáspár Lajos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox