[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: telnet localhost slow, telnet 127.0.0.1 ok



* Shyamal Prasad (shyamal.prasad@sbcglobal.net) [030816 13:59]:
>     "Rupert" == RUPERT LEVENE <levene@unix.lancs.ac.uk> writes:
> 
>     Rupert> Shyamal Prasad <shyamal.prasad@sbcglobal.net> wrote:
>     >> "Rupert" == RUPERT LEVENE <levene@unix.lancs.ac.uk> writes:
> 
>     Rupert> Antony Gelberg <antony@antgel.co.uk> wrote:
>     >> >> On Sat, Aug 16, 2003 at 12:25:16AM +0100,
>     >> >> r.levene@lancaster.ac.uk wrote:
>     >> >>> Running strace telnet localhost 22 shows that it's trying
>     >> to >>> resolve the hostname localhost by querying the
>     >> nameserver. I >>> thought that shouldn't happen with my setup,
>     >> though.
> 
>     >> >> Does your /etc/host.conf contain order hosts,bind
> 
>     Rupert> Yes, it does.
> 
>     >> I did not see the original post, but the other thing you must
>     >> have is that /etc/hosts must resolve local host to 127.0.0.1
>     >> too
> 
>     Rupert> Yes, I have this. Here is another list of things I think
>     Rupert> could be relevant.
> 
> Hi Rupert,
> 
> The mystery deepens since I looked at your configs and compared with
> mine, and they are the same. The thing is, uh, when I run strace I see
> the same thing happen. I can see a query going to my local name
> server. 

I bet this has to do with that localhost doesn't have any dots, and
ndots defaults to 1.  So the first thing it tries to look up is
localhost.<domain> where <domain> is either the "domain" or the first
item of "search" in resolv.conf.  Can you tell from strace's output if
this is correct?  try using "telnet localhost." or adding something like
"localhost.localdomain" in your /etc/hosts and see if using that name
instead avoids the delay.

> Incidentally, ssh does not do this odd lookup and works exactly how
> I'd have expected telnet to.

That is weird.  I haven't looked at the code yet, to compare how each
does their resolving.  Perhaps ssh is using getaddrinfo and telnet is
using gethostbyname, or they're setting different RES options, or
something.

good times,
Vineet
-- 
http://www.doorstop.net/
-- 
http://www.eff.org/		Defending freedom in the digital world

Attachment: pgpvQoiPbD_l1.pgp
Description: PGP signature


Reply to: