Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Jason Opperisano <opie@817west.com>
To: netfilter@lists.netfilter.org
Subject: Re: nat:REDIRECT on localhost not working in Kernel 2.6
Date: Fri, 19 Nov 2004 12:41:00 -0500	[thread overview]
Message-ID: <20041119174100.GA20905@bender.817west.com> (raw)
In-Reply-To: <200411191836.07261.su@su2.info>

On Fri, Nov 19, 2004 at 06:36:02PM +0100, Stephan Uhlmann wrote:
> Hello netfilter friends,
> 
> I want to redirect all connections going to port 80 of a host to port 8080 of 
> the same host. Of course I do it with the REDIRECT target:
> 
> iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
> iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080
> 
> The redirection of externally incoming connections via PREROUTING  works 
> perfectly fine.
> 
> But I have the problem that locally generated connections are not redirected 
> on machines with Linux Kernel 2.6 but on machines with Linux Kernel 2.4.
> 
> I tested:
> SuSE Linux 9.0 (Kernel 2.4.21, iptables v1.2.8)  - works
> SuSE Linux 9.1 (Kernel 2.6.5,  iptables v1.2.9)  - does not work
> SuSE Linux 9.2 (Kernel 2.6.8,  iptables v1.2.11) - does not work
> Gentoo Linux   (Kernel 2.6.9,  iptables v1.2.11) - does not work
> 
> "iptables -t nat -L -v" shows that no packet at all was catched by the OUTPUT 
> chain. Instead it seems to go to the POSTROUTING chain. But the REDIRECT 
> target can't be used in the POSTROUTING chain.
> 
> Is this a bug? Is this a feature? Did something change between Kernel 2.4 and 
> 2.6 in this regard?
> 
> I looked through the ChangeLogs and other docs but didn't find any hint.

are all kernels in question compiled with:  IP_NF_NAT_LOCAL

-j

--
"Man, you go through life, you try to be nice to people, you struggle
 to resist the urge to punch 'em in the face, and for what?"
        --The Simpsons


  reply	other threads:[~2004-11-19 17:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-19 17:36 nat:REDIRECT on localhost not working in Kernel 2.6 Stephan Uhlmann
2004-11-19 17:41 ` Jason Opperisano [this message]
2004-11-19 17:55   ` Josh Nerius
2004-11-19 17:54     ` Jason Opperisano
2004-11-19 18:03   ` Stephan Uhlmann
2004-11-20 19:55     ` Askar
2004-11-22  3:11   ` Stephan Uhlmann

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=20041119174100.GA20905@bender.817west.com \
    --to=opie@817west.com \
    --cc=netfilter@lists.netfilter.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