Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

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.

share|improve this answer
2  
I still long for the day when SF implements the "long upvote" that is equivalent to two, or maybe 10-15, upvotes. "Text editors" that correct -- to an m-dash are an abomination! –  MadHatter Feb 15 '12 at 23:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.