Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Antony Stone <Antony@Soft-Solutions.co.uk>
To: netfilter@lists.netfilter.org
Subject: Re: How to Forward a port (DNAT) ?
Date: Sat, 10 Jul 2004 22:54:29 +0100	[thread overview]
Message-ID: <200407102254.29715.Antony@Soft-Solutions.co.uk> (raw)
In-Reply-To: <40F0622F.6090500@libertysurf.fr>

On Saturday 10 July 2004 10:39 pm, Frédéric Gonzatti wrote:

> My iptables rules are :
> ##########################################"
> iptables -F
> iptables -X
>
> echo 1 > /proc/sys/net/ipv4/ip_forward
>
> iptables -P INPUT DROP
> iptables -P FORWARD DROP
> iptables -P OUTPUT DROP
>
> iptables -t filter -A INPUT -i lo -j ACCEPT
> iptables -t filter -A OUTPUT -o lo -j ACCEPT
>
> iptables -t nat -A PREROUTING -p tcp --dport 25 -i eth2 -j DNAT --to
> 192.168.2.151:25
>
> #################################################"
>
> It's a very simple test. But unfortunately it doesn't work.

You need a FORWARD rule to allow the packets through the firewall after being 
DNATted - you also need to allow the reply packets.

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -p tcp --dport 25 -d 192.168.2.251 -j ACCEPT

I recommend Oskar Andreasson's tutorial http://iptables-tutorial.frozentux.net 
to you.

Regards,

Antony.

-- 
The lottery is a tax for people who can't do maths.

                                                     Please reply to the list;
                                                           please don't CC me.



  reply	other threads:[~2004-07-10 21:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-10 21:39 How to Forward a port (DNAT) ? Frédéric Gonzatti
2004-07-10 21:54 ` Antony Stone [this message]
2004-07-10 22:02   ` Frédéric Gonzatti

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=200407102254.29715.Antony@Soft-Solutions.co.uk \
    --to=antony@soft-solutions.co.uk \
    --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