establishing ssh connection is extermely slow

waynezhu used Ask the Experts™
I have bunch of linux servers within same network.
One of them is having some problem with ssh.
Basically to establish a ssh connection either from or to it is extremely slow.
Would you shed some light where to start the troubleshoot.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
the problem may be DNS configuration or Firewall blocking DNS resolution in servers.

1.- check iptables firewall (or anothyer firewall)
2.- check dns resolver configuration (usually /etc/resolv.conf)

I think it is on the right direction.
Since once connection established, data trabsfer rate is good.
I will compare the /etc/resolv.conf to see any diff
Thank you.
/etc/resolv.conf has different nameserver entries.
I copied the good one over, which made huge improvement from 2 minute to 6 second
for the connection time.
6 seconds may be still slow, since other hosts connects instantly.
Any other area I can look into?
You could also check hosts files on both machine and check for differences.

Can you use ssh -vvv <host>  and paste the output in here please...

There may be an issue with your /etc/ssh_config file

In the ssh_config file check the setting for AddressFamily, if it is set to "any", try it with "inet"

             Specifies which address family should be used by sshd(8).  Valid
             arguments are ``any'', ``inet'' (use IPv4 only), or ``inet6''
             (use IPv6 only).  The default is ``any''.
I checked /etc/hosts, ssh_config, sshd_config,
and ssh -v outputs
They all look same.
I have decided to hard coded the IP and hostname into /etc/hosts as a workaround.
Thank you all
thanks for helping

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial