Re: Iptables: port 22 open only for my IP

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

 



--- Khan <gmane@xxxxxxxxxxxx> 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


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux