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

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.

share|improve this question
2  
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. –  TechZilla Nov 22 '11 at 8:51
add comment

1 Answer

up vote 2 down vote accepted

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..).

share|improve this answer
add comment

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.