From: Gustav Petersson <gustav.petersson@karlskrona.net>
To: markee@bandwidthco.com
Cc: netfilter@lists.netfilter.org
Subject: Re: how do i forward ftp from my firewall to an internal server?
Date: Sun, 29 Feb 2004 20:15:18 +0100 [thread overview]
Message-ID: <40423A46.5070604@karlskrona.net> (raw)
In-Reply-To: <200402291636.i1TGaYBJ018559@server5.bandwidthco.com>
Thanks for your reply Mark.
I should have explained better. I know that ftp uses two ports with a
different setup for active and passive mode. That is not the problem.
Right now I am only DNATing the control port and my INPUT,OUTPUT and
FORWARD chains have a default policy of ACCEPT. The rules I posted are
the _only_ rules I have for my firewall. The problem is that when I
telnet to my $EXTIP port 21 I should get a welcome message and be able
to send some commands but from logging all traffic to and from my
internal ftp server I can see the following traffic:
Client->FTP: SYN
FTP->Client: SYN ACK
Client->FTP: ACK
FTP->Client: ACK PSH
FTP->Client: ACK PSH
FTP->Client: ACK PSH
FTP->Client: ACK PSH
Client->FTP: RST
after this short exchange the connection is terminated. If i telnet to
$EXTIP port 80 and do a 'GET /' everything works fine. I have tried
proftpd, in.ftpd, wu-ftpd and they all give the same result so it's not
a problem with the ftp server software.
Gustav Petersson
Mark E. Donaldson wrote:
>The FTP protocol works completely differently than http, particularly in the
>way connections are negotiated and accepted. You must also account for both
>active and passive modes. I'm assuming the rules you have here are for new
>connections to your FTP server? What are your FTP rules for the FORWARD
>chain?
>
>-----Original Message-----
>From: netfilter-admin@lists.netfilter.org
>[mailto:netfilter-admin@lists.netfilter.org] On Behalf Of Gustav Petersson
>Sent: Saturday, February 28, 2004 12:28 AM
>To: netfilter@lists.netfilter.org
>Subject: how do i forward ftp from my firewall to an internal server?
>
>Like the subject line says.. how do I do it?
>
>I have port http traffic forwarded to the same server but when i use the
>same rule with only the port(s) changed for ftp traffic my ftp server opens
>the connection but immediately closes it again. I have tried running both
>the standard in.ftpd and proftpd. Any help would be greatly appreciated.
>
>Gustav Petersson
>
>I am running debian 3.0 with kernel 2.4.24 and I have the following modules
>loaded:
>
>ipt_LOG
>ipt_state
>iptable_filter
>ip_nat_ftp
>ip_conntrack_ftp
>iptable_nat
>ip_conntrack
>ip_tables
>
>Here is my firewall config:
>#!/bin/sh
>
>EXT_IP=1.2.3.4
>INT_IP=192.168.x.x
>
>modprobe iptable_nat
>modprobe ip_conntrack_ftp
>modprobe ip_nat_ftp
>
>echo "1" > /proc/sys/net/ipv4/ip_forward
>
>iptables -P INPUT ACCEPT
>iptables -F INPUT
>iptables -P OUTPUT ACCEPT
>iptables -F OUTPUT
>iptables -P FORWARD ACCEPT
>iptables -F FORWARD
>iptables -t nat -F
>
># NAT
>iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 213.88.181.68
>
>
>
>
># Forward port 80 to internal server
>iptables -A PREROUTING -t nat -p tcp -d $EXT_IP --dport 80 \
> -j DNAT --to $INT_IP:80
>
># Forward ports 20 and 21 to internal server iptables -A PREROUTING -t nat
>-p tcp -d $EXT_IP --dport 20 \
> -j DNAT --to $INT_IP:20
>
>
>
>iptables -A PREROUTING -t nat -p tcp -d $EXT_IP --dport 21 \
> -j DNAT --to $INT_IP:21
>
>
>
>
>
>
next prev parent reply other threads:[~2004-02-29 19:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-28 8:27 how do i forward ftp from my firewall to an internal server? Gustav Petersson
2004-02-29 16:36 ` Mark E. Donaldson
2004-02-29 19:15 ` Gustav Petersson [this message]
2004-02-29 20:58 ` Mark E. Donaldson
2004-02-29 22:10 ` Gustav Petersson
2004-02-29 23:15 ` Mark E. Donaldson
2004-03-01 0:08 ` Gustav Petersson
2004-03-01 0:47 ` Mark E. Donaldson
2004-02-29 20:16 ` Jeroen Vriesman
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=40423A46.5070604@karlskrona.net \
--to=gustav.petersson@karlskrona.net \
--cc=markee@bandwidthco.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