LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-01-2002, 06:36 PM   #1
JHuizingh
Member
 
Registered: Jun 2001
Distribution: Gentoo 1.4
Posts: 140

Rep: Reputation: 15
FTP Through IPTables


I have a linux box set up to do IP Masquerading using iptables and a pretty simple script I found on the net.

When I try and connect to an ftp host using either a computer behind the IP Masqurading box or the actual box that's doing the masquerading, I can connect and login, but when I try and list a directory it just waits for a long time.

I'm pretty sure this has something to do with the IP Masquerading, but what? And how do I fix it?
 
Old 03-01-2002, 11:32 PM   #2
iamnotherbert
Member
 
Registered: May 2001
Posts: 74

Rep: Reputation: 15
I can try to help..
Couple things come to mind ..

Have you tried PASV?

Do you have the proper kernel modules loaded for ftp?

I belive you need to have the following modules.

ip_conntrack_ftp
ip_nat_ftp
ip_vs_ftp

What does you script look like?

-D
 
Old 03-02-2002, 09:31 PM   #3
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Rep: Reputation: 30
make sure that both port 21 and 20 are being forwarded correctly. from my understanding port 21 does part of the work in ftp (ie login) and 20 does some of the other.
 
Old 03-03-2002, 05:44 AM   #4
Griffon26
Member
 
Registered: Sep 2001
Location: The Netherlands
Distribution: Gentoo, Debian, Mandrake, LFS
Posts: 182

Rep: Reputation: 30
Re: FTP Through IPTables

Quote:
Originally posted by JHuizingh
When I try and connect to an ftp host using either a computer behind the IP Masqurading box or the actual box that's doing the masquerading, I can connect and login, but when I try and list a directory it just waits for a long time.
The fact that it is also a problem when connecting from the box doing the masquerading indicates it's a problem on the other side. The FTP server is behind a firewall and is not configured properly. This means you will have to use PASV (passive) mode.

Passive mode will make sure that any connections made for transfers are initiated by the ftp server and not by your box. Obviously if they are initiated by your box, they bounce off the firewall at the other end and do not reach the FTP server.
 
Old 03-06-2002, 03:14 PM   #5
JHuizingh
Member
 
Registered: Jun 2001
Distribution: Gentoo 1.4
Posts: 140

Original Poster
Rep: Reputation: 15
Sorry it took me so long to respond to your replies, I haven't had much time to work on the computer in the past week. Well, here is what my iptables script looks like:

modprobe ipt_MASQUERADE
modprobe iptable_filter
modprobe ipt_state
iptables -F
iptables -t nat -F
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i ! eth0 -j ACCEPT
iptables -P INPUT DROP

it's pretty much an exact copy of one I found on the net. The modules that I load at the top are the only ones installed, so I'm not using the other ones. What do I have to do to use those too?

Last edited by JHuizingh; 03-06-2002 at 03:15 PM.
 
Old 03-08-2002, 11:37 PM   #6
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Rep: Reputation: 30
I am having somewhat of a similar problem. I am using passive mode and I can connect to the server and do anything I want from anywhere, but the router/firewall box itself. I would really like to be able to do this since I would like to be able to backup my scripts and stuff to my main system from the router.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ftp and iptables eantoranz Linux - Networking 1 07-04-2005 11:24 AM
iptables and ftp metallica1973 Linux - Security 3 04-12-2005 08:37 PM
iptables and ftp ciberrust Linux - Networking 2 11-19-2004 05:05 PM
IPTables and FTP - ftp on LAN adamgedde Linux - Newbie 6 10-16-2003 08:11 PM
ftp and ftp port forwarding with IPtables?? FunkFlex Linux - Security 3 04-24-2002 03:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration