ssh slow connection to solaris 10 and 11

Question:  ssh slow connection to solaris 10 and  11 hosts , how to  solve  this ?

Answer : Normally  in Linux  hosts  we solve ssh delay  issue  by  disabling most of the server-side lookups by setting UseDNS no in sshd_config. This solution doesn`t seem to work in Unix based systems.

let  give a  verbose connexion example between my Ubuntu and  Solaris  11 :

pirat9@HP ~ $ ssh -v  pirat9@192.168.1.134
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.1.134 [192.168.1.134] port 22.
debug1: Connection established.
debug1: identity file /home/pirat9/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/pirat9/.ssh/id_rsa-cert type -1
debug1: identity file /home/pirat9/.ssh/id_dsa type -1
debug1: identity file /home/pirat9/.ssh/id_dsa-cert type -1
debug1: identity file /home/pirat9/.ssh/id_ecdsa type -1
debug1: identity file /home/pirat9/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.5
debug1: no match: Sun_SSH_1.5
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA c8:05:c3:8a:80:47:3b:9b:e1:e1:a2:c8:90:ff:93:e1
debug1: Host '192.168.1.134' is known and matches the RSA host key.
debug1: Found key in /home/pirat9/.ssh/known_hosts:6
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic

you can  prevent SSH from trying GSS API Authentication. Just add the the following option :


ssh -o GSSAPIAuthentication=no -l user hostname

Or   add to sshd_config


Host hostname GSSAPIAuthentication no <code>LookupClientHostnames no VerifyReverseMapping no

Restart SSH Server

#svcadm disable  ssh
#svcadm enable ssh
OR
# svcadm restart ssh

Try to connect again  :

pirat9@HP ~ $ ssh -v -o GSSAPIAuthentication=no -l pirat9  192.168.1.134
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.1.134 [192.168.1.134] port 22.
debug1: Connection established.
debug1: identity file /home/pirat9/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/pirat9/.ssh/id_rsa-cert type -1
debug1: identity file /home/pirat9/.ssh/id_dsa type -1
debug1: identity file /home/pirat9/.ssh/id_dsa-cert type -1
debug1: identity file /home/pirat9/.ssh/id_ecdsa type -1
debug1: identity file /home/pirat9/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.5
debug1: no match: Sun_SSH_1.5
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA c8:05:c3:8a:80:47:3b:9b:e1:e1:a2:c8:90:ff:93:e1
debug1: Host '192.168.1.134' is known and matches the RSA host key.
debug1: Found key in /home/pirat9/.ssh/known_hosts:6
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/pirat9/.ssh/id_rsa
debug1: Authentications that can continue: gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive
debug1: Trying private key: /home/pirat9/.ssh/id_dsa
debug1: Trying private key: /home/pirat9/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactiv
pirat9@solaris11:~$ uname -a
SunOS solaris11 5.11 snv_151a i86pc i386 i86pc Solaris
pirat9@solaris11:~$