Титла: Въпрос за --limit-burst в iptables Публикувано от: reg48 в May 18, 2012, 17:45 --limit-burst в този пример
Код: -m limit --limit 1/s --limit-burst 100 Въпроса ми е тези 100 пъти ограничени ли са в някакъв промеждутък от време или дори и веднъж дневно да попада в паравилото след 100 дни ще се активира? Благодаря! Титла: Re: Въпрос за --limit-burst в iptables Публикувано от: dejuren в May 20, 2012, 17:47 Ето ти материал за особеностите на limit и limit-burst:
http://www.netfilter.org/documentation/HOWTO/packet-filtering-HOWTO-7.html С твоето правило разрешаваш 100 пакета да надскочат лимита от 1 пакет в секунда след което ги ограничаваш. 100 пакета за случая ми се струват множко. Титла: Re: Въпрос за --limit-burst в iptables Публикувано от: reg48 в May 21, 2012, 12:27 В препратката мисля, че намерих отговора:
" # iptables -A FORWARD -m limit -j LOG The first time this rule is reached, the packet will be logged; in fact, since the default burst is 5, the first five packets will be logged. After this, it will be twenty minutes before a packet will be logged from this rule, regardless of how many packets reach it. Also, every twenty minutes which passes without matching a packet, one of the burst will be regained; if no packets hit the rule for 100 minutes, the burst will be fully recharged; back where we started." Ако правилно съм разбрал, всеки 20 минути брояча се ресетва, ако не е стигнал burst стойността и отделно на всеки 100 минути се ресетва напълно. ...С твоето правило разрешаваш 100 пакета да надскочат лимита от 1 пакет в секунда след което ги ограничаваш. 100 пакета за случая ми се струват множко.Може и да са много, сега след като знам как действа, ще ги оптимизирам. Благодаря отново. Титла: Re: Въпрос за --limit-burst в iptables Публикувано от: ircn в May 21, 2012, 19:10 Не си го разбрал правилно.
iptables -A INPUT -p ICMP -icmp-type echo-request \ -m limit -limit 1/minute -limit-burst 5 -j ACCEPT -limit 1/minute will do what it says; it will only match for a rate of incoming packets up to an average of 1 per minute. The operative word here is average. So, does this mean that the first ping request you get will be accepted, then none for a whole minute? Not quite. -limit-burst 5 tells iptables to let 5 such packets in before permitting the rule to match; so, in one minute, we can have 5 ping requests popping through. So, -limit 1/minute permits a maximum of 1 packet per minute on average, but -limit-burst 5 permits 5 in one shot. Have we found a logical error in iptables? No you silly clod, remember, -limit stes a limit on average, whereas -limit-burst limits by number of packets in one go. What will happen then in our example? The firewall will let the first 5 packets in in the first minute, thanks to -limit-burst 5; this means, however, that the packets/minute now is 5, so any further packets are blocked until packets/minute = 1, i.e. 5 minutes later. In the sixth minute, packets/minute will be 5/6 < 1, so another ping request will be let in. When the extra ping request is admitted, the ratio becomes 6/6 = 1 again, and packets are DROPped again until the next minute. Again, average is the operative word. |