Advertisement

06.18.2003 at 04:32AM PDT, ID: 20652062
[x]
Attachment Details

Passive mode on FTP-server behind IPTables with NAT

Asked by yorthen in Linux Network Security

Tags: , , ,

I have the following setup:
One computer running Slackware 9 with IPTables 1.2.7a protecting a small home network with 4 computers on it. One of these computers (192.168.10.2) is running Windows 2003 and an FTP-server (not IIS) hosting two "sites" one on port 1045 and the other on port 2069. But you can't connect to the FTP-server from the internet using passive mode.

I could open up some ports to allow passive FTP to work but I've heard/read somewhere that iptables could open ports for passive ftp on demand. I've tryed using the ip_conntrack_ftp and it gives me the abillity to use passive FTP from clients in the network to servers on the internet but I still can't use passive FTP from the internet to my server.

Is there anyplace where I can get some more information on using ip_conntrack_ftp and ip_nat_ftp?

My firewallscript:
eth0=internet
eth1=network

   # Load modules
   modprobe ip_conntrack_ftp ports=21,1045,2096
   modprobe ip_nat_ftp ports=21,1045,2069

   # Clear
   iptables -F
   iptables -t nat -F

   # NAT
   echo 1 > /proc/sys/net/ipv4/ip_forward
   iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # Starta NAT
   iptables -A OUTPUT -o eth0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT # Allow outgoing connections          <-- Are those lines correct?
   iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT # Allow incomming traffic

   # FTP
   iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1045 -j DNAT --to 192.168.10.2 # FTP 1
   iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 2069 -j DNAT --to 192.168.10.2 # FTP 2

There are some more but it's just forwarding some ports for a number of programs.Start Free Trial
 
Loading Advertisement...
 
[+][-]06.18.2003 at 09:30AM PDT, ID: 8750578

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.18.2003 at 11:37AM PDT, ID: 8751524

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.18.2003 at 11:48AM PDT, ID: 8751640

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Linux Network Security
Tags: ftp, iptables, passive, mode
Sign Up Now!
Solution Provided By: mburdick
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32