Networking Forums

Networking Forums > Computer Networking > Linux Networking > Iptables creates ftp problem

Reply
Thread Tools Display Modes

Iptables creates ftp problem

 
 
B H
Guest
Posts: n/a

 
      12-15-2004, 08:09 AM
I've had some ftp-problems with my Linux-box (fedora core 3) when
connecting to a Windows ftp server at my isp which requires active
mode. The ftp session freezez after loging when I try to do e.g. a LIST
command.
I have had some problems identifying the source of the error, but last
night I shut off the local firewall by using "iptables stop" command.
After this I could ftp without problems.

My Linux-box is behind a router with firewall. The router is doing local
DHCP. Maybe this could be the source of my problem? I have another
Windows XP box on the same LAN, and it can ftp to the same server
without problems (both pc's are set to active mode so this is not the
problem).
So there must be some problems with my iptables settings. Any experts
out there that can shed some lights on the possible problem? See below.

===== "Iptables -L" as root ==============
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp any
ACCEPT ipv6-crypt-- anywhere anywhere
ACCEPT ipv6-auth-- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:5353
ACCEPT udp -- anywhere anywhere udp dpt:ipp
ACCEPT all -- anywhere anywhere state
RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp
dpt:ftp
ACCEPT tcp -- anywhere anywhere state NEW tcp
dpt:ssh
REJECT all -- anywhere anywhere reject-with
icmp-host-prohibited

===============================
Borge


 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      12-15-2004, 09:53 AM
On 2004-12-15, B H <(E-Mail Removed)> wrote:
> connecting to a Windows ftp server at my isp which requires active
> mode.


To enable Active mode you need to open the ftp-data port and
something more. There are some example in the iptable-howto.

Davide

--
Life is like sendmail: It's complicated and hard to understand, but it
sure beats the alternative. -- Paul Tomblin
 
Reply With Quote
 
B H
Guest
Posts: n/a

 
      12-15-2004, 10:11 AM

"Davide Bianchi" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) .net...
> On 2004-12-15, B H <(E-Mail Removed)> wrote:
> > connecting to a Windows ftp server at my isp which requires active
> > mode.

>
> To enable Active mode you need to open the ftp-data port and
> something more. There are some example in the iptable-howto.


iptable-howto? are you talking about iptables man pages?

Borge


 
Reply With Quote
 
Robert Nichols
Guest
Posts: n/a

 
      12-15-2004, 12:47 PM
In article <fbTvd.57$(E-Mail Removed)>,
B H <(E-Mail Removed)> wrote:
:I've had some ftp-problems with my Linux-box (fedora core 3) when
:connecting to a Windows ftp server at my isp which requires active
:mode. The ftp session freezez after loging when I try to do e.g. a LIST
:command.
:I have had some problems identifying the source of the error, but last
:night I shut off the local firewall by using "iptables stop" command.
:After this I could ftp without problems.
:
:My Linux-box is behind a router with firewall. The router is doing local
HCP. Maybe this could be the source of my problem? I have another
:Windows XP box on the same LAN, and it can ftp to the same server
:without problems (both pc's are set to active mode so this is not the
roblem).
:So there must be some problems with my iptables settings. Any experts
ut there that can shed some lights on the possible problem? See below.
[SNIPPED]

FTP is a complex protocol that involves opening a separate connection
for the data transfer. An FTP client running in active mode instructs
the server to open a data connection back to a port number selected by
the client. If you're not running a connection tracking module that
knows how to peek inside the FTP control packets and identify that port,
the server's connection attempt will be rejected by your firewall.

Your options are:

a) tell your FTP client to use passive mode, which causes the
client, not the server, to open the data connection,

or b) load the kernel's ip_conntrack_ftp module so that the server's
data connection can be recognized as RELATED.

I highly recommend that you take a look at Oskar Andreasson's excellent
_Iptables_Tutorial_, which is available in several forms from

http://iptables-tutorial.frozentux.net/

--
Bob Nichols AT comcast.net I am "rnichols42"
 
Reply With Quote
 
B H
Guest
Posts: n/a

 
      12-15-2004, 12:57 PM

"Robert Nichols" <(E-Mail Removed)> wrote in
message news:cppfaf$oso$(E-Mail Removed)...
> Your options are:
>
> a) tell your FTP client to use passive mode, which causes the
> client, not the server, to open the data connection,


In my case this is not an option since I only need access to one
particular ftp-server, and the one in question requires active mode.

> or b) load the kernel's ip_conntrack_ftp module so that the server's
> data connection can be recognized as RELATED.


I did not understand this, but hope that the _Iptables_Tutorial_ mentioned
below might answer this.

> I highly recommend that you take a look at Oskar Andreasson's excellent
> _Iptables_Tutorial_, which is available in several forms from
>
> http://iptables-tutorial.frozentux.net/
>


Thanks!

Borge


 
Reply With Quote
 
Tommy Reynolds
Guest
Posts: n/a

 
      12-15-2004, 03:07 PM
On Wed, 15 Dec 2004 10:09:31 +0100, B H wrote:

> Chain RH-Firewall-1-INPUT (2 references)
> target prot opt source destination
> ACCEPT all -- anywhere anywhere
> ACCEPT icmp -- anywhere anywhere icmp any


Your very first rule here (ACCEPT all -- anywhere anywhere) seems to make
all succeeding rules irrelevant since ACCEPT identifies a terminal rule.

Please post your rules without editing.

Cheers!
 
Reply With Quote
 
Juha Laiho
Guest
Posts: n/a

 
      12-15-2004, 03:55 PM
"B H" <(E-Mail Removed)> said:
>I've had some ftp-problems with my Linux-box (fedora core 3) when
>connecting to a Windows ftp server at my isp which requires active
>mode. The ftp session freezez after loging when I try to do e.g. a LIST
>command.


You got the correct answer already - namely that you'll need to load
the ip_conntrack_ftp module and allow RELATED inbound traffic.
Or alternatively use passive ftp (how to do this depends on your
ftp client program).

>===== "Iptables -L" as root ==============


Sorry, "iptables -L" is leaving out some of the needed information
(which pretty badly corrupts some of the rules). Use "iptables -vL"
instead.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)
 
Reply With Quote
 
Robert Nichols
Guest
Posts: n/a

 
      12-15-2004, 11:58 PM
In article <6pXvd.98$(E-Mail Removed)>,
B H <(E-Mail Removed)> wrote:
:
:"Robert Nichols" <(E-Mail Removed)> wrote in
:message news:cppfaf$oso$(E-Mail Removed)...
:> Your options are:
:>
:> a) tell your FTP client to use passive mode, which causes the
:> client, not the server, to open the data connection,
:
:In my case this is not an option since I only need access to one
articular ftp-server, and the one in question requires active mode.
:
:> or b) load the kernel's ip_conntrack_ftp module so that the server's
:> data connection can be recognized as RELATED.
:
:I did not understand this, but hope that the _Iptables_Tutorial_ mentioned
:below might answer this.
:
:> I highly recommend that you take a look at Oskar Andreasson's excellent
:> _Iptables_Tutorial_, which is available in several forms from
:>
:> http://iptables-tutorial.frozentux.net/

The magic incantation needed is to issue the following command (as root):

modprobe ip_conntrack_ftp

You can add an "install" line in your /etc/modprobe.conf (assuming your
system uses that) to make that happen automatically when the system
boots. See `man modprobe.conf` for details.

--
Bob Nichols AT comcast.net I am "rnichols42"

 
Reply With Quote
 
Antoine EMERIT
Guest
Posts: n/a

 
      12-21-2004, 11:41 PM
"B H" <(E-Mail Removed)> wrote news:GZUvd.73$(E-Mail Removed):
> iptable-howto? are you talking about iptables man pages?


HOWTO documenation are at http://www.tldp.org (search for the 'full
index').

Concerning FTP, did you load the ip_conntrack_ftp & ip_nat_ftp modules ?
(insmod <module>) ? and what are uyour iptables rules ? (iptables -L -vn)


Regards
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AT&T creates its own browser DTC Wireless Internet 0 04-20-2008 07:22 AM
iptables ftp problem johnny bobby bee Linux Networking 7 05-13-2005 10:30 AM
Iptables & DCC Problem Imitheos Linux Networking 1 09-06-2004 03:34 PM
Swapping PC cards in slots creates new devices nil spam Home Networking 0 01-08-2004 02:01 PM
Iptables problem Doug McComber Linux Networking 0 07-31-2003 06:43 PM



1 2 3 4 5 6 7 8 9 10 11