I am doing some rate-limiting with IPtables, and i'm not sure if I should use "Recent" or "Limit"

What are the differences between the two? If they both achieve the same result, which one has better performance? I would like to know, regardless if any difference would be perceivable.

I am looking to ACCEPT if under limit, and REJECT if over. I'm not interested in thus bandwidth throttling, I don't want a queue.

I don't need any syntax examples, both have ample use examples online. I have also used Limit in the past.

I appreciate any responses.

  • 3
    If I recall, limit is on all connections matching the rule (i.e. not IP specific - ignore the rule for everyone after the limit is reached) whereas recent is IP specific (ignore the rule only for the specific IP once the criteria are reached). Other things being equal (i.e. I haven't tested it), it would stand to reason that limit has better performance than recent, since it is simpler - it doesn't need to track individual IPs/times. – cyberx86 Nov 22 '11 at 4:11
  • It is surprising to see so many howtos use recent as a hackish Limit. I understand it is more flexible, but I also assumed Limit would perform better. – J. M. Becker Nov 22 '11 at 8:51

I think this link explains both modules in good detail.

In short, the limit module puts a limit on the number of times a rule can be matched. The recent module enables you to create a dynamic list of IPs and then use this list to match in other rules differently (do special NATing, deny access, etc..).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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