Iptables: port 22 open only for my IP

Manuel Arostegui Ramirez manuaroste at yahoo.es
Wed Jun 23 08:50:00 UTC 2004


--- Khan <gmane at cis.u7.da.ru> escribió: > 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!
First of all, if you watn to reject all connection to
all ports diferents from 80,20, 22 and 10000
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP

This rules won't allow anybody from anywhere to
connect to your machine, now, it's time to open
80,20,22 and 10000 only for your ip, for example,
231.45.134.23

#This will allow 231.45.134.23 to connect ssh port
(22)
iptables -A INPUT -s 231.45.134.23 -p tcp --dport 22
-j ACCEPT
iptables -A OUTPUT -d 231.45.134.23 -p tcp --dport 22
-j ACCEPT

It's the same with the rest ports you want to be open
only from your ip.

Then you must close all privileges ports, 1:1024
iptables -A INPUT -p tcp  --dport 1:1024
iptables -A INPUT -p udp  --dport 1:1024

Best regards

=====
--

Manuel Aróstegui Linux user 200896
http://manuel.todo-linux.com


		
______________________________________________
Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
Nuevos servicios, más seguridad
http://correo.yahoo.es





More information about the redhat-list mailing list