Iptables: port 22 open only for my IP

Khan gmane at cis.u7.da.ru
Wed Jun 23 08:37:12 UTC 2004


Khan wrote:
> 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.

OK,

here is what I got so far:

# Accept local (192.168.5.0/24) SSH traffic
$IPT -A INPUT -m state -p tcp --dport 22 ! --state INVALID -s 
192.168.5.0/24 -j ACCEPT
$IPT -A OUTPUT -m state -p tcp --sport 22 --state ESTABLISHED,RELATED -d 
192.168.5.0/24 -j ACCEPT

That will allow all 192.168.5.* addresses to access port 22. How Can I 
have only:

192.168.5.3
and
192.168.5.4

to access my 22 port. Tutorial I used is from:

http://linuxcourse.rutgers.edu/lessons/lecture9.html

TNX





More information about the redhat-list mailing list