Problem setting up ftp server inside lan (iptables)

Problem setting up ftp server inside lan (iptables)

Post by Sa » Wed, 18 Aug 2004 02:38:58



Hi,

I am trying to set up my ftp server located inside my lan.  It thought
everything has been done, but when I try to access the ftp server from
the outside, it fails.

There's got to be something I'm missing here.  Any help would be very
appreciated.

Thanks,

Sam

Here are the rules in iptables:

*********

WAN=$(nvram_get wan_ifname)

IPT=/usr/sbin/iptables

for T in filter nat mangle ; do
  $IPT -t $T -F
  $IPT -t $T -X
done

$IPT -t filter -A INPUT -m state --state INVALID -j DROP
$IPT -t filter -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPT -t filter -A INPUT -p icmp -j ACCEPT
$IPT -t filter -A INPUT -i $WAN -p tcp -j REJECT --reject-with
tcp-reset
$IPT -t filter -A INPUT -i $WAN -j REJECT --reject-with
icmp-port-unreachable
$IPT -t filter -A FORWARD -m state --state INVALID -j DROP
$IPT -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j
ACCEPT
$IPT -t filter -A FORWARD -i $WAN -m state --state NEW,INVALID -j DROP

$IPT -t nat -A POSTROUTING -o $WAN -j MASQUERADE

****

I added the following to redirect port 20 and 21, and 10000-12000
(passive port range)

iptables -t nat -A PREROUTING -p tcp --dport 20 -j DNAT
--to-destination 192.168.1.20:20

iptables -t nat -A PREROUTING -p tcp --dport 21 -j DNAT
--to-destination 192.168.1.20:21

iptables -t nat -A PREROUTING -p tcp --dport 10000:12000 -j DNAT
--to-destination 192.168.1.20

 
 
 

Problem setting up ftp server inside lan (iptables)

Post by vhu » Wed, 18 Aug 2004 06:26:49


( .. snip .. )

Quote:> $IPT -t filter -A FORWARD -m state --state INVALID -j DROP
> $IPT -t filter -A FORWARD -m state --state RELATED,ESTABLISHED -j
> ACCEPT

Add these lines here:

$IPT -t filter -A FORWARD -i $WAN -d 192.168.1.20 -p tcp --dport 21 -j
ACCEPT

Line above is needed as the next rule drops all new connections from WAN
to LAN.

Quote:> $IPT -t filter -A FORWARD -i $WAN -m state --state NEW,INVALID -j DROP


 
 
 

1. FTP client inside linux firewall communicating with FTP server inside another linux firewall

I am trying to use an Windows FTP client (BPFTP) behind a linux
firewall computer running ipchains and ipmasqadm portfw to communicate
with an Windows FTP server (War, G6, ServU) behind another linux
firewall set up more or less the same way. The server is on port 21,
but I have port fowarding on the linux box that redirects port 27015
to port 21 on the internal FTP server. I also forwarded port 20 on the
external firewall to port 20 on the internal computer with the FTP
server. I can communicate with the FTP server from outside the
firewall from an un-firewalled computer, but not using PASV. From the
FTP client inside the linux firewalled LAN I can connect, but do
nothing else. I'm sure someone in this group is very familiar with
this issue and can help me.

Any help will be appreciated. Thanks.

2. Problem with X server

3. ftp forwarding to inside lan

4. Dialing into my Linux box

5. Yet another pf question (FTP inside LAN)

6. compile new module

7. Very Slow FTP on Local LAN Linux server/masquerading box, but internet FTP is fine.

8. Heeeeeelp with Samba and Win 95 Client !!!!!!!

9. HELP: Can reach http server from outside but not from inside LAN...

10. ftp server iptables rules for passive ftp

11. ftp problem LAN behind NAT/fierwall to LAN

12. pb setting up iptables for redirecting incoming UDP packets to LAN (voip)

13. Shape Ups,Men's Shape Ups,Men's Skechers Shape Ups - new styles!