リモートシステムへのSSHログインが遅い。

リモートシステムへのSSHログインが遅い。

あるコンピュータからリモートコンピュータへのSSHログインは非常に遅いです。以下の2つのブロックはSSHの詳細を示しています。以下のブロックでは、sshは15秒間停止します。

[root@zabbix ~]# ssh -vvv [email protected]
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 172.18.xxx.xx [172.18.xxx.xx] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.1.4
debug1: no match: Sun_SSH_1.1.4
debug1: Enabling compatibility mode for protocol 2.0
...............
...............
debug1: Trying private key: /root/.ssh/id_dsa
debug3: no such identity: /root/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: Wrote 96 bytes for a total of 1205

sshはここで約15秒間停止し、パスワードを要求します。

debug2: input_userauth_info_req
debug2: input_userauth_info_req: num_prompts 1
Password:

パスワードを入力すると、次のように行末に停止します。

debug3: packet_send2: adding 32 (len 23 padlen 9 extra_pad 64)
debug3: Wrote 80 bytes for a total of 1285
debug1: Authentication succeeded (keyboard-interactive).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug3: Wrote 64 bytes for a total of 1349

約15秒後にログインに成功しました。

私の質問は、SSHの試みをより速くするにはどうすればよいですか?

このログイン試行は、RHEL 6.2 システムから Solaris 10 システムで行われます。最初はこれがネットワークの問題かもしれないと思いましたが、そのような静止現象がなくても、他のSolaris 10システムで上記と同じリモートSolarisシステムにログインできることがわかりました。

リモートSolarisシステムのSSHバージョンは次のとおりです。

$ ssh -V
Sun_SSH_1.1.4, SSH protocols 1.5/2.0, OpenSSL 0x0090704f

RHELシステムのSSHバージョンは次のとおりです。

[root@zabbix ~]# ssh -V
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010

リモートSolaris 10コンピュータは、物理Solaris 10コンピュータの領域です。ローカルRHELシステムから物理Solaris 10システムへのSSH経由の接続は非常に高速です。もしそうなら、ネットワークの問題はまったくないようです。

修正する:リモートSolaris 10システムのsshd_configファイルに、次の有効なディレクティブをすべて追加します。

Protocol 2
Port 22
ListenAddress 0.0.0.0
AllowTcpForwarding yes
GatewayPorts yes
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
PrintMotd no
KeepAlive yes
SyslogFacility auth
LogLevel info
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
ServerKeyBits 768
KeyRegenerationInterval 3600
StrictModes yes
LoginGraceTime 600
MaxAuthTries    6
MaxAuthTriesLog 3
PermitEmptyPasswords no
PasswordAuthentication yes
PAMAuthenticationViaKBDInt yes
Subsystem   sftp    internal-sftp
IgnoreRhosts yes
RhostsAuthentication no
RhostsRSAAuthentication no
RSAAuthentication yes

ご意見ありがとうございました。

ありがとう

ベストアンサー1

RHELマシンでは、以下を試してください。

ssh -o GSSAPIAuthentication=no [email protected]

機能する場合は、次の内容を~/.ssh/config編集して追加して永久に作成します。

GSSAPIAuthentication no

また、RHELがDNSに表示されていること(サーバーの観点から)を確認してください。サーバーは、リバースDNS解決を確認しようとします。失敗すると遅延が発生します。

このチェックは無効にできます。

編集する/etc/ssh/sshd_config

OpenSSH:使用UseDNS no

ソラリス:使用LookupClientHostnames no

再起動sshdしてログインする速度が速くなります。

おすすめ記事