Iptables: how do I LOG what's not being ACCEPTED and limit what gets logged?

Posted by Kris on Server Fault See other posts from Server Fault or by Kris
Published on 2012-03-25T21:26:36Z Indexed on 2012/03/25 23:32 UTC
Read the original article Hit count: 235

Filed under:
|
|

How do I log what's not being accepted by the following rule:

iptables -A OUTPUT -p icmp --icmp-type 3 -m -limit --limit 10/minute -j ACCEPT

And how do I limit what's being logged because I don't want to log 1000s of pings?

My first thought was:

iptables -A OUTPUT -p icmp --icmp-type 3 -m -limit --limit 50/day -j LOG
iptables -A OUTPUT -p icmp --icmp-type 3 -m -limit --limit 10/minute -j ACCEPT

But that doesn't seem right to me.
I think this limits the logging to 50/day but not necessarily what is not being accepted, or am I wrong?

© Server Fault or respective owner

Related posts about iptables

Related posts about logging