Delay in SSH connection in Ubuntu Feisty

I just grew fed up with all of my ssh connections taking more than 15 seconds before a connection was established. I ruled out the usual suspects:

  • Misconfigured DNS can cause it as a reverse lookup times out. This however was not the case. dig -x [ipaddress] worked fine on the server.
  • When ipv6 on the workstation is misconfigured it can cause the problem because ssh will try to connect over ipv6 before connecting thru ipv4. I disabled ipv6 (alias net-pf-10 off in /etc/modprobe.d/aliases) but still no go. I could have guessed since my ipv6 route table was empty..

I fired up wireshark and traced a connection. The cause of the problem was mdns which did lookups that timed out. $DEITY knows why it does; I just disabled it by removing all references to mdns in /etc/nsswitch.conf - and all works fast again

Wireshark is great.

Comments

Thanks!

Thanks so much for posting this. I was having the same problem, and it was driving me nuts!

Thank you.

It would've taken me forever to figure this out.

Works on Gutsy

I just tried this in Gutsy Gibbon after trying disabling ipv6 but my ssh connection still took 15 seconds to connect. After commenting out mdns it's under a second!