|
Linux HowTo's -
Linux Networking HowTo's
|
|
Written by Allen Sanabria
|
|
Sunday, 10 February 2008 18:45 |
|
Welcome again to LinuxDynasty.org. In this quick how to, we are going to show you how to get iptables to log when it drops packets.
-
-
That was basic logging, now we will get into some more options in logging.
- Now lets say you want your logging to be more verbose. In iptables we can fix that by adding this entry in the rule.. --log-level 7. This is the highest level of logging (DEBUG LEVEL).
- Now what if you logs are getting saturated by the second and overwhelming your processor? Well we can add limits also. Here is an example -m limit --limit 2/second --limit-burst 5. This will limit the logging to 2 entries per second and a max of 5 packets per second.
-
So if we put it all together it would look like this..
- iptables -A INPUT -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name ssh_attempt --rsource -j LOG --log-level 7 -m limit --limit 2/second --limit-burst 5 --log-prefix "SSH connection attempt: "
There are a few more options that we can discuss on logging. If anybody wants to see them just leave a comment. If you liked the tutorial also please leave a comment. I will be adding a ULOG howto in the next day or so, which is my preferred way to log in iptables.
|
|
Last Updated ( Wednesday, 14 May 2008 11:52 )
|