[GTER] Auxilio com ip alias + iptables

Fernando Patzlaff patz at patz.inf.br
Thu Jul 5 23:17:36 -03 2007


Testa isto...

iptables -t nat -A PREROUTING -i eth0(interface externa) -p tcp -dport 22 -j
DNAT -to 172.18.0.100:22

-- 
---
Fernando Patzlaff
patz at patz.inf.br
Linux User #197615
http://www.patz.inf.br

On 7/5/07, Leandro Pereira de Lima e Silva <leandro at limaesilva.com.br>
wrote:
>
> Experimenta o SNAT na POSTROUTING, no lugar de na PREROUTING.
>
> []s Leandro
>
> Em 05/07/07, Wagner Rodrigues <wagnerodrigues at gmail.com> escreveu:
> >
> > Leandro,
> > tentei a solução sugerida, mas não tive sucesso.
> >
> > Alguma outra sugestão?
> >
> > atenciosamente
> >
> >
> > Em 05/07/07, Leandro Pereira de Lima e Silva <leandro at limaesilva.com.br>
> > escreveu:
> > >
> > > iptables -t nat -A PREROUTING -p tcp -m tcp -d 200.XXX.XXX.56 --dport
> 22
> > > -j
> > > DNAT --to-destination 172.18.0.100:22
> > >
> > > Pelo que eu entendi, quando o destino for 200.xxx.xxx.56 na porta 22,
> o
> > > destino passa a ser 172.18.0.100 na porta 22.
> > >
> > > No entanto, quando 172.18.0.100:22 responder, ele volta com esse IP.
> > >
> > > Tenta fazer um SNAT pro retorno:
> > > iptables -t nat -A PREROUTING -p tcp -s 172.18.0.100 --sport 22 -j
> SNAT
> > > --to-source 200.xxx.xxx.56:22
> > >
> > > []s Leandro
> > >
> > > Em 05/07/07, Wagner Rodrigues <wagnerodrigues at gmail.com> escreveu:
> > > >
> > > > Inicialmente gostaria de agradecer a atenção de todos.
> > > >
> > > > Christian,
> > > > É mais ou menos isso...
> > > > Bom deixa eu explicar melhor o problema.
> > > > Tenho um firewall com duas placas de rede. Um interna, ligada a duas
> > > VLANS
> > > > e
> > > > uma externa.
> > > > Nessa interface externa terei que ter 8 ips ligados nela. Pra fazer
> > > isso,
> > > > utilizei o comando abaixo relacionado por vc, mas utilizando do mais
> > um
> > > > detalhe no comando, ficando assim:
> > > >
> > > > # ip addr add <ip> brd <ip_broadcast> dev <iface> label <iface>:0
> > > >
> > > > Ficando assim:
> > > > [root at lua network-scripts]# ip addr show
> > > > 3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
> > > qlen
> > > > 1000
> > > >     link/ether 00:01:03:e0:47:06 brd ff:ff:ff:ff:ff:ff
> > > >     inet 200.xxx.xxx.58/27 brd 200.xxx.xxx.63 scope global eth1
> > > >     inet 200.xxx.xxx.56/27 brd 200.xxx.xxx.63 scope global secondary
> > > > eth1:0
> > > >     inet6 fe80::201:3ff:fee0:4706/64 scope link
> > > >        valid_lft forever preferred_lft forever
> > > > 9: eth0.18 at eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> > > noqueue
> > > >     link/ether 00:02:b3:51:58:73 brd ff:ff:ff:ff:ff:ff
> > > >     inet 172.18.0.22/24 brd 172.18.0.255 scope global eth0.18
> > > >     inet6 fe80::202:b3ff:fe51:5873/64 scope link
> > > >        valid_lft forever preferred_lft forever
> > > > 10: eth0.2 at eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> > > noqueue
> > > >     link/ether 00:02:b3:51:58:73 brd ff:ff:ff:ff:ff:ff
> > > >     inet 192.168.0.22/22 brd 192.168.3.255 scope global eth0.2
> > > >     inet6 fe80::202:b3ff:fe51:5873/64 scope link
> > > >        valid_lft forever preferred_lft forever
> > > >
> > > > Depois disso, tentei publicar um serviço de um ip server interno
> > > > utilizando
> > > > o iptables
> > > > iptables -A FORWARD -p tcp -m tcp -d 172.18.0.100 --dport 22 -j
> ACCEPT
> > > > iptables -A FORWARD -p tcp -m tcp -s 172.18.0.100 --dport 22 -j
> ACCEPT
> > > > iptables -t nat -A PREROUTING -p tcp -m tcp -d 200.XXX.XXX.56--dport
> > 22
> > > > -j
> > > > DNAT --to-destination 172.18.0.100:22
> > > >
> > > >
> > > > Mas quando tento um acesso, não tenho resposta nenhuma.
> > > >
> > > > Sei que to errando em alguma coisa, so não consigo saber aonde.
> > > >
> > > > Alguem pode me ajudar??
> > > >
> > > >
> > > > Em 04/07/07, Christian Lyra <lyra at pop-pr.rnp.br> escreveu:
> > > > >
> > > > > On Wednesday 04 July 2007, Lao DanTong wrote:
> > > > > >  On Wed, 4 Jul 2007, Wagner Rodrigues wrote:
> > > > > >  > Pessoal,
> > > > > >  > estou precisando de uma ajuda com umas regras no iptables.
> > > > > >  > Bom, sei que o iptables não trabalha com ip alias, e que a
> > > solução
> > > > > >  > é não colocar a interface na regra de prerouting.
> > > > > >  > Certo, isso ja fiz, mas mesmo assim não funcionou.
> > > > > >  > Ai pesquisei e descobri que tenho que utilizar o iproute2,
> mas
> > > não
> > > > > >  > estou conseguindo.
> > > > > >  > Alguem ai pode me ajudar com isso?
> > > > > >
> > > > > >  explica o que você quer.
> > > > > >
> > > > >
> > > > >        A resposta para o que vc perguntou é:
> > > > >
> > > > >        # ip addr add <ip> dev <iface>
> > > > >
> > > > >        Se isso é o que vc realmente quer, dai são outros 500...
> > > > >
> > > > >
> > > > > --
> > > > > Christian Lyra
> > > > > POP-PR - RNP
> > > > >
> > > > > http://lyra.soueu.com.br
> > > > >
> > > > > ``Without the wind, the grass does not move. Without software,
> > > > > hardware is useless.''
> > > > >                                                The Tao Of
> Programing
> > > > > --
> > > > > gter list    https://eng.registro.br/mailman/listinfo/gter
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Atenciosamente,
> > > >
> > > > Wagner R.
> > > > --
> > > > gter list    https://eng.registro.br/mailman/listinfo/gter
> > > >
> > >
> > >
> > >
> > > --
> > > Leandro Pereira de Lima e Silva
> > > --
> > > gter list    https://eng.registro.br/mailman/listinfo/gter
> > >
> >
> >
> >
> > --
> > Atenciosamente,
> >
> > Wagner R.
> > --
> > gter list    https://eng.registro.br/mailman/listinfo/gter
> >
>
>
>
> --
> Leandro Pereira de Lima e Silva
> --
> gter list    https://eng.registro.br/mailman/listinfo/gter
>



More information about the gter mailing list