I'm trying to write IPtables rules,but I'm finding it difficult.
I've got:
iptables -A FORWARD -m state –state RELATED,ESTABLISHED -j ACCEPT
which fails with Bad argument `–state'
and
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT –to server.ip
which fails with Bad argument `–to'
How do I rectify the rules?
Long form options require two
-
hyphen characters, not one, and it doesn't allow a dash–
. So use--state
instead of-state
. Perhaps your text editor is converting a double--
to a dash–
? Do not use Word, Wordpad, or some other office product for editing, they almost always try to automatically make changes like this for you. Use a text editor like vi, emacs, nano, notepad++/notepad/etc, or anything else designed for scripting or programming.