I'm having difficulty getting iptables to log. Here are the relevant commands:
/usr/sbin/iptables -N LOG_DROP
/usr/sbin/iptables -A LOG_DROP -m limit --limit 2/min -j LOG --log-prefix "iptables drop: " --log-level 7
/usr/sbin/iptables -A LOG_DROP -j DROP
Entering these commands, results in:
iptables v1.4.21: unknown option "–log-prefix"
I believe the following modules are important, so they're active in my kernel:
`nf_log_common
nf_log_ipv4
nf_log_ipv6`
Any suggestions for solving this problem?
Best Answer
I had to run all commands with root privileges (
sudo
). Obviously iptables command executed by user didn't know about the channel created by root.