Iptables: port 22 open only for my IP
Sasa Stupar
sasa at stupar.homelinux.net
Wed Jun 23 08:29:11 UTC 2004
Khan pravi:
> Hello,
>
> I am total beginner to Linux and I'm trying to learn iptables basics. I
> would like to learn how to close all ports but 80, 20, and that ports 22
> and 10000 will be open only to my IP address.
>
> How can I do that.
>
> TNX!
>
>
Close all ports:
iptables -P INPUT DROP
Just create a chain named "myself":
iptables -N myself
iptables -A myself -m mac -s xxx.xxx.xxx.xxx --mac aa:bb:cc:dd:ee:ff -j
ACCEPT
and then for each port, eg. port 80:
iptables -t filter -A INPUT -p tcp -s 0/0 -d $NET --dport 80 -j myself
--Sasa
More information about the redhat-list
mailing list