Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Upgraded to leopard and now ssh is HORRIBLY slow

When making connections to other servers, I turned on the triple v option (-v -v -v) to see the debug output and I see it hang at this line for approx 60 seconds:

debug2: ssh_connect: needpriv 0

After that timeout, everything else proceeds normally.

Interestingly enough, if I just connect to localhost, that step flies right by, no delay...

Mac OS X (10.5)

Posted on Oct 31, 2007 10:39 AM

Reply
31 replies

Oct 31, 2007 12:46 PM in response to Scott Micciche

Agreed that ssh is a very security-oriented protocol but in this case, it is NOT dns related.

The same servers work fine when connecting from this location using the old (10.4) OS X.

The ONLY change that was made to my mac was to update to 10.5.

Just for fun, I did a new install of 10.5 to a blank hard drive and the problem persists there too.

Doing a fresh install of 10.4 to that same blank hard drive, works fine.

Oct 31, 2007 2:34 PM in response to Scott Micciche

I did both an erase and install and an update at two different times.

DNS resolves properly both forwards and backwards on both the machines that I am trying to connect to as well as the network that I am coming from.

Everything fires along beautifully with 10.4 with the same setup.

Does anyone know where I can find a listing of the changes in ssh in this 10.5 version of mac os vs what they did in 10.4?

Nov 1, 2007 6:11 AM in response to pkUK

After the updgrade to Leopard I too noticed that ssh was very slow in connecting to servers, taking 1 to 2 minutes. Apparently it has to do with the DNS (because there is no connection delay when specifying IP addresses directly) and some routers that do not handle DNS requests correctly.

I fixed the problem by specifying an alterntive DNS in the network preferences, instead of using the default one (which was indeed my router), and now ssh works fine as before.

HTH.

Nov 1, 2007 4:17 PM in response to dendroaspis

I can confirm that too.

10.4 had no problem and as near as I can tell, 10.5 and 10.4 are configured the same for ssh. (config file is the same anyway)

This leads me to believe that this is NOT an ssh issue but rather an issue with how ssh talks to the nameservers. If you specify nameservers for your connection in the network settings dialog, there is no delay. If you allow your dns servers to be automatically assigned via your network's DHCP server, there is a huge problem. All other services seem to work fine, just not ssh.

I see this on two networks. Both are using the dhcp server from a linksys box provided by vonage with their service.

Is there perhaps a bug/change in 10.5's dealing with dhcp?

Nov 2, 2007 10:03 AM in response to davshirley

Not sure about the DNS servers within the DHCP scope, I'm using pfsense at home on a laptop as a firewall for Surewest Fiber and I've never had a problem. I use dnsmasq as a dns cache and dhcp server as it automatically captures IP address assignments and creates the A and PTR records. I have all my dhcp mac clients using it as the first DNS server in the search order and the Surewest secondary as their secondary DNS server. I have had zero issues either using keyboard interactive and keys to log in to remote servers. I wonder if there is a way to get diagnostics turned on with more verbosity on your client and the target?

Nov 2, 2007 12:56 PM in response to davshirley

ok. it is slow if my /etc/resolve.conf contains what dhcp is putting there:

nameserver 192.168.15.1


If I add two nameservers that I control and allow recursion from my location I get fast connections:

nameserver 67.131.250.9
nameserver 67.131.250.12
nameserver 192.168.15.1


Now here's the interesting part:
The two nameservers that I am adding to /etc/resolve.conf are the VERY SAME nameservers that my router at 192.168.15.1 is set to use and assign for all dhcp clients. This suggests to me that there is a bug in how ssh handles dns lookups since the first /etc/resolve.conf should work (and does work fine in 10.4)

Nov 2, 2007 1:24 PM in response to davshirley

Since my last post I've been trying hard to find (again) the page where I got the DNS workaround, unfortunately without success.

According to what I remember, the problem lies in the router claiming to be a DNS, but not handling AAAA records correctly (whatever AAAA records are, I have no idea). Some software (and OSs) can deal with such DNS misbehavior without trouble, but others just hang for minutes.

BTW, the workaround I found was related to upgrading from 10.3 to 10.4, so, apparently, Tiger also suffered from this at some point. Funnily, last year I stumbled into the very same problem with a Linux distribution, and the workaround was exactly the same.

Alas this is all I recall about this matter.

Message was edited by: dendroaspis

Nov 2, 2007 11:41 PM in response to davshirley

Ok. I think I go it now. Can someone else test and confirm this.

It seems that ipv6 is working fine. The trouble comes with some linksys routers and their "DNS Proxy" feature. When that feature is on, 10.5 chokes on ssh connections. Turn it off (thus forcing dhcp to populate your /etc/resolve.conf with that network's nameservers rathen than the IP of the linksys device) and your are off and running.

Nov 11, 2007 4:28 PM in response to davshirley

Having just installed and run into the same problem with ssh I asked around and one guy said this...

"Assuming you are referring to problems when ssh-ing from a Leopard box
to other systems, then the problem is probably the new behavior of the
getaddrinfo() call in Leopard. Basically, that call in Leopard now uses
the RFC-recommended practice of first issuing a DNS SRV record request
rather than an A record request, and then falling back to the A record
request if the SRV request fails; unfortunately, apparently a lot of DNS
servers don't respond to the SRV request w/ an NXDOMAIN as they should,
and instead just drop the request, so getaddrinfo() retries the SRV
request a few times, and only after those requests time out does it try
to A request. So if ssh is using getaddrinfo() rather than
gethostbyname/getservbyname, then you it would hang like you describe
whenever you are pointing to a DNS server that doesn't respond well to
the SRV request. (There are also reports that Leopard may generate DNS
requests w/ an invalid RR type, which might explain why the servers
being queried aren't responding to them correctly.)

The easiest way to check if that's your problem would be to sniff
traffic on port 53 while trying an ssh connection, and seeing if your
box is making a SRV request or an A request. (If that is in fact your
problem, you may be SOL until a patch is released, as Googling, I don't
see any solutions other than hacking individual apps to use
gethostbyname() instead of getaddrinfo().)"

I did monitor port 53 and it is making SRV requests.

Hope this helps.

Pat.

Upgraded to leopard and now ssh is HORRIBLY slow

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.