Muéstranos la regla como las estas colocando ?? Saludos.
Atte Augusto Catalán El 15 de febrero de 2013 15:01, Ing. Ramon Resendiz < rresen...@globaltrack.com.mx> escribió: > Buenas tardes Augusto,**** > > ** ** > > Tienes razón me equivoque al redactar el correo y debe ser “*-A*”. Por > otro lado he realizado los cambios de acuerdo al documento que me envió > Domingo, y el resultado es el mismo, el nat no funciona. Creo estar > haciendo todo de acuerdo al documento tal y cual lo describe paso por paso, > pero me funciona.**** > > ** ** > > Saludos!**** > > RR**** > > ** ** > > *De:* Augusto Catalan [mailto:acatalan2...@gmail.com] > *Enviado el:* viernes, 15 de febrero de 2013 11:42 a.m. > *Para:* centos-es@centos.org > *CC:* rresen...@globaltrack.com.mx > *Asunto:* Re: [CentOS-es] IPTables NAT IP externa a IP interna**** > > ** ** > > Estimado,**** > > ** ** > > El comando que estas utilizando:**** > > *iptables -t nat -D* PREROUTING -i eth0 -p tcp -d X.X.X.237 --dport 25 -j > DNAT --to 192.168.0.134:25**** > > ** ** > > *La opciones -D >>> es para eliminar una regla.***** > > ** ** > > Haz lo que te dice domingo, luego para comprobar que la regla esta > correcta pon lo siguiente:**** > > ** ** > > iptables -t nat -nvL |grep 25**** > > ** ** > > Y te debiese mostrar la regla.**** > > ** ** > > Saludos.**** > > ** ** > > ** ** > > Atte > Augusto Catalán**** > > ** ** > > El 15 de febrero de 2013 14:21, Lic. Domingo Varela Yahuitl < > domin...@linuxsc.net> escribió:**** > > No veo que se haga el nat de la ip externa con terminacion 237 apuntando a > la interna 192.168.0.134 en la salida del las tablas del iptables. ... > > > > *DNAT* > #SMTP**** > > $IPTABLES -A PREROUTING -t nat -i $EXTERNAL -p tcp -d $CORREO --dport 25 \ > -j DNAT --to-destination $CORREO1:25**** > > $IPTABLES -A PREROUTING -t nat -i $EXTERNAL -p udp -d $CORREO --dport 25 \ > **** > > -j DNAT --to-destination $CORREO1:25 > $IPTABLES -A FORWARD -i $EXTERNAL -p tcp -d $CORREO1 --dport 25 -j ACCEPT* > *** > > $IPTABLES -A FORWARD -i $EXTERNAL -p udp -d $CORREO1 --dport 25 -j ACCEPT > > *Donde: * > > IPTABLES=`which iptables` > > EXTERNAL=eth0 > > CORREO=IP_Publica (del segmento 111.222.333.444/27) > CORREO01=Ip Privada de nuestra LAN (Servidor) > > > > 2013/2/15 Ing. Ramon Resendiz <rresen...@globaltrack.com.mx> > > > Domingo te paso los resultados de los comandos:**** > > > > ** ** > > > > arp -n**** > > > > ** ** > > > > [root@mail ~]# arp -n|grep 0.134**** > > > > 192.168.0.134 (incomplete) > > eth1**** > > > > [root@mail ~]# arp -n|grep .233******** > > > > > X.X.X.233 ether 00:17:CB:B9:34:00 C > eth0**** > > > **** > > > > ** ** > > > > Iptables –t nat –L –n –v**** > > > > ** ** > > > > Chain PREROUTING (policy ACCEPT 674K packets, 54M bytes)******** > > > > > pkts bytes target prot opt in out source**** > > > destination******** > > > > > 127 6096 ACCEPT tcp -- * * 0.0.0.0/0**** > > > 201.116.146.185 tcp dpt:80******** > > > > > 202 11464 DNAT tcp -- eth0 * 0.0.0.0/0**** > > > 0.0.0.0/0 tcp dpt:5900 to:192.168.0.55:5900******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 ACCEPT all -- * * 192.168.0.53**** > > > 0.0.0.0/24******** > > > > > 0 0 DNAT tcp -- eth0 * 0.0.0.0/0**** > > > 0.0.0.0/0 tcp dpt:17477 to:192.168.0.97:17477******** > > > > > 0 0 DNAT tcp -- eth0 * 0.0.0.0/0**** > > > 0.0.0.0/0 tcp dpt:20000 to:192.168.0.97:80******** > > > > > 2817 760K DNAT all -- * * 0.0.0.0/0**** > > > X.X.X.235 to:192.168.0.135******** > > > > > 2397 737K DNAT all -- * * 0.0.0.0/0**** > > > X.X.X.234 to:192.168.0.134******** > > > > > 0 0 ACCEPT tcp -- * * 0.0.0.0/0**** > > > X.X.X.234 tcp dpt:80******** > > > > > 0 0 DNAT tcp -- * * 0.0.0.0/0**** > > > X.X.X.235 tcp dpt:769 to:192.168.0.135:769******** > > > > > 0 0 DNAT tcp -- * * 0.0.0.0/0**** > > > X.X.X.235 tcp dpt:80 to:192.168.0.135:80******** > > > > > 0 0 DNAT tcp -- * * 0.0.0.0/0**** > > > X.X.X.234 tcp dpt:80 to:192.168.0.134:80******** > > > > > 0 0 DNAT tcp -- * * 0.0.0.0/0**** > > > X.X.X.235 tcp dpt:26 to:192.168.0.135:26******** > > > > > 0 0 DNAT tcp -- * * 0.0.0.0/0**** > > > X.X.X.234 tcp dpt:26 to:192.168.0.134:26******** > > > > > 0 0 ACCEPT tcp -- * * 0.0.0.0/0**** > > > X.X.X.235 tcp dpt:80******** > > > > > 0 0 ACCEPT tcp -- * * 0.0.0.0/0**** > > > X.X.X.234 tcp dpt:80******** > > > > > 0 0 DNAT tcp -- eth1 * 192.168.0.253**** > > > 0.0.0.0/0 tcp dpt:80 to:209.197.88.118:80******** > > > > > 0 0 DNAT tcp -- eth1 * 192.168.0.218**** > > > 0.0.0.0/0 tcp dpt:80 to:209.197.88.118:80******** > > > > > 0 0 DNAT tcp -- eth1 * 192.168.0.151**** > > > 0.0.0.0/0 tcp dpt:80 to:209.197.88.118:80******** > > > > > 363 17424 DNAT tcp -- eth1 * 192.168.0.139**** > > > 0.0.0.0/0 tcp dpt:80 to:209.197.88.118:80******** > > > > > 50 2400 ACCEPT tcp -- eth1 * 192.168.0.44**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 2252 117K ACCEPT tcp -- eth1 * 192.168.0.55**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 53 2544 ACCEPT tcp -- eth1 * 192.168.0.148**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 20 1040 ACCEPT tcp -- eth1 * 192.168.0.222**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 993 48504 ACCEPT tcp -- eth1 * 192.168.0.38**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 0 0 ACCEPT tcp -- eth1 * 192.168.0.110**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 56 2912 ACCEPT tcp -- eth1 * 192.168.0.6**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 1239 59472 ACCEPT tcp -- eth1 * 192.168.0.53**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 75 3600 ACCEPT tcp -- eth1 * 192.168.0.132**** > > > 0.0.0.0/0 tcp dpt:80******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.53**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 4914 236K REDIRECT tcp -- * * 192.168.0.138**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 18 864 REDIRECT tcp -- * * 192.168.0.111**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 1868 99888 REDIRECT tcp -- * * 192.168.0.80**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 4 256 REDIRECT tcp -- * * 192.168.0.123**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.55**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.132**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.38**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 5925 319K REDIRECT tcp -- * * 192.168.0.239**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 4861 233K REDIRECT tcp -- * * 192.168.0.77**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 0.0.0.0/0**** > > > 0.0.0.0/0 MAC 00:40:CA:6B:DC:C8 tcp dpt:80 redir ports > 3128******** > > > > > 5020 241K REDIRECT tcp -- * * 192.168.0.65**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 1572 101K REDIRECT tcp -- * * 192.168.0.210**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 33 1584 REDIRECT tcp -- * * 192.168.0.76**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 1 48 REDIRECT tcp -- * * 192.168.0.40**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 105 5460 REDIRECT tcp -- * * 192.168.0.96**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.94**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.44**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 7196 345K REDIRECT tcp -- * * 192.168.0.48**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 410 21200 REDIRECT tcp -- * * 192.168.0.189**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 12892 619K REDIRECT tcp -- * * 192.168.0.164**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 124 5952 REDIRECT tcp -- * * 192.168.0.181**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 193 9264 REDIRECT tcp -- * * 192.168.0.206**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 18 864 REDIRECT tcp -- * * 192.168.0.109**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 2164 104K REDIRECT tcp -- * * 192.168.0.141**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 13794 662K REDIRECT tcp -- * * 192.168.0.160**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.61**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.110**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 374 17952 REDIRECT tcp -- * * 192.168.0.203**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.233**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 893 42864 REDIRECT tcp -- * * 192.168.0.62**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 19 912 REDIRECT tcp -- * * 192.168.0.200**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 22 1056 REDIRECT tcp -- * * 192.168.0.179**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 10 480 REDIRECT tcp -- * * 192.168.0.237**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 367 19084 REDIRECT tcp -- * * 192.168.0.64**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128******** > > > > > 0 0 REDIRECT tcp -- * * 192.168.0.148**** > > > 0.0.0.0/0 tcp dpt:80 redir ports 3128**** > > > > ** ** > > > > Chain POSTROUTING (policy ACCEPT 698K packets, 45M bytes)******** > > > > > pkts bytes target prot opt in out source**** > > > destination******** > > > > > 29612 1686K SNAT all -- * eth0 192.168.0.0/24**** > > > 0.0.0.0/0 to:X.X.X.236******** > > > > > 0 0 SNAT all -- * eth0 192.168.3.0/24**** > > > 0.0.0.0/0 to:X.X.X.236******** > > > > > 0 0 SNAT all -- * eth0 192.168.100.0/24**** > > > 0.0.0.0/0 to:X.X.X.236******** > > > > > 0 0 SNAT tcp -- * * 0.0.0.0/0**** > > > 192.168.0.135 tcp dpt:769 to:X.X.X.235******** > > > > > 444 24968 SNAT tcp -- * * 0.0.0.0/0**** > > > 192.168.0.135 tcp dpt:80 to:X.X.X.235******** > > > > > 51 2552 SNAT tcp -- * * 0.0.0.0/0**** > > > 192.168.0.134 tcp dpt:80 to:X.X.X.234******** > > > > > 0 0 SNAT tcp -- * * 0.0.0.0/0**** > > > 192.168.0.135 tcp dpt:26 to:X.X.X.235******** > > > > > 0 0 SNAT tcp -- * * 0.0.0.0/0**** > > > 192.168.0.134 tcp dpt:26 to:X.X.X.234**** > > > > ** ** > > > > Chain OUTPUT (policy ACCEPT 692K packets, 44M bytes)******** > > > > > pkts bytes target prot opt in out source**** > > > destination**** > > > > ** ** > > > > *De:* domin...@linuxsc.net [mailto:domin...@linuxsc.net] > > *Enviado el:* viernes, 15 de febrero de 2013 11:02 a.m. > > *Para:* centos-es@centos.org; centos-es@centos.org; > > rresen...@globaltrack.com.mx > > *Asunto:* RE: [CentOS-es] IPTables NAT IP externa a IP interna**** > > > > ** ****** > > > > > Si ejecutas los comandos arp iptables -t nat -L-n -v ... que resultado* > *** > > > tienes******** > > > > > Best Regards > > Domingo Varela Yahuitl. > > -- > > (http://www.linuxsc.net) > > Sent from my android device SGS 2**** > > > One step ahead.******** > > > > > > > > > -----Original Message----- > > From: "Ing. Ramon Resendiz" <rresen...@globaltrack.com.mx> > > To: domin...@linuxsc.net, centos-es@centos.org, centos-es@centos.org > > Sent: vie, 15 feb 2013 10:58**** > > > Subject: RE: [CentOS-es] IPTables NAT IP externa a IP interna**** > > > > Domingo,**** > > > > ** ****** > > > > > Ya he realizado el cambio con las modificaciones que me pasaste pero el > > resultado es el mismo. El puerto queda cerrado o no esta haciendo**** > > > correctamente el NAT de IP externa a IP interna.**** > > > > ** ** > > > > Saludos!**** > > > > RR**** > > > > ** ** > > > > *De:* domin...@linuxsc.net [mailto:domin...@linuxsc.net< > domin...@linuxsc.net>] > > > > *Enviado el:* viernes, 15 de febrero de 2013 10:41 a.m. > > *Para:* centos-es@centos.org; centos-es@centos.org; > > rresen...@globaltrack.com.mx > > *Asunto:* Re: [CentOS-es] IPTables NAT IP externa a IP interna**** > > > > ** ** > > > > Intenta y modificar si es posible. ..******** > > > > > $IPTABLES -A PREROUTING -t nat -i $EXTERNAL -p tcp -d $CORREO --dport 25 > \**** > > > -j DNAT --to-destination $CORREO1:25**** > > > > $IPTABLES -A FORWARD -i $EXTERNAL -p tcp -d $CORREO1 --dport 25 -j > ACCEPT* > > ******* > > > > > Best Regards > > Domingo Varela Yahuitl. > > -- > > (http://www.linuxsc.net) > > Sent from my android device SGS 2**** > > > One step ahead.******** > > > > > > > > > -----Original Message----- > > From: "Ing. Ramon Resendiz" <rresen...@globaltrack.com.mx> > > To: centos-es@centos.org > > Sent: vie, 15 feb 2013 10:18**** > > > Subject: [CentOS-es] IPTables NAT IP externa a IP interna**** > > > > Buenas tardes compañeros, > > > > > > > > Les expongo el siguiente caso que me ha estado quitando el sueño por > > varios > > días: > > > > > > > > Tengo un equipo Linux CentOS que esta fungiendo como Gateway, a la vez > que > > tiene IP externa (WAN) configuradas en la interface eth0; y además tiene > > IP > > virtuales o IP alias en las interfaces eth0:1, eth0:2 y eth0:3. Además > > tiene > > un IP interna (LAN). > > > > > > > > > > > > eth0 > > > > X.X.X.237 > > > > > > eth0:1 > > > > X.X.X.235 > > > > > > eth0:2 > > > > X.X.X.234 > > > > > > eth0:3 > > > > X.X.X.236 > > > > > > eth1 > > > > 192.168.0.1 > > > > > > > > Lo que requiero es realizer un NAT de la IP X.X.X.237 del puerto SMTP > > (25/TCP) que haga un renvió (forwarding) la IP 192.168.0.134 que > > pertenece a > > la red de la interface eth1. > > > > Estoy ejecutando las siguientes reglas con IPTables: > > > > > > > > iptables -t nat -D PREROUTING -i eth0 -p tcp -d X.X.X.237 --dport 25 -j > > DNAT > > --to 192.168.0.134:25 > > > > iptables -D FORWARD -p tcp -d X.X.X.237 --dport 25 -j ACCEPT > > > > > > > > Al realizar un análisis de trafico de paquetes con tcpdum me topo con lo > > siguiente: > > > > > >**** > > > 10:04:49.798208 <49798208> IP ip.origen.52036 > X.X.X.237.smtp: S > > 640946167:640946167(0) <6409461670>win 8192 <mss 1260,nop,wscale > > 8,nop,nop,sackOK> > > > > 10:04:52.797073 <52797073> IP ip.origen.52036 > X.X.X.237.smtp: S > > 640946167:640946167(0) <6409461670>win 8192 <mss 1260,nop,wscale > > 8,nop,nop,sackOK> > > > > 10:04:58.800293 <58800293> IP ip.origen.52036 > X.X.X.237.smtp: S > > 640946167:640946167(0) <6409461670>win 8192 <mss 1260,nop,nop,sackOK>*** > * > > > > > > > > > Para no hacer tardado esto, el resultado es que al hacer telnet al puerto > > el > > tiempo de espera (timeout) termina cerrando la conexión. > > > > > > > > Alguna idea, sugerencia? > > > > > > > > Saludos! > > > > Ing. Ramón Resendiz > > > > _______________________________________________ > > CentOS-es mailing list > > CentOS-es@centos.org**** > > > http://lists.centos.org/mailman/listinfo/centos-es **** > > > > > > -- > > Saludos cordiales > -- > Lic. Domingo Varela Yahuitl > IT/Specialist -- Linux/Unix/Win > System Administrator and Technical Support > Web Site: http://www.linuxsc.net > Twitter: http://www.twitter.com/linuxsc > > > MSN: domin...@yahoo.com**** > > _______________________________________________ > CentOS-es mailing list > CentOS-es@centos.org > http://lists.centos.org/mailman/listinfo/centos-es**** > > ** ** > _______________________________________________ CentOS-es mailing list CentOS-es@centos.org http://lists.centos.org/mailman/listinfo/centos-es