So, I have to spend quite a lot of time remotely logged into a unix server by SSH at the moment. Luckily Mac OS X comes with a nice SSH client already installed but I have been having problems with it taking forever (well, up to a minute) to connect which finally got annoying enough to fix this morning.
The first thing I did was to enable debug messages with the -v parameter.
dave$ ssh -v email@example.com
When I ran that, the long pause came just before this error message:
debug1: An invalid name was supplied
Cannot determine realm for numeric host address
A few quick googles and I had the solution, add a DNS lookup for the IP address and the speed issue goes away leaving you with a fast and responsive SSH connection process!
To add the DNS lookup, simply edit the /etc/hosts file (you will need to sudo this or type your password when it is saved) and add a line something like this to the bottom:
Then you should be able to connect quickly using either the IP address or the new host name you assigned.