(no subject)
Hi,
I have configured our firewall using IPtables. The configuration of the firewall is as follows... Firewall host has 3 interfaces one for DMZ, one for LAN and one for external world(internet). All of our servers have a static IP address. Our FTP server is wu-ftpd
Now there is no problem in accessing our DNS, WEB, SMTP and IMAP servers from outside. But the FTP server is showing some strange problem. When our client tries to do a 'ls' in FTP session it is shows the following error message.
ftp> ls
200 PORT command successful.
425 Can't build data connection: Connection timed out. ftp> bye
But if I try the same thing from outside using a dialup connection all works fine for me!!!!
when some one tries do a 'ls' from internal LAN on our FTP server then the following message is displayed. ftp> ls
500 Illegal PORT Command
425 Can't build data connection: Connection timed out.
ftp>
Our rules related to FTP server are...
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $LO_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $LAN_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $INET_IP -j ACCEPT
$IPTABLES -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_FTP_IP --dport ftp -j allowed $IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_FTP_IP --dport ftp-data -j allowed
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $FTP_IP --dport ftp -j DNAT --to-destination $DMZ_FTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $FTP_IP --dport ftp-data -j DNAT --to-destination $DMZ_FTP_IP
$IPTABLES -t nat -A POSTROUTING -p TCP -s $LAN_IP_RANGE -j SNAT --to-source $DMZ_NAT
whereDMZ_FTP_IP is IP address of ftp server in DMZDMZ_IP is global IP address of ftp server.INET_IFACE is Internet interface on firewallDMZ_IFACE is DMZ interface on firewall.LAN_IP_RANGE is Lan ip range.
Can anyone help me?
Thanks and Regards
Durgaprasada
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Hi,
try to load following kernel modules:
ip_conntrack.o
ip_conntrack_ftp.o
ip_nat_ftp.o
This should solve your problems.
Marcello
Il gio, 2002-12-19 alle 08:33, Durgaprasada Kalluraya ha scritto:
Quoted 71 lines
Hi,
I have configured our firewall using IPtables. The configuration of the firewall is as follows...
Firewall host has 3 interfaces one for DMZ, one for LAN and one for external world(internet). All of our servers have a
static IP address. Our FTP server is wu-ftpdNow there is no problem in accessing our DNS, WEB, SMTP and IMAP servers from outside. But the FTP server is
showing some strange problem. When our client tries to do a 'ls' in FTP session it is shows the following error message.ftp> ls
200 PORT command successful.
425 Can't build data connection: Connection timed out. ftp> byeBut if I try the same thing from outside using a dialup connection all works fine for me!!!!
when some one tries do a 'ls' from internal LAN on our FTP server then the following message is displayed.
ftp> ls
500 Illegal PORT Command
425 Can't build data connection: Connection timed out.
ftp>Our rules related to FTP server are...
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT$IPTABLES -A OUTPUT -p ALL -s $LO_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $LAN_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $INET_IP -j ACCEPT
$IPTABLES -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT$IPTABLES -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j
ACCEPT
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_FTP_IP --dport ftp -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_FTP_IP --dport ftp-data -j
allowed
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $FTP_IP --dport ftp -j DNAT --to-destination
$DMZ_FTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $FTP_IP --dport ftp-data -j DNAT
--to-destination $DMZ_FTP_IP
$IPTABLES -t nat -A POSTROUTING -p TCP -s $LAN_IP_RANGE -j SNAT --to-source $DMZ_NATwhere
DMZ_FTP_IPis IP address of ftp server in DMZDMZ_IPis global IP address of ftp server.INET_IFACEis Internet interface on firewallDMZ_IFACEis DMZ interface on firewall.LAN_IP_RANGEis Lan ip range.Can anyone help me?
Thanks and Regards
Durgaprasada_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Signature · 1 line
Marcello Scacchetti <[email protected]>
Hi Durgaprasada,
You will need to use "modprobe" or "insmod" to load the modules & "lsmod" if you want to verify that the modules have been loaded.
Ranjeet Shetye
Senior Software Engineer
Zultys Technologies
771 Vaqueros Avenue
Sunnyvale CA 94085
USA
[email protected]
http://www.zultys.com/
Quoted 108 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Marcello Scacchetti
Sent: Monday, December 23, 2002 8:21 AM
To: Durgaprasada Kalluraya
Cc: [email protected]
Subject: Re: (no subject)Hi,
try to load following kernel modules:
ip_conntrack.o
ip_conntrack_ftp.o
ip_nat_ftp.o
This should solve your problems.Marcello
Il gio, 2002-12-19 alle 08:33, Durgaprasada Kalluraya ha scritto:
Quoted 6 lines
Hi,
I have configured our firewall using IPtables. The configuration of the
firewall is as follows...
Firewall host has 3 interfaces one for DMZ, one for LAN andone for external
Quoted 7 lines
world(internet). All of our servers have a static IP address. Our FTP server is wu-ftpd
Now there is no problem in accessing our DNS, WEB, SMTP and IMAP servers
from outside. But the FTP server is
showing some strange problem. When our client tries to do a'ls' in FTP
Quoted 8 lines
session it is shows the following error message.
ftp> ls
200 PORT command successful.
425 Can't build data connection: Connection timed out. ftp> byeBut if I try the same thing from outside using a dialup
connection all
Quoted 4 lines
works
fine for me!!!!when some one tries do a 'ls' from internal LAN on our FTP
server then
Quoted 9 lines
the
following message is displayed.
ftp> ls
500 Illegal PORT Command
425 Can't build data connection: Connection timed out. ftp>Our rules related to FTP server are...
Quoted 7 lines
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT$IPTABLES -A OUTPUT -p ALL -s $LO_IP -j ACCEPT $IPTABLES -A OUTPUT -p ALL -s $LAN_IP -j ACCEPT $IPTABLES -A OUTPUT -p ALL -s $INET_IP -j ACCEPT $IPTABLES -A OUTPUT -m state --state
NEW,ESTABLISHED,RELATED -j ACCEPT
Quoted 6 lines
$IPTABLES -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j
ACCEPT
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d$DMZ_FTP_IP
Quoted 2 lines
--dport ftp -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d$DMZ_FTP_IP
Quoted 3 lines
--dport ftp-data -j
allowed
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d$FTP_IP --dport ftp
Quoted 3 lines
-j DNAT --to-destination
$DMZ_FTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d$FTP_IP --dport
Quoted 3 lines
ftp-data -j DNAT
--to-destination $DMZ_FTP_IP
$IPTABLES -t nat -A POSTROUTING -p TCP -s $LAN_IP_RANGE -jSNAT --to-source
Quoted 17 lines
$DMZ_NAT
where
DMZ_FTP_IPis IP address of ftp server in DMZDMZ_IPis global IP address of ftp server.INET_IFACEis Internet interface on firewallDMZ_IFACEis DMZ interface on firewall.LAN_IP_RANGEis Lan ip range.Can anyone help me?
Thanks and Regards
Durgaprasada_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963Signature · 1 line
Marcello Scacchetti <[email protected]>
Hi Durgaprasad,
This same thing had happended with me.... As per my understanding goes you are doing an active ftp transfer..... Try doing the following in your ftp client.....
bash#ftp
ftp>open <host>
..
..(authentication stuff)
..
..(after successful authentication)
ftp>passive
..
ftp>
This makes the transfer mode in passive mode.
Hope this works... and let us know the respective results(desired or not).
Bye,
Narendra.
In the middle of difficulty..... lies Opportunity. (Albert Einstein)
--------------------------------------------------------------------
Narendra Prabhu. B Free Software at its product-ive best.
DeepRoot Linux http://www.deeproot.co.in
---- Server Appliances ----
---- Linux Support and Services ----
-------------------------------------------------------------------
Quoted 76 lines · Durgaprasada Kalluraya
Hi,
I have configured our firewall using IPtables. The configuration of the firewall is as follows...
Firewall host has 3 interfaces one for DMZ, one for LAN and one for external world(internet). All of our servers have a
static IP address. Our FTP server is wu-ftpdNow there is no problem in accessing our DNS, WEB, SMTP and IMAP servers from outside. But the FTP server is
showing some strange problem. When our client tries to do a 'ls' in FTP session it is shows the following error message.ftp> ls
200 PORT command successful.
425 Can't build data connection: Connection timed out. ftp> byeBut if I try the same thing from outside using a dialup connection all works fine for me!!!!
when some one tries do a 'ls' from internal LAN on our FTP server then the following message is displayed.
ftp> ls
500 Illegal PORT Command
425 Can't build data connection: Connection timed out.
ftp>Our rules related to FTP server are...
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT$IPTABLES -A OUTPUT -p ALL -s $LO_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $LAN_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $INET_IP -j ACCEPT
$IPTABLES -A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT$IPTABLES -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j
ACCEPT
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_FTP_IP --dport ftp -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_FTP_IP --dport ftp-data -j
allowed
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $FTP_IP --dport ftp -j DNAT --to-destination
$DMZ_FTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $FTP_IP --dport ftp-data -j DNAT
--to-destination $DMZ_FTP_IP
$IPTABLES -t nat -A POSTROUTING -p TCP -s $LAN_IP_RANGE -j SNAT --to-source $DMZ_NATwhere
DMZ_FTP_IPis IP address of ftp server in DMZDMZ_IPis global IP address of ftp server.INET_IFACEis Internet interface on firewallDMZ_IFACEis DMZ interface on firewall.LAN_IP_RANGEis Lan ip range.Can anyone help me?
Thanks and Regards
Durgaprasada_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
Quoted 7 lines · Durgaprasada Kalluraya
ftp> ls
200 PORT command successful.
425 Can't build data connection: Connection timed out. ftp> byeBut if I try the same thing from outside using a dialup connection all works fine for me!!!!
Is your dialup still going through the firewall, or is it direct to the server? Is it passive or active ftp? Regardless of these, I suspect that the problem is that you need to add:
modprobe ip_conntrack_ftp
so that the "RELATED" state recognizes and NAT functions handle both passive and active FTP. The data connection is a separate pair of ports, negotiated by the server and client but embedded in a packet instead of its header during negotiation, so netfilter won't normally deal with them. The helper ip_conntrack_ftp exists specifically for this purpose, since it knows to examine the actual packet data of FTP conrtol transactions looking for this and dealing with it correctly.
Quoted 6 lines
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT$IPTABLES -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j
ACCEPT
This is redundant and will never match a packet, since you accept EST/REL for ANY interface, ip, and port in the rule before it.
Quoted 5 lines
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_FTP_IP --dport ftp -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_FTP_IP --dport ftp-data -j
allowed
I presume you have a user-defined chain named "allowed"...
j