LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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


Closed Thread
  Search this Thread
Old 05-24-2004, 12:27 AM   #1
hct224
Member
 
Registered: Jun 2003
Distribution: Redhat
Posts: 87

Rep: Reputation: 15
FTP & iptables firewall


I setup iptables firewall to "trust" port 21 and I am able to ftp to the server. However, when I tried to download and upload files. It showed this message:

227 Entering Passive Mode (192.168.0.5,124,89)
ftp: connect: No route to host


It works fine if I shutdown iptables. How am I going to setup iptables to make my FTP works?

Thanks
 
Old 05-24-2004, 04:20 AM   #2
bipul4b
LQ Newbie
 
Registered: May 2004
Location: India
Distribution: redhat
Posts: 21

Rep: Reputation: 15
Hi,

you are right that you "trust" on port 21 for ftp . so you can login in to the server. but when ftp transfer data then it use diffrent ports other then 21 so you also have to configure that port to transfer your files ( upload or download ) with the help of ftp.


you can use "ftp-data" as protocol name

so allow ftp-data in firewall


bye
 
Old 05-24-2004, 09:25 AM   #3
adm1329
Member
 
Registered: Mar 2004
Distribution: CentOS 5
Posts: 128

Rep: Reputation: 17
which ftp program are you using?
 
Old 05-04-2012, 04:30 AM   #4
digitaldude
LQ Newbie
 
Registered: Sep 2010
Posts: 20

Rep: Reputation: 0
vsftpd v 2.x
 
Old 05-04-2012, 04:34 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
please don't drag up dead threads. it is often very confusing for others who think the question is still relevant.
 
Old 05-04-2012, 04:50 AM   #6
war49
LQ Newbie
 
Registered: Feb 2012
Location: Indonesia
Distribution: Slackware, Centos, Debian, RHEL
Posts: 13

Rep: Reputation: Disabled
Quote:
Originally Posted by hct224 View Post
It works fine if I shutdown iptables. How am I going to setup iptables to make my FTP works?

Thanks
Hi,
Can you display your iptables rule for your FTP ?
 
Old 05-04-2012, 04:57 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
No he can't, he posted that 8 years ago.
 
Old 05-04-2012, 09:20 AM   #8
war49
LQ Newbie
 
Registered: Feb 2012
Location: Indonesia
Distribution: Slackware, Centos, Debian, RHEL
Posts: 13

Rep: Reputation: Disabled
Oh.. i was not read the datetime he posted..

Last edited by war49; 05-04-2012 at 09:22 AM.
 
Old 05-04-2012, 11:13 AM   #9
snowmobile74
LQ Newbie
 
Registered: Nov 2003
Location: Reston, VA
Distribution: Slackware for everything
Posts: 22

Rep: Reputation: 1
Quote:
Originally Posted by hct224 View Post
I setup iptables firewall to "trust" port 21 and I am able to ftp to the server. However, when I tried to download and upload files. It showed this message:

227 Entering Passive Mode (192.168.0.5,124,89)
ftp: connect: No route to host


It works fine if I shutdown iptables. How am I going to setup iptables to make my FTP works?

Thanks
Edit, just like bipul4b said basically.

Well your half way there but if you didn't open port 20 you'll never get there. Are you currently forwarding 20 to something else? That would explain the ICMP no route message you revive back.

you may also want to add this to your /etc/hosts.allow

ftpd : ALL : allow


Differences from HTTP
FTP operates on the application layer of the OSI model, and is used to transfer files using TCP/IP. To do so, an FTP server has to be running and waiting for incoming requests. The client computer is then able to communicate with the server on port 21. This connection, called the control connection, remains open for the duration of the session. A second connection, called the data connection,can either be opened by the server from its port 20 to a negotiated client port (active mode), or by the client from an arbitrary port to a negotiated server port (passive mode) as required to transfer file data. The control connection is used for session administration, for example commands, identification and passwords exchanged between the client and the server using a telnet-like protocol. For example "RETR filename" would transfer the specified file from the server to the client. Due to this two-port structure, FTP is considered an out-of-band protocol, as opposed to an in-band protocol such as HTTP.

Last edited by snowmobile74; 05-04-2012 at 11:15 AM.
 
Old 05-04-2012, 01:43 PM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
OH good grief, read my replies, you're just wasting your time.
 
  


Closed Thread



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 & firewall Mibble Linux - Security 1 09-12-2005 01:47 PM
my new iptables firewall, everything works except for FTP kawdk Linux - Networking 2 08-01-2004 04:47 AM
Firewall - iptables - ftp connections cubee Linux - Security 22 01-29-2004 10:12 AM
Need Firewall & IPTABLES HELP arkmannj Linux - Security 5 02-12-2003 03:19 AM
Firewall - Firestarter Iptables ftp jupp Linux - Networking 0 03-18-2002 04:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:04 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