When connecting to a Debian server using ssh, if I use user@XXX.XXX.XXX.XXX (the IP address of the server) the connection is instant.
If however I use email@example.com (a DNS redirected to the IP address of the server) the ssh connection hangs for a 20 seconds before connecting successfully. The ssh logs show the following:
[alex@alex home]$ ssh -v -v firstname.lastname@example.org OpenSSH_5.5p1, OpenSSL 1.0.0c-fips 2 Dec 2010 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug2: ssh_connect: needpriv 0
and here it hangs during 20 seconds before continuing.
I think it might have something to do with reverse DNS or similar (the server does not really "know" it's name is hostname.com, it just has that DNS rediriected to its IP address).
I have added the following options to /etc/ssh/sshd_config:
UseDNS no GSSAPIAuthentication no
to no effect.
The server's DNS records in /etc/resolv.conf are configured correctly:
ping hostname.com PING sub.domain.com (X.X.X.X) 56(84) bytes of data. 64 bytes from replicant (X.X.X.X): icmp_seq=1 ttl=64 time=0.029 ms 64 bytes from replicant (X.X.X.X): icmp_seq=2 ttl=64 time=0.050 ms�s
Thanks for the help.
Solution: It seems the DSL router my ISP saddled me with was causing the trouble.
Changing my DNS server from 192.168.1.1 (router's IP) to google's (184.108.40.206, always good to know when you are in a hurry) instantly solved the connection delay problem.
I am guessing that the 50€ router provided does not cache DNS entries, although I don't understand why pinging the DNS address had no delay, and 20 seconds is too long of a wait, even for uncached DNS.
Tnanks again for the help!