LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-11-2009, 06:15 AM   #1
atpchn
LQ Newbie
 
Registered: May 2009
Posts: 4

Rep: Reputation: 0
Configure Active FTP in Firewall through iptables


Hi everyone,

I have a LAN and a Linux machine, which is used as gateway and internet access to the LAN is done from Linux machine.

When i access the ftpserver, iam able to connect. But iam not able to view the files/directories through ls command.

My Linux Firewall is blocking the active FTP session.

Pls give me the steps to configure active FTP with iptables.

thanks
 
Old 05-11-2009, 06:54 AM   #2
bhaslinux
Member
 
Registered: Oct 2003
Location: UnitedKingdom
Distribution: Debian Lenny
Posts: 351

Rep: Reputation: 47
did you try passive command ? does it work ?
To enable active ftp you need to redirect port 20 and 21 to the ftp machine (using virtual server ... ) in your DSL

Iptables may not be playing a big role here but if you are blocking input using iptables then
this might help:

iptables -A INPUT -p tcp --dport 20 -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
 
Old 05-11-2009, 07:04 AM   #3
atpchn
LQ Newbie
 
Registered: May 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Passive mode works fine. It displays entire directory structure.
But opening in ASCII Mode, the ls command just hangs.

I have only given the following rules in firewall for internet.

step 1)iptables -F
step 2)iptables -N block
step 3)iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT
step 4)iptables -A block -m state --state NEW -i ! eth0 -j ACCEPT
step 5)iptables -A block -j DROP
step 6)iptables -A INPUT -j block
step 7)iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
step 8)iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Help me to configure FTP working with ASCII
 
Old 05-11-2009, 07:59 AM   #4
bhaslinux
Member
 
Registered: Oct 2003
Location: UnitedKingdom
Distribution: Debian Lenny
Posts: 351

Rep: Reputation: 47
If this linux machine is the gateway, then where is it connected to ?
If this is gateway, the gateway must also be able to forward the port20 packets to the
linux machine. Is this taken care of ?

i.e if the gateway is a DSL modem, ther must be a virtual server option which can be used
to forward ports to the linux machine.
 
Old 05-11-2009, 08:25 AM   #5
atpchn
LQ Newbie
 
Registered: May 2009
Posts: 4

Original Poster
Rep: Reputation: 0
Linux machine has two NICs. One is used as gateway for the LAN and the other NIC is directly connected to internet.

Through the Linux Machine the internet works for the LAN.

iptables needs to be configured in Linux Machine.
 
Old 05-11-2009, 08:52 AM   #6
baig
Member
 
Registered: Nov 2008
Location: وادی ھنزہ
Distribution: Solaris 5.10, Debian Server 5.2, CentOS 5.6
Posts: 226
Blog Entries: 3

Rep: Reputation: 38
i think the best way to generate a complete firewall script according to your needs is:

Code:
http://easyfwgen.morizot.net/gen/

have a look and generate according to your needs and services you need to enable.


Cheers!!
 
Old 05-11-2009, 08:59 AM   #7
atpchn
LQ Newbie
 
Registered: May 2009
Posts: 4

Original Poster
Rep: Reputation: 0
i have configured the firewall for internet access to the entire LAN.
But the only problem is the active FTP.
Through active FTP, iam not able to view the list of files in the FTP Server.
It just hangs for 'ls' command.
 
  


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
IPTABLES rules for active FTP TruckStuff Linux - Security 7 04-22-2009 07:21 PM
active ftp port iptables problem peterb Fedora 9 06-15-2008 02:42 AM
Help needed with IPCop Firewall and active FTP Damchi Linux - Newbie 5 11-17-2005 12:08 PM
iptables, nmap and active ftp connections Bug Linux - Security 3 06-14-2004 02:14 PM
Another iptables Active FTP Issue tnolte Linux - Networking 4 09-28-2003 12:34 PM


All times are GMT -5. The time now is 04:24 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration