iptables: add new chains to log drop/accept messages








To create the chains to log&drop or log&accept:
# Create LOGDROP chain
/sbin/iptables -N LOGDROP
/sbin/iptables -A LOGDROP -m limit --limit 5/m --limit-burst 7 -j LOG --log-level 4 --log-prefix "[IPTFW DROP] "
/sbin/iptables -A LOGDROP -j DROP

# Create LOGACCEPT chain
/sbin/iptables -N LOGACCEPT
/sbin/iptables -A LOGACCEPT -m limit --limit 5/m --limit-burst 7 -j LOG --log-level 6 --log-prefix "[IPTFW ACCEPT] "
/sbin/iptables -A LOGACCEPT -j ACCEPT

To log & drop, here is an example:
/sbin/iptables -A INPUT -s 111.112.113.114 -j LOGDROP

To log & accept, here is the example:
/sbin/iptables -A INPUT -s 111.112.113.115 -j LOGACCEPT

SEE ALSO:




No comments:

Post a Comment