Jump to content

  • Log In with Google      Sign In   
  • Create Account

- - - - -

Slow FTP with BSD 5.0


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
14 replies to this topic

#1 Monder   Members   -  Reputation: 993

Like
Likes
Like

Posted 28 July 2003 - 07:59 AM

I''ve just set up a FreeBSD 5.0 box up on my network. I''ve enabled anonymous ftp on it and it''s working but there''s one problem. It takes about two minutes for the server to respond to the client but after it does everything runs at a decent speed. Does anyone know what may be causing this long delay between the client first trying to connect and the server responding?

Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 28 July 2003 - 08:29 AM

quote:
Original post by Monder
I''ve just set up a FreeBSD 5.0 box up on my network. I''ve enabled anonymous ftp on it and it''s working but there''s one problem. It takes about two minutes for the server to respond to the client but after it does everything runs at a decent speed. Does anyone know what may be causing this long delay between the client first trying to connect and the server responding?


My guess is that the server is trying to do a reverse DNS lookup (in order to write a name to the log) and that the client is not part of a domain, so the server has to wait for the request to time out.


Hope this helps.


#3 Monder   Members   -  Reputation: 993

Like
Likes
Like

Posted 28 July 2003 - 08:41 AM

You''re probably right, thanks. I''ll go RTFM to find out how to disable it.

#4 Interim   Members   -  Reputation: 122

Like
Likes
Like

Posted 28 July 2003 - 10:50 AM

Actually, I think TCP Wrappers does that. Been a while since I dove into the exacts. Usually the best thing to do without disabling logging and other good to have functionality, is to just pre-populate your hosts file for your network.

Assuming you''re running a 192.168.0.0/24 network you can do a simple python or perl script to generate the hosts file:

#!/usr/bin/python

for i in range(0,256):
print "192.168.0.%d n0-i" % (i)

Do a test run to verify it looks good (no errors): ''python <scriptname>''

If it looks good, back up your hosts file and just add the python script output to the end of hosts

cp /etc/hosts /etc/hosts.org
python <scriptname> >> /etc/hosts


If you''ve only got a few machines you can swing back and change the hostname to something more in line with your network. If you got a lot of hosts, you should set up a DNS server.

This way all logging and reverse-lookups do resolve and to something you can identify. (n0-254 is 192.168.0.254 for example).

Interim

#5 Monder   Members   -  Reputation: 993

Like
Likes
Like

Posted 28 July 2003 - 11:26 AM

Well in the end I did just put my other computer''s (it''s a rather small network ) ip in the host file with a host name. However it still takes ages for the server to respons. Could inetd be causing it?

#6 Monder   Members   -  Reputation: 993

Like
Likes
Like

Posted 28 July 2003 - 11:34 AM

Oh and what''s a 192.168.0.0/24 network? I''m sure it''s something to do with subnetting but I can''t quite remember.

#7 Interim   Members   -  Reputation: 122

Like
Likes
Like

Posted 28 July 2003 - 01:42 PM

I was guessing your network was the standard private address space (192.168.0.0/24 = 192.168.0.0 255.255.255.0). Most people use 192.168.0.0 or 192.168.1.0.

Hrms, what you did with your host file should have worked. You sure you got the syntax right?

On your FreeBSD machine, make sure you can ping your other machine by hostname?

#8 Monder   Members   -  Reputation: 993

Like
Likes
Like

Posted 28 July 2003 - 10:41 PM

I''m sure it''s right, because I can ping my other machine and when I connect to the FTP server my machine shows up in the logs with the correct hostname.

And yeah I am running a 192.168.0.0/24 network in that case I suppose the 24 means 24 subnet mask bits?

#9 Interim   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 July 2003 - 03:09 AM

Sorry, yes. /24 is CIDR (Classless Inter-Domain Routing) notation. /24 = 24 bits.

I wonder if its your FTP client. Try adding the server to your host file on your FTP client machine.

Then, as another quick test, try to connect to your IP of your FTP server from the server with an FTP program. See if you get the same slow connection.

What you describe is classic FTP and other internet service issues on Unix without DNS setup thoroughly, but usually what I described will rectify that immediately.

Does FreeBSD 5.0 have xinetd by chance? I got some defaults of 5.1, but no xinetd, there are some tweaks you can do there for the log_success to speed up connections.

Int.

#10 Monder   Members   -  Reputation: 993

Like
Likes
Like

Posted 29 July 2003 - 06:44 AM

Hmm well when I connect to the ftp server using an ftp program on the server itself I still experience the same delay . I don''t have xinetd on this box, though I could install it through the ports system. Seeing as this box is just a little server I''ve set up I don''t really need inetd, so I''ll set it up so the FTP server just runs from bootup and see if I still get the delay.

#11 Interim   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 July 2003 - 07:37 AM

I got it. Its not going to hosts by default, it's going to DNS then HOSTS. So its still trying the DNS lookups before hitting your custom host entries.


I believe that FreeBSD 5.0 added nsswitch, but to be honest, I work mainly in larger environments, so I haven't not had DNS in a long, long time. But, with nsswitch you can tell it to do files first, then DNS.

I did a locate and found on my FreeBSD 5.1 boxes the nsswitch.conf in /usr/compat/linux/etc/nsswitch.conf.

I also opened it and its already configured for files then dns.

You can see this with the line: "hosts: files nisplus nis dns" Since you're using hosts, this should immediately increase the logins to the usual instant speeds =). You should also maybe adjust this hosts line to put dns before nis and nisplus since you probably aren't using either in your network to make sure any other resolutions happen in due process.

"hosts: files dns nisplus nis"

I also did a short test for you (I'm a nice guy today) and it looks like all you need to do is copy it over to get your resolution. (I added host entry over my DNS entry and it gave me the new host entry, not my old DNS).

So, to fix your problem, make sure your /etc/hosts has mappings for your clients like we said before, then just do a simple copy:

cp /usr/compat/linux/etc/nsswitch.conf /etc/nsswitch.conf

It should work right away. Looks like they just default to DNS then FILES when the nsswitch.conf isn't placed in /etc.

The other option is to run a DNS resolver locally, but that's too much work in my mind for 2-3 computers.

Interim.

[edited by - Interim on July 29, 2003 2:39:59 PM]

#12 Monder   Members   -  Reputation: 993

Like
Likes
Like

Posted 29 July 2003 - 11:28 AM

Well I''ve done that and everything is now working nice and fast. Thanks for all your help . Though I''m not sure if it was the DNS stuff after all now because I rebooted my box and manually started up the ftp daemon and it took ages for it start up etc, so I reackon it was just the time it took for the ftp daemon to start up causing the delay in the first place. Thanks anyway though

#13 Interim   Members   -  Reputation: 122

Like
Likes
Like

Posted 29 July 2003 - 11:40 AM

No problem. I still think its the name resolution. The slow start up of FTP might have been from failing to resolve its own name in prompt time (DNS retries, then HOSTS). Never did much heavy FTP administration.

Plus, what you describe is classic Unix network service issues, particularly noticeable with FTP =).

G''luck!

Int.

#14 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 30 July 2003 - 05:30 AM

i was under the impression it was 192.168.0.0/8

#15 Interim   Members   -  Reputation: 122

Like
Likes
Like

Posted 30 July 2003 - 07:12 AM

No. It''s 16 actually. Most subnet it to 24.

10.0.0.0/8
172.16.0.0/12
192.168.0.0/16

Interim

FYI RFC1918

http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1918.html




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS