使用 SSH 连接到 ESXi 主机失败,并显示以下错误:网络错误: 连接被拒绝
search cancel

使用 SSH 连接到 ESXi 主机失败,并显示以下错误:网络错误: 连接被拒绝

book

Article ID: 301382

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Symptoms:
免责声明:本文为 Connecting to the ESXi host using SSH fails with the error: Network error: Connection Refused (1039095) 的翻译版本。尽管我们会不断努力为本文提供最佳翻译版本,但本地化的内容可能会过时。有关最新内容,请参见英文版本。


  • 无法将 ESXi 主机添加到 vCenter Server
  • 无法使用 SSH 连接到 ESXi 主机
  • 使用 SSH 连接到 ESXi 主机失败
  • 您会看到以下错误:

    无法联系指定主机 (IP 地址/主机名)。主机可能在网络上不可用,可能存在网络配置问题,或者此主机上的管理服务可能未响应 (Cannot contact the specified host (IP Address/hostname). The host may not be available on the network, a network configuration problem may exist. or the management service on this host may not be responding)。

  • 无法使用 Putty 连接到 ESXi 主机
  • 使用 Putty 连接到 ESXi 主机时,您会看到以下错误:

    网络错误: 连接被拒绝 (Network error: Connection Refused)

  • 您已启用技术支持模式。有关详细信息,请参见 Using Tech Support Mode in ESXi 4.1 and ESXi 5.0 (1017910)


Environment

VMware vSphere ESXi 5.5
VMware ESXi 4.1.x Installable
VMware ESXi 4.1.x Embedded
VMware vSphere ESXi 5.0
VMware vSphere ESXi 5.1

Cause

如果 /etc/inetd.conf 文件为空或包含的远程 shell 访问权限和 VMware 身份验证守护进程设置不正确,可能会出现此问题。

注意:在 ESXi 5.x 中,inetd.conf 文件位于 /var/run/

Resolution

要解决此问题,请执行以下操作:
  1. 使用基于内核的虚拟机 (KVM)(如 iLO、iLOM、DRAC、RSA 或 IP KVM)直接连接到 ESXi 控制台,按 ALT+F1,然后以 root 身份登录。
  2. 使用文本编辑器打开 inetd.conf 文件。

    要使用 vi 编辑器打开该文件,请运行此命令:

    # vi /etc/inetd.conf

  3. 确保 /etc/inetd.conf 文件的内容类似于:

    # Internet server configuration database


    # Remote shell access

    ssh stream tcp nowait root /sbin/dropbearmulti dropbear ++min=0,swap,group=shell -i -K60
    ssh stream tcp6 nowait root /sbin/dropbearmulti dropbear ++min=0,swap,group=shell -i -K60

    在 ESXi 5.x 中,远程 shell 访问权限下的内容类似于:

    ssh stream tcp nowait root /usr/lib/vmware/openssh/bin/sshd sshd ++swap,group=host/vim/vimuser/terminal/ssh -i
    ssh stream tcp6 nowait root /usr/lib/vmware/openssh/bin/sshd sshd ++swap,group=host/vim/vimuser/terminal/ssh -i


    # VMware authentication daemon
    authd stream tcp nowait root /sbin/authd authd
    authd stream tcp6 nowait root /sbin/authd authd

  4. 保存对该文件所做的更改。

    注意:或者,您也可以使用 WinSCP 等实用程序从已熟知的 ESXi 主机复制 inetd.conf 文件。

  5. 运行此命令重新启动 SSH 守护进程以使更改生效:

    # /etc/init.d/TSM-SSH restart

    注意:在 ESXi 5.x 中,请运行此命令:

    /etc/init.d/SSH restart


Additional Information

Connecting to the ESXi host using SSH fails with the error: Network error: Connection Refused