how to specify IP not equal to in iptables rules ????

Jatin K ssh.fedora at gmail.com
Thu Jul 14 12:48:12 UTC 2011


Dear All Gurus,

I want to deny a particular IP (172.16.158.111) address in my network to 
FTP on server (RHEL6), I'm trying to add the following[1][2] iptabls 
rules on server  and getting error [3]


  [1] iptables -A INPUT -s! 172.16.158.111 -p tcp --dport 21 -j DROP
  [2] iptables -A INPUT -s! 172.16.158.111 -p tcp --dport 20 -j DROP

[3]  Using intrapositioned negation (`--option ! this`) is deprecated in 
favor of extrapositioned (`! --option this`).


if I try following [4]  it throws error like " bash: !172: event not 
found " (I think it tries to recall a command from history ..may be not 
sure )

[4] iptables -A INPUT -s !172.16.158.111 -p tcp --dport 21 -j DROP


So how to go ...??? and any one guide to the right direction ????? how 
do I add a rule  like IP or the PORTs is not equal to ?


Warm Regards

   °v°
  /(_)\
   ^ ^  Jatin Khatri
Registerd Linux user No #501175
www.counter.li.org
No M$



More information about the users mailing list