Re: [.Iptables+DMZ] Ayuda! gran Dolor de cabeza !
El mar, 25-01-2005 a las 11:43 -0300, Maximiliano J. Goldsmid escribió:
> On Wed, 26 Jan 2005 10:36:34 -0300, Nelson Lopez <nlopez@cchen.cl> wrote:
> > Hola amigos;
> >
> > Sistema : Debian Sarge 3.1
> > Kernel : 2.4.27-1-386
> >
> > les escribo este email pidiendo ayuda a ustedes ya que me he quebrado la
> > cabeza ya mas de 3 dias enteros sin descanso ni siquiera colacion =/..
> >
> > les cuento tengo la necesidad de montar en mi trabajo un firewall que
> > proteja mis servidores y mi red interna por ejemplo
> >
> > inet
> > |
> > |
> > eth0 ( ip publica fija )
> > |
> > |
> > -------------
> > | linux box |-------- eth2 ( LAN )------ XXXXX
> > -------------
> > /
> > /
> > eth1 ( dmz )
> > 192.168.10.99/255.255.255.0
> > |
> > |
> > |
> > eth0 ( WWW )
> > 192.168.10.100/255.255.255.0
> >
> > para esto he estado probando muchos scripts y otros que he ido haciendo
> > yo y que no funcionan. *raro* ya que las reglas se ven si hago un
> > *iptables -nvL ó iptables -t nat -nvL*, sinceramente no se que pasa !.
> >
> > pueden echarme una mano amigos ? ó quisas darme alguna guia o algo por
> > el estilo ?.-.
> >
> > aqui pego el ultimo script que estube probando,
> >
> > rei:~# cat dmz_fwl_lan
> > #!/bin/bash
> > ################## Habilitando eht1 ####################
> > puerto_dmz="eth1"
> > ip_dmz="192.168.10.99"
> > ifconfig $puerto_dmz down
> > ifconfig $puerto_dmz $ip_dmz netmask 255.255.255.0 up
> > #ifconfig $puerto_dmz up
> > #########################################################
> > ################## Reglas de Basicas ####################
> > iptables -F
> > #iptables -X
> > iptables -F -t nat
> > #iptables -X -t nat
> > iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE -s 192.168.10.0/24
> > iptables -P FORWARD DROP
> > iptables -A FORWARD -j ACCEPT -p UDP
> > iptables -A FORWARD -j ACCEPT -p ICMP
> > iptables -A FORWARD -mstate --state NEW,ESTABLISH,RELATED -j ACCEPT
> >
> > modprobe ip_nat_irc
> > modprobe ip_nat_ftp
> > modprobe ip_conntrack_ftp
> > modprobe ip_conntrack_irc
> >
> > echo "1" > /proc/sys/net/ipv4/ip_forward
> > #########################################################
> > ################ Servicios ###############################
> > PORT_USR="21 22 25 53 80 110 443 8080"
> > for PORT in $PORT_USR; do
> > iptables -A FORWARD -p tcp --dport $PORT -j ACCEPT
> > done
> > ##########################################################
> > ################ DMZ #####################################
> > IP_EXT="200.72.xxx.yyy"
> > IP_DMZ="192.168.10.100"
> > PORT_DMZ="80 20 21 22 25 110 443 8080"
> > for PORT_DEMEZETA in $PORT_DMZ; do
> > iptables -t nat -A PREROUTING -i eth0 -d $IP_EXT -p TCP --dport
> > $PORT_DEMEZ ETA -j DNAT --to-destination $IP_DMZ
> > done
> >
> Esta regla se crean bien ???
> tenes un espacio entre la Z y la E en $PORT_DEMEZ ETA !!!!
esta bien, seguramente debio ser algun problema al momento de pegar el
codigo :)
>
> > ##########################################################
> > rei :~#
> >
> > Disculpen lo largo de este Email. pero ya me he vuelto loco :(..
> >
> > Nelson Lopez V.
> >
> > --
> > To UNSUBSCRIBE, email to debian-user-spanish-REQUEST@lists.debian.org
> > with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> >
> >
>
> Yo probaria lo siguiente.
> en la parte en donde haces el prerouting, pasale el port, osea
> iptables -t nat -A PREROUTING ........ --to-destination $IP_DMZ:$PORT_DEMEZETA
>
ya lo habia intentado de esa forma sin mayor exito. a lo sumo logro que
me de un mensaje de "Timed Out" en vez de un "Connection Refused by
Host"
> Y fijate con iptables -t nat -nvL aparte si las reglas estan, los pkts
> y bytes de las reglas.... para ver que es lo que esta filtrando y
> dejando pasar, y en la tabla de filter tambien.
>
las salidas que me entrega son estas
rei:~# iptables -nvL
Chain INPUT (policy ACCEPT 2844 packets, 1909K bytes)
pkts bytes target prot opt in out source
destination
Chain FORWARD (policy DROP 0 packets, 0 bytes)
pkts bytes target prot opt in out source
destination
0 0 ACCEPT udp -- * * 0.0.0.0/0
0.0.0.0/0
0 0 ACCEPT icmp -- * * 0.0.0.0/0
0.0.0.0/0
1 60 ACCEPT all -- * * 0.0.0.0/0
0.0.0.0/0 state NEW,RELATED,ESTABLISHED
0 0 ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0 tcp dpt:21
0 0 ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0 tcp dpt:22
0 0 ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0 tcp dpt:25
0 0 ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0 tcp dpt:53
0 0 ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0 tcp dpt:80
0 0 ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0 tcp dpt:110
0 0 ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0 tcp dpt:443
0 0 ACCEPT tcp -- * * 0.0.0.0/0
0.0.0.0/0 tcp dpt:8080
Chain OUTPUT (policy ACCEPT 2480 packets, 277K bytes)
pkts bytes target prot opt in out source
destination
y
rei:~# iptables -nvL -t nat
Chain PREROUTING (policy ACCEPT 608 packets, 31196 bytes)
pkts bytes target prot opt in out source
destination
0 0 DNAT tcp -- eth0 * 0.0.0.0/0
200.72.xxx.yyy tcp dpt:80 to:192.168.10.100:80
0 0 DNAT tcp -- eth0 * 0.0.0.0/0
200.72.xxx.yyy tcp dpt:20 to:192.168.10.100:20
0 0 DNAT tcp -- eth0 * 0.0.0.0/0
200.72.xxx.yyy tcp dpt:21 to:192.168.10.100:21
0 0 DNAT tcp -- eth0 * 0.0.0.0/0
200.72.xxx.yyy tcp dpt:22 to:192.168.10.100:22
0 0 DNAT tcp -- eth0 * 0.0.0.0/0
200.72.xxx.yyy tcp dpt:25 to:192.168.10.100:25
0 0 DNAT tcp -- eth0 * 0.0.0.0/0
200.72.xxx.yyy tcp dpt:110 to:192.168.10.100:110
0 0 DNAT tcp -- eth0 * 0.0.0.0/0
200.72.xxx.yyy tcp dpt:443 to:192.168.10.100:443
0 0 DNAT tcp -- eth0 * 0.0.0.0/0
200.72.xxx.yyy tcp dpt:8080 to:192.168.10.100:8080
Chain POSTROUTING (policy ACCEPT 169 packets, 10284 bytes)
pkts bytes target prot opt in out source
destination
0 0 MASQUERADE all -- * eth0 192.168.10.0/24
0.0.0.0/0
Chain OUTPUT (policy ACCEPT 168 packets, 10224 bytes)
pkts bytes target prot opt in out source
destination
rei:~#
>
> Saludos.
alguna otra idea ?.. te prometo que estoy desesperado ya. =/.
Gracias por tu respuesta :)
Reply to: