On Sat, Oct 02, 2004 at 03:34:42PM +0200, Aritz Beraza Garayalde [Rei] wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Hola a todos. > > Estoy empezando a usar iptables y como todo novato tengo una pequeña duda al > > crear un script usando ip dinámicas. > > Para permitir una conexión externa, veo que puedo hacer: > > > > iptables -A INPUT -s número_ip -p tcp --dport xxx -j ACCEPT > > > > La pregunta es, ¿podría poner en vez del número ip el nombre del dominio?. > > > > Creo que no, has de insertar la ip real.
Extraido de man 8 iptables: "..... -s, --source [!] address[/mask] Source specification. Address can be either a network name, a hostname (please note that specifying any name to be resolved with a remote query such as DNS is a really bad idea), a network IP address (with /mask), or a plain IP address. The mask can be either a network mask or a plain number, specifying the number of 1's at the left side of the network mask. Thus, a mask of 24 is equivalent to 255.255.255.0. A "!" argument before the address specification inverts the sense of the address. The flag --src is an alias for this option. ..." > Si lo dices por que el dominio tiene ip variable (un servidor adsl), > se puede crear un script que actualice la ip de forma adecuada. Algo > así como: > > SERVERIP=`ifconfig eth0|grep "inet addr:"|cut -d":" -f2|cut -d" " -f1` > ... > #ahora todas las normas de iptables > iptables -A INPUT -s $SERVERIP -p tcp --dport xxx -j ACCEPT > ... > > lo haces ejecutable y que se ejecute al arrancar el ordenador, levantando > > Si es la ip de un servidor externo (y tiene toda la pinta por la regla > que has puesto de ejemplo), usa esto: > > SERVERIP=`ping -c 1 www.google.com| grep PING | cut -d"(" -f2|cut -d")" -f1` > > cuidado, este tarda mucho mas, cambia el www.google.com por el dominio > que quieras. > > Espero que te sirva de algo! > > Aritz Beraza [Rei] > -- > Aritz Beraza Garayalde [Rei] > ___________________________________________ > [ WWW ] http://evangelion.homelinux.net > [jabber] [EMAIL PROTECTED] > -- Ricardo A.Frydman Analista de Sistemas de Computación http://www.eureka-linux.com.ar (POR FAVOR! NO envie documentos en formato Word http://breu.bulma.net/?l3192 Gracias!!!)
pgpHYO8q4lJvg.pgp
Description: PGP signature