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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/14/2011 07:48 AM, Jatin K wrote:
> 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 ?

The exclamation point needs to be followed by white space to keep the shell
from trying to interpret it.  The recommended syntax is to put the '!'
_before_ the option flag:

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

-- 
Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.

-- 
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux