Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Mark Ord <lists@losthorizons.mailshell.com>
To: netfilter@lists.netfilter.org
Subject: Re: iptables local port forwarding
Date: Sun, 4 Apr 2004 21:03:41 +1000	[thread overview]
Message-ID: <20040404110341.GA13605@scholars.home> (raw)
In-Reply-To: <200404031127.02648.Antony@Soft-Solutions.co.uk>

On Sat, Apr 03, 2004 at 11:27:02AM +0100, Antony Stone wrote:

> That rule looks fine to me, and you must obviously have an appropriate INPUT 
> rule allowing the connection to port 80 after the REDIRECT has completed, 
> otherwise you wouldn't be able to connect directly to port 80 which you say 
> works fine.

Correct. I've further confirmed this by adding the rule as the final one
created (hence first in NAT's INPUT table), to isolate the output.
  iptables -I INPUT -j ACCEPT -p tcp --dport 81 -s 192.168.0.1 -d 192.168.0.1

Doing a "iptables -L -t filter -nvx" and "nc -s 192.168.0.1 192.168.0.1"
sees the packet count for that rule increment. IE:
 2028   121680 ACCEPT     tcp  --  * * 192.168.0.1   192.168.0.1  tcp dpt:81

The packets are certainly being accepted.

> The only thing I can think to ask is whether "iptables -L -t nat -nvx" shows 
> the packet/byte counters for this rule incrementing when you do try to access 
> port 81?

They're not. External connections do (elsewhere on the LAN, or from the
internet, but we already know that, as those redirects work), but connections
from the iptables machine never show up in the nat table. All the policies are
ACCEPT, and I've added a logging rule BEFORE the redirect - it appears it just
never gets to the nat table.

Checking out logging, and table listings, I can tell these packets do go
to the mangle table. However, that is a bit beyond me at this point.

Now that I have a bit more of an idea what is going on, I've done
another search, can hit this, which says that this actually isn't
possible, as the PREROUTING table is bypassed on local connections.

http://linux.org.mt/article/tomcat-ports

Thanks for your response,
Mark.
> 
> 


  parent reply	other threads:[~2004-04-04 11:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-03  9:50 iptables local port forwarding Mark Ord
2004-04-03 10:27 ` Antony Stone
2004-04-03 17:30   ` Bill Davidsen
2004-04-03 23:09     ` Antony Stone
2004-04-04 11:03   ` Mark Ord [this message]
2004-04-05 17:44     ` Antony Stone

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=20040404110341.GA13605@scholars.home \
    --to=lists@losthorizons.mailshell.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