Answer the question
In order to leave comments, you need to log in
How to use the "!" in iptables?
man iptables says the following:
A "!" argument before the address specification inverts the sense of the "parameter".
But when I try to write below rule -
iptables -A INPUT -p tcp -s ! 192.168.1.60 --dport 22 -j DROP
when I run the rules, I get the following error -
Bad argument `192.168.1.60'
Could you give me an example or point out where to write the "!" argument so that it is executed?
Answer the question
In order to leave comments, you need to log in
First, "-s ! 192.168.1.60" is stuck in the middle of another construct, don't do it like that.
Correct:
iptables -A INPUT ! -s 192.168.1.60 -p tcp --dport 22 -j DROP
Note that "!" before "-s", not after (it used to be possible, but now it's not).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question