Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Serge Kosyrev <skosyrev@ptsecurity.ru>
To: netfilter@vger.kernel.org
Subject: DNAT on loopback
Date: Wed, 28 Aug 2013 18:10:23 +0400	[thread overview]
Message-ID: <87vc38taw7.fsf@wintermute.ptsecurity.ru> (raw)

Good day folks!

Is it possible to DNAT locally-originated, locally-destined packets to a
non-local destination?

The use-case is port forwarding to a locally-routed VM guest.
For externally originating access the following is adequate:

iptables -t nat -A PREROUTING -d external.iface.ip -p tcp --dport 80 -j DNAT --to-destination target.ip.add.ress

A logical complement for locally originating accesses would have been:

iptables -t nat -A OUTPUT     -d 127.0.0.0/16      -p tcp --dport 80 -j DNAT --to-destination target.ip.add.ress

..but all I can observe is silent packet disappearance, which I presume
takes place during routing decision-making immediately following the
processing by the OUTPUT chain of the nat table.

So, is it possible at all, or should I go the userspace port forwarding way?


regards,
Samium Gromoff

             reply	other threads:[~2013-08-28 14:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-28 14:10 Serge Kosyrev [this message]
2013-08-31 10:33 ` DNAT on loopback Pascal Hambourg

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=87vc38taw7.fsf@wintermute.ptsecurity.ru \
    --to=skosyrev@ptsecurity.ru \
    --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