LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 07-18-2009, 07:09 PM   #1
KenjiKinya
LQ Newbie
 
Registered: Apr 2009
Location: Japan & South Korea
Distribution: Fedora
Posts: 19

Rep: Reputation: 0
Trouble connecting to an FTP server


I've set up an FTP server with vsFTPd, and I can connect when on the same machine that the server is running. However, when attempting to connect from another machine on the internet, or even on the same LAN, the connection always fails. Port forwarding on the router is enabled. When attempting to connect over the internet via FileZilla, this is displayed:
Code:
Status: Connection attempt failed with "EHOSTUNREACH - No route to host".
Thanks in advance,
Kenji
 
Old 07-18-2009, 07:28 PM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 210Reputation: 210Reputation: 210
Fedora used to have iptables setup by default, I think. Does it still? Add an ACCEPT line to /etc/sysconfig/iptables:

Code:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
Well, just copy one that's in there and change the port to 21; what I've got above might not match exactly with whatever is in there.

I'm sure there's plenty of other things that can go wrong, too. Make sure you have the vsftpd conf file setup in a sane way. But the above is what usually caught me when I'd install new services on RedHat-flavor systems.

... Can you ping the host? Are there other servers living on the box (can you visit the box via HTTP?)

Last edited by jhwilliams; 07-18-2009 at 07:34 PM.
 
Old 07-18-2009, 08:00 PM   #3
KenjiKinya
LQ Newbie
 
Registered: Apr 2009
Location: Japan & South Korea
Distribution: Fedora
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks for your help, the server accepts connections from the internet now. However there's an new problem now... I'm not sure if FTP is really your thing, but if you can help with this one that'd be great. The server accepts the connection but then the connection times out then client sends a LIST command. FileZilla Displays:
Code:
Command:	PASV
Response:	227 Entering Passive Mode (192,168,1,5,193,118).
Status:	Server sent passive reply with unroutable address. Using server address instead.
Command:	LIST
Error:	Connection timed out
Error:	Failed to retrieve directory listing
But when connecting from a LAN or locally, it works just fine...
 
Old 07-18-2009, 08:33 PM   #4
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 210Reputation: 210Reputation: 210
Hm, I don't think I've got an answer for that -- I haven't really spent much time vsftpd, or even ftp in a while. I think everyone is pretty much using sftp (via ssh(d)) for file transfer these days. Is there some reason you don't want to use ssh?
 
Old 07-19-2009, 10:36 AM   #5
KenjiKinya
LQ Newbie
 
Registered: Apr 2009
Location: Japan & South Korea
Distribution: Fedora
Posts: 19

Original Poster
Rep: Reputation: 0
I do plan to use SSH in the future with FTP, but I just wanted to get a simple server going so I could learn the basics. And I did solve one problem on my own, where the server specifies its address in passive mode, (I needed to input my WAN address into the config file), but it still times out when the list command is sent. This doesn't happen when it's accessed from the LAN, however.
 
Old 07-19-2009, 11:45 AM   #6
Hari Gold
LQ Newbie
 
Registered: Aug 2007
Location: Internet
Distribution: Ubuntu, Centos, *BSD
Posts: 8

Rep: Reputation: 0
Is your ftp server behind a nat router? If you can connect from the Lan, it maybe that your nat router is blocking the data channel. Allowing you to send commands, but LIST would time out.

Last edited by Hari Gold; 07-19-2009 at 11:51 AM.
 
Old 07-19-2009, 06:29 PM   #7
PreacherBill
Member
 
Registered: Nov 2006
Location: Louisville, KY
Distribution: CentOS 6
Posts: 41

Rep: Reputation: 15
Based on what you've posted, it sounds like the server is behind a nat router and does not know the external (internet facing) address of the router. So when it attempts to establish the data connection, it's sending it own internal address, which is meaningless outside of the local network. It needs to be sending that external address, since that is the address the client and server will use for the data transfer. I haven't used vsFTP, but somewhere in the configuration files it should ask you for that address. Make sure you get it from the router.
 
Old 07-24-2009, 06:57 AM   #8
Hari Gold
LQ Newbie
 
Registered: Aug 2007
Location: Internet
Distribution: Ubuntu, Centos, *BSD
Posts: 8

Rep: Reputation: 0
Hi Bill, of course you are right, the problem with the second post was due to not having configured the wan address in the config, but Kenji fixed that himself as he describes in the third post. The problem now appears to be that the router is not tracking the ftp connection. The data connection is established on a random port on the server. Giving the wan address won't help here because the wan address belongs to the router and the router does not know how / care to forward the random port opened by the server. In any case, Kenji has stopped responding so probably he has already fixed it or switched to using SFTP which is easier to set up.
 
Old 07-24-2009, 07:29 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,868
Blog Entries: 27

Rep: Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163Reputation: 2163
Hi,

Yes, but does the OP have the port forwarding setup at the router properly? To enable without direction will cause the problem the OP is experiencing.
 
Old 08-02-2009, 05:30 AM   #10
Hari Gold
LQ Newbie
 
Registered: Aug 2007
Location: Internet
Distribution: Ubuntu, Centos, *BSD
Posts: 8

Rep: Reputation: 0
I have seen adsl routers that came with the ISP package which simply did not support ftp tracking. If the router supports it, it usually has some sort of higher level 'ftp service' option in the gui. If you find yourself opening port 21 and forwarding it to a natted server, you probably have a router that does not support ftp tracking. In those cases, I had to setup the router in bridged mode and set up a linux server to act as the firewall and to take care of connection tracking.
 
  


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
Trouble connecting to server travellers Linux - Laptop and Netbook 2 12-05-2005 08:59 PM
trouble connecting to dialin server using cell akhilesh Linux - Networking 0 09-12-2004 05:09 PM
Connecting to FTP server via the internet antheus Linux - Newbie 4 05-15-2004 06:04 PM
connecting to a friends windows 2000 ftp server ddpicard Linux - General 7 02-06-2003 11:13 AM
Connecting Mac's to a Linux FTP server unclebyron Linux - Networking 2 03-25-2002 07:11 PM

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

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