Skip to contentSkip to conversation

limit module not working with drop policy

DISCUSSION J. Bakshi 3 participants 6 messages Jan 22, 2010 – Jan 24, 2010

lore
Share & tools
lore

J. Bakshi

author
#0 lore raw

Dear list,

My firewall policy is default drop. But the limit module is not working here. I have the following rules to defeat ping flood

``````````
iptables -A INPUT  -p icmp -m limit --limit 3/minute -j ACCEPT
iptables -A INPUT  -p icmp -j DROP
``````````````````

and it is not working. The same rule set is working with default accept policy. What modification should I need to make it working with drop policy firewall ?

Thanks

Signature · 1 line
জয়দীপ বক্সী
#1 lore raw

Hello,
can you send
output of the iptables-save?

Quoted 18 lines · J. Bakshi

Dear list,

My firewall policy is default drop. But the limit module is not working here. I have the following rules to defeat ping flood

``````````
iptables -A INPUT  -p icmp -m limit --limit 3/minute -j ACCEPT
iptables -A INPUT  -p icmp -j DROP
``````````````````

and it is not working. The same rule set is working with default accept policy. What modification should I need to make it working with drop policy firewall ?

Thanks

#2 lore raw
In reply to J. Bakshi
Quoted 27 lines · On 22.01.2010 04:25, [email protected] wrote:

Dear list,

My firewall policy is default drop. But the limit module is not working here. I have the following rules to defeat ping flood

``````````
iptables -A INPUT  -p icmp -m limit --limit 3/minute -j ACCEPT
iptables -A INPUT  -p icmp -j DROP
``````````````````

and it is not working. The same rule set is working with default accept policy. What modification should I need to make it working with drop policy firewall ?

Thanks

*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]

(quoted diff) +0 -7
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 3/min -j ACCEPT
-A INPUT -i eth0 -p icmp -j DROP
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
Quoted 2 lines

COMMIT
# Completed on Sat Jan 23 12:26:49 2010

Hello,

Actually you should not need that '-A INPUT -i eth0 -p icmp -j DROP' rule, as the DROP policy should catch it.
As i've been reading complains about the limit match being broken for years, i suggest trying the 'hashlimit' match (maybe without the --hashlimit-mode option).

best regards

Mart

author
#3 lore raw
Quoted 34 lines · On Sat, 23 Jan 2010 10:45:56 +0100 Mart Frauenlob <[email protected]>…
Quoted 27 lines · On 22.01.2010 04:25, [email protected] wrote:

Dear list,

My firewall policy is default drop. But the limit module is not working here. I have the following rules to defeat ping flood

``````````
iptables -A INPUT  -p icmp -m limit --limit 3/minute -j ACCEPT
iptables -A INPUT  -p icmp -j DROP
``````````````````

and it is not working. The same rule set is working with default accept policy. What modification should I need to make it working with drop policy firewall ?

Thanks

*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [0:0]

(quoted diff) +0 -3
-A INPUT -i lo -j ACCEPT
-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i eth0 -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m

state --state NEW -j DROP -A INPUT -p icmp -m icmp --icmp-type 8 -m limit --limit 3/min -j ACCEPT -A INPUT -i eth0 -p icmp -j DROP

(quoted diff) +0 -2
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -o eth0 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
Quoted 2 lines

COMMIT
# Completed on Sat Jan 23 12:26:49 2010

Hello,

Quoted 6 lines

Actually you should not need that '-A INPUT -i eth0 -p icmp -j DROP' rule, as the DROP policy should catch it.
As i've been reading complains about the limit match being broken for years, i suggest trying the 'hashlimit' match (maybe without the --hashlimit-mode option).

Hello Mart,

Thanks for your suggestion and hint. Now I have modified the rule set as

` ` `
iptables -A INPUT -p icmp --icmp-type echo-request -m hashlimit \
--hashlimit 3/minute --hashlimit-name secureping -j ACCEPT ` ` `

but no luck yet :-( Is there anything wrong in my config ?

with regards

#4 lore raw
Quoted 25 lines · On 24.01.2010 07:50, [email protected] wrote:
Quoted 15 lines · On Sat, 23 Jan 2010 10:45:56 +0100 Mart Frauenlob <[email protected]>…
Quoted 5 lines · On 22.01.2010 04:25, [email protected] wrote:

Dear list,

My firewall policy is default drop. But the limit module is not working here. I have the following rules to defeat ping flood

Quoted 8 lines
``````````
iptables -A INPUT  -p icmp -m limit --limit 3/minute -j ACCEPT
iptables -A INPUT  -p icmp -j DROP
``````````````````

and it is not working. The same rule set is working with default accept policy. What modification should I need to make it working with drop policy firewall ?

Quoted 6 lines

Actually you should not need that '-A INPUT -i eth0 -p icmp -j DROP' rule, as the DROP policy should catch it.
As i've been reading complains about the limit match being broken for years, i suggest trying the 'hashlimit' match (maybe without the --hashlimit-mode option).

Quoted 8 lines

Thanks for your suggestion and hint. Now I have modified the rule set as

` ` `
iptables -A INPUT -p icmp --icmp-type echo-request -m hashlimit \
--hashlimit 3/minute --hashlimit-name secureping -j ACCEPT ` ` `

but no luck yet :-( Is there anything wrong in my config ?

What exactly are the error symptoms? What is not working? Please provide more information like kernel, iptables version. You could place LOG rules and/or TRACE rules to provide more information on what's going on.

Best regards

Mart

author
#5 lore raw
Quoted 8 lines · On Sun, 24 Jan 2010 11:27:27 +0100 Mart Frauenlob <[email protected]>…
Quoted 8 lines

Thanks for your suggestion and hint. Now I have modified the rule set as

` ` `
iptables -A INPUT -p icmp --icmp-type echo-request -m hashlimit \
--hashlimit 3/minute --hashlimit-name secureping -j ACCEPT ` ` `

Quoted 7 lines
Quoted 1 line

but no luck yet :-( Is there anything wrong in my config ?

What exactly are the error symptoms? What is not working? Please provide more information like kernel, iptables version. You could place LOG rules and/or TRACE rules to provide more information on what's going on.

The limit or hashlimit should protect my system by allowing only three ping request per minute ( as -m hashlimit --hashlimit 3/minute or same config by limit) . I saw it working before in debin lenny. I have upgrade my box into debian squeeze now and found the ping protection is not working at all. If I ping my box from outside; my box responds the ping per second !!! So the ping protection is not working any more now :-( Just for reminder my firewall is default DROP and I have already posted iptables-save. Kindly ask me if you need any more information.

kernel version 2.6.31
iptables v1.4.6