Re: [.Iptables+DMZ] Ayuda! gran Dolor de cabeza !
El mié, 26-01-2005 a las 10:36 -0300, Nelson Lopez escribió:
>
> 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
> 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
por el esquema que colocas deberia ser la eth1 la interfaz de salida.
SI quieres no especifiques la interfaz para afectar a todos los paquetes
iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -j MASQUERADE
> 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
es innecesario indicar conexiones nuevas, solo decir que aceptas (como
haces nat y tienes el forward en DROP) las conexiones establecidas con:
iptables -A FORWARD -m state --state ESTABLISHED,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
>
> ##########################################################
> rei :~#
>
> Disculpen lo largo de este Email. pero ya me he vuelto loco :(..
>
> Nelson Lopez V.
>
>
>
--
Debian GNU/Linux
Administrador de Sistemas
Mi clave publica gpg la encuentras en:
http://www.cfrd.cl/~mario/pub.gpg
Linux User: 281238
Reply to: