Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Richard Horton <richard.horton@solstans.co.uk>
To: codingfreak <adapa.ajith@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: IPtables and SNAT
Date: Tue, 27 Oct 2009 09:03:08 +0000	[thread overview]
Message-ID: <56378e320910270203i5ab08ec3gd48d1283b4f37bac@mail.gmail.com> (raw)
In-Reply-To: <ee114c7a-303d-4776-8562-314387348ec8@g1g2000pra.googlegroups.com>

>    $IPTABLES -t mangle -A PREROUTING -p tcp --dport 21 -s 192.x.y.a -
> j ACCEPT
>    $IPTABLES -t mangle -A FORWARD -p tcp --dport 21 -s 192.x.y.a -m
> conntrack --ctstate NEW,ESTABLISHED,RELATED -j ACCEPT
>    $IPTABLES -t nat -A POSTROUTING -s 192.x.y.a -p tcp --dport 21 -j
> SNAT --to-source 194.160.1.1
>


First thing to bear in mind: The mangle table is purely for packet
manipulation actions and should not be used for filtering. Move the
two accept rules into the filter table (just omit the -t mangle
parameter).

Port 21 is only the ftp control port - data uses port 20.

If you have the ftp helper try
$IPTABLES -t nat -A POSTROUTING -s 192.x.y.a -m helper --helper ftp -j
SNAT --to-source 194.160.1.1








--
Richard Horton
Users are like a virus: Each causing a thousand tiny crises until the
host finally dies.
http://www.solstans.co.uk - Solstans Japanese Bobtails and Norwegian Forest Cats
http://www.pbase.com/arimus - My online photogallery

  reply	other threads:[~2009-10-27  9:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <95ac437a-3f19-490a-80d0-3ce0a20850ed@y10g2000prg.googlegroups.com>
     [not found] ` <46ee7b1c0910212155pd99519cw9831d4bb7d7f3064@mail.gmail.com>
     [not found]   ` <b8dec168-132d-4fba-9d09-fbb5554c339d@m7g2000prd.googlegroups.com>
2009-10-27  5:08     ` IPtables and SNAT codingfreak
2009-10-27  9:03       ` Richard Horton [this message]
     [not found]         ` <5f765be60910270345w5ec689f5r8cdddb0b34b5e9e0@mail.gmail.com>
2009-10-27 10:55           ` Fwd: " Ajith Adapa
     [not found] <200402171428.52966.mark@vevers.net>
2004-02-17 14:39 ` Iptables " Jan Kaastrup
2004-02-17  6:55 Iptables and bridge Stephen Satchell
2004-02-17 10:18 ` Iptables and SNAT Jan Kaastrup
2004-02-17 10:57   ` Mark Vevers

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=56378e320910270203i5ab08ec3gd48d1283b4f37bac@mail.gmail.com \
    --to=richard.horton@solstans.co.uk \
    --cc=adapa.ajith@gmail.com \
    --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