Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've seen people use the exclamation mark (!) in multiple examples, but when I try to use it I get an error.

The rule I'm trying:

-A OUTPUT -m owner --gid-owner 1006 -d ! 192.168.1.0/24 -j DROP

The error:

Bad argument '192.168.1.0/24'

What is the correct syntax for this?

share|improve this question
up vote 17 down vote accepted

Just as the manpage states:

[!] -d, --destination address[/mask][,...]
       Destination  specification.   See  the  description  of  the  -s
       (source)  flag  for  a  detailed description of the syntax.  The
       flag --dst is an alias for this option.

That makes it

! -d 192.168.1.0/24
share|improve this answer
2  
Thanks, I'll never trust shady blogs again! :) – user12932 Mar 15 '12 at 20:45
    
It has nothing to do with shady blogs, the syntax has changed for iptables and the exclamation mark went before the flag at some point. – Martin Jan 2 '13 at 13:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .