Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 9 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
1  
Thanks, I'll never trust shady blogs again! :) –  user12932 Mar 15 '12 at 20:45
add comment

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.

share|improve this answer
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.