Linux – “Bad argument ‘NEW'” when configuring iptables

iptableslinuxlinux-networking

I am getting the following error when configuring iptables on a Debian 7.6 server to log new TCP connections:

Bad argument `NEW'

Error occurred at line: ##

The line throwing the error is formatted as such:

-A INBOUND-ACCEPT -p tcp -m state --state NEW -j LOG --log-prefix ' NEW INBOUND TCP ' --log-level 4

I am using the 'iptables-restore' command to apply firewall rules from a file. What is the problem with my configuration here? Any assistance is greatly appreciated.

NOTE INBOUND-ACCEPT is a chain I created to facilitate logging for accepted packets. There are a few other similarly formatted lines in the chain for UDP and ICMP logging, but fixing the issue for this rule will allow me to fix the problem for the other lines in my rules file.

Best Answer

Try switching to double quotes instead of single after --log-prefix