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

Re: telnet localhost slow, telnet 127.0.0.1 ok



r.levene@lancaster.ac.uk writes:
>
> If I run telnet localhost 22 then I have to wait 15-30 seconds before it
> connects; with telnet 127.0.0.1 22 it connects at once. I have the same
> results using other open ports.

Does

        telnet -4 localhost

give the same delay?  If not, then the problem is IPv6 support.  Even
though all your resolution configuration files are set up correctly,
"telnet" is using "getaddrinfo()" to grab *both* IPv4 and IPv6
addresses for "localhost".  The former gets looked up in the "hosts"
file, but the latter goes out to your nameserver.  If you want, you
can add "localhost" to the "::1" line in "/etc/hosts" like so:

        ::1     ip6-localhost ip6-loopback localhost

and that'll allow you to do "telnet localhost" without delay.  That
may cause problems with other programs, though, which might try to use
IPv6 addresses in preference to IPv4 addresses without falling back if
they can't connect to the IPv6 address.

And, if the nameserver you're using always chokes on IPv6 queries (not
just for "localhost"), then "telnet anyhostname" will always give the
same delay, and you're better off aliasing "telnet" to "telnet -4".

-- 
Kevin <buhr@telus.net>



Reply to: