All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
To: netfilter <netfilter@vger.kernel.org>
Subject: Re: Cannot get Netfilter to forward to port 80
Date: Mon, 09 Feb 2009 22:58:57 +0100	[thread overview]
Message-ID: <4990A721.80208@plouf.fr.eu.org> (raw)
In-Reply-To: <3803f73b0902091315g2425fa11s7174c4f3ca9d4a39@mail.gmail.com>

Hello,

David Gowdy a écrit :
> I'm using a Linux system running Netfilter a the primary gateway for
> my Internet service.  This includes the use of port forwarding (DNAT)
> for accessing some servers.  Right now the servers include FTP (port
> 21) and HTTP/HTTPS (port 80/443).  It all seems to work nicely with
> one notable exception.  I cannot forward anything to port 80.  I've
> tried using several different external ports (i.e., 21, 60, 81) but
> nothing works. 

(I reordered the rule listing in the order chains are traversed by a 
forwarded packet)

> Chain PREROUTING (policy ACCEPT)
> target     prot opt source               destination
> DNAT       tcp  --  anywhere
> pool-71-163-168-209.washdc.fios.verizon.nettcp dpt:81 to:10.0.0.12:80

So port 81 is DNATed to port 80.

> Chain FORWARD (policy DROP)
> target     prot opt source               destination
[...]
> ACCEPT     tcp  --  anywhere             anywhere           tcp dpt:81
> state NEW,RELATED,ESTABLISHED

The FORWARD chains are traversed after the PREROUTING chains, so the 
port has already been translated and the rule should match the final 
destination port 80, not the original port 81.

Also, for better security the rule should only match the destination 
address 10.0.0.12, not any address.

Finally, the RELATED state is superfluous : an HTTP packet would never 
be in that state.

> ACCEPT     all  --  anywhere             anywhere           state
> RELATED,ESTABLISHED

Note : this rule should be at the beginning of the chain instead of the 
end because it matches most of the traffic.

  reply	other threads:[~2009-02-09 21:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-09 21:15 Cannot get Netfilter to forward to port 80 David Gowdy
2009-02-09 21:58 ` Pascal Hambourg [this message]
2009-02-11 20:56   ` David Gowdy

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=4990A721.80208@plouf.fr.eu.org \
    --to=pascal.mail@plouf.fr.eu.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.