Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Irmãos Bocchi & CIA Ltda" <challado@ibocchi.com.br>
To: netfilter@vger.kernel.org
Subject: DNAT iptables bug or connection tracking issue?
Date: Fri, 23 May 2008 11:17:44 -0300	[thread overview]
Message-ID: <4836D208.9040808@ibocchi.com.br> (raw)

Dear friends

I have a question, and I need your help to solve.

1) I have two routers in two different networks: one is a FreeBSD 7.0 
router, here called "Router A" and another is a Debian 4.0 router, here 
called "Router B"
2) The Router A uses pf to make the firewall rules, with standard 
installation. The Router B have the kernel 2.6.25.4 and iptables 1.4.0
3) In the first router, I have a rule to access my vnc server in a 
windows machine. To make these, I need to create this rule
rdr on sk0 proto tcp from any to <my external addr> port 5900 -> <my 
internal addr> port 5900
nat on sk0 proto tcp from <my internal addr> port 5900 to any -> sk0

In resume: I need to create a rule to make the redirection and, after 
these, I need to insert a rule to make the nat

4) In the second router, only adding this rule
iptables -t nat -I PREROUTING -i eth0 -p tcp --dport 5900 -j DNAT 
--to-destination <my internal addr> port 5900

THE RULES WORK PERFECTLY!

It's a bug? Because, in my vision, I need to create the two rules, the 
DNAT rule and the MASQUERADE rule to these work.
Another point of view: If I need to permit only the machines A, B and C 
to access the VNC, in BSD, I only need to create these rules

my_servers="{ server_a_addr, server_b_addr, server_c_addr }"
rdr on sk0 proto tcp from any to <my external addr> port 5900 -> <my 
internal addr> port 5900
nat on sk0 proto tcp from <my internal addr> port 5900 to $my_servers -> sk0

or

rdr on sk0 proto tcp from $my_servers to <my external addr> port 5900 -> 
<my internal addr> port 5900
nat on sk0 proto tcp from <my internal addr> port 5900 to any -> sk0

How I can make these in iptables?

Thanks for your answer

-- 
+------------------------------------------
| Att                                      
| Lucas Willian Bocchi
| Departamento de Tecnologia da Informação
| Setor de Redes, Suporte e Desenvolvimento
| Irmãos Bocchi & CIA Ltda
+-------------------------------------------



------------------------------------------------
Os e-mails enviados por este domínio são verificados
por sistemas antivírus e antispam, visando a proteção
dos usuários e dos equipamentos de nossa empresa, bem como
para proteger o conteúdo e o trabalho de outros que
por ventura venham receber e-mails deste domínio.

O Grupo Bocchi se reserva no direito de, a qualquer
momento, bloquear ou inutilizar conteúdo de e-mails
que venham a ser prejudiciais para o ambiente de trabalho.

Caso este e-mail não possua conteúdo que seja relevante
à sua atividade profissional, ou a do usuário que a enviou,
por favor, delete-o imediatamente.

O Grupo Bocchi não se responsabiliza por qualquer dano 
ou prejuízo que a utilização indevida deste e-mail
possa causar a você ou sua empresa.

Em caso de dúvidas, favor entrar em contato.
---------------------------------------------


Grupo Irmãos Bocchi & Cia Ltda

http://www.ibocchi.com.br


             reply	other threads:[~2008-05-23 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-23 14:17 Irmãos Bocchi & CIA Ltda [this message]
2008-05-23 22:44 ` DNAT iptables bug or connection tracking issue? Josh Cepek
  -- strict thread matches above, loose matches on Subject: below --
2008-05-24 14:52 challado

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4836D208.9040808@ibocchi.com.br \
    --to=challado@ibocchi.com.br \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox