[ale] Using iptables

Jim Popovitch jimpop at yahoo.com
Sun Jun 25 00:23:10 EDT 2006


Terry Bailey wrote:
> I would like to use iptables to restrict all but one IP address to a web 
> server.
> 
> I tried
> 
> 	#/usr/sbin/iptables -t filter -A INPUT -p tcp -s !218.23.45.2 --dport 80 
> -j DROP
> 
> but this is not accepted.
> 
> Any help here would be appreciated.

I've never used "!" in iptables statements, but this should work for you:

iptables -A INPUT -p tcp -s 218.23.45.2 --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 80 -j DROP

hth,

-Jim P.




More information about the Ale mailing list