AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1348041
Accepted
Justin Brunkow
Justin Brunkow
Asked: 2021-06-25 18:06:58 +0800 CST2021-06-25 18:06:58 +0800 CST 2021-06-25 18:06:58 +0800 CST

为什么我不能再通过 SSH 连接到我的 Ubuntu 虚拟机了?

  • 772

我有几个基于 Debian 的 Linux 发行版在 Windows 10 上的 VMware Workstation Player 上运行。我曾经能够从 PowerShell 或 Ubuntu (WSL) 终端从主机通过 SSH 连接到虚拟机,没有任何问题。但最近我一直无法这样做。

首先我在虚拟机上启动 SSH 服务。

service ssh start

然后我验证服务正在运行。

service ssh status
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: e>
     Active: active (running) since Sat 2021-06-26 11:30:42 PDT; 1min 14s ago
       Docs: man:sshd(8)
             man:sshd_config(5)
    Process: 872 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
   Main PID: 898 (sshd)
      Tasks: 1 (limit: 9448)
     Memory: 2.8M
     CGroup: /system.slice/ssh.service
             └─898 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

Jun 26 11:30:42 ubuntu systemd[1]: Starting OpenBSD Secure Shell server...
Jun 26 11:30:42 ubuntu sshd[898]: Server listening on 0.0.0.0 port 22.
Jun 26 11:30:42 ubuntu sshd[898]: Server listening on :: port 22.
Jun 26 11:30:42 ubuntu systemd[1]: Started OpenBSD Secure Shell server.

我验证IP地址。

hostname -I
192.168.75.129

ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:a0:15:34 brd ff:ff:ff:ff:ff:ff
    altname enp2s1
    inet 192.168.75.129/24 brd 192.168.75.255 scope global dynamic noprefixroute ens33
       valid_lft 1714sec preferred_lft 1714sec
    inet6 fe80::98eb:dd0a:da24:92be/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

...但 Windows 子系统上的 Ubuntu for Linux 无法连接。

ssh 192.168.75.129
ssh -vvv 192.168.75.129
OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.75.129 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.75.129 [192.168.75.129] port 22.
debug1: connect to address 192.168.75.129 port 22: Resource temporarily unavailable
ssh: connect to host 192.168.75.129 port 22: Resource temporarily unavailable

...并且 PowerShell 超时。

ssh -vvv 192.168.75.129
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug3: Failed to open file:C:/Users/me/.ssh/config error:2
debug3: Failed to open file:C:/ProgramData/ssh/ssh_config error:2
debug2: resolve_canonicalize: hostname 192.168.75.129 is address
debug2: ssh_connect_direct
debug1: Connecting to 192.168.75.129 [192.168.75.129] port 22.
debug3: finish_connect - ERROR: async io completed with error: 10060, io:000001B003450380
debug1: connect to address 192.168.75.129 port 22: Connection timed out
ssh: connect to host 192.168.75.129 port 22: Connection timed out

NMAP 返回以下扫描。

nmap -Pn -p 22 192.168.75.129
Warning: Nmap may not work correctly on Windows Subsystem for Linux.
For best performance and accuracy, use the native Windows build from https://nmap.org/download.html#windows.
Starting Nmap 7.80 ( https://nmap.org ) at 2021-06-26 13:36 CDT
NSOCK ERROR [0.0460s] mksock_bind_device(): Setting of SO_BINDTODEVICE failed (IOD #1): Protocol not available (92)
NSOCK ERROR [0.0470s] mksock_bind_device(): Setting of SO_BINDTODEVICE failed (IOD #2): Protocol not available (92)
NSOCK ERROR [0.0470s] mksock_bind_device(): Setting of SO_BINDTODEVICE failed (IOD #3): Protocol not available (92)
Problem binding to interface , errno: 92
socket_bindtodevice: Protocol not available
Problem binding to interface , errno: 92
socket_bindtodevice: Protocol not available
Nmap scan report for 192.168.75.129
Host is up.

PORT   STATE    SERVICE
22/tcp filtered ssh

Nmap done: 1 IP address (1 host up) scanned in 2.09 seconds

...以及来自 Windows 上的 nmap。

PS C:\Users\me> cd '\Program Files (x86)\nmap'
PS C:\Program Files (x86)\nmap> ./nmap.exe -Pn -p 22 192.168.75.129
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.
WARNING: Could not import all necessary Npcap functions. You may need to upgrade to the latest version from https://npcap.org. Resorting to connect() mode -- Nmap may not function completely
Starting Nmap 7.91 ( https://nmap.org ) at 2021-06-26 13:36 Central Daylight Time
Nmap scan report for 192.168.75.129
Host is up.

PORT   STATE    SERVICE
22/tcp filtered ssh

Nmap done: 1 IP address (1 host up) scanned in 2.17 seconds

我究竟做错了什么?

ssh
  • 3 3 个回答
  • 1448 Views

3 个回答

  • Voted
  1. Best Answer
    Justin Brunkow
    2021-06-27T12:21:09+08:002021-06-27T12:21:09+08:00

    问题一定出在主机上的 VMware Workstation 16 Player 上。我重新安装了 VMware Workstation,它又开始工作了。

    • 0
  2. mohsen ilanluo
    2021-11-26T10:26:11+08:002021-11-26T10:26:11+08:00

    我遇到了你的问题,最后我通过禁用网络和互联网设置中的所有 vmware 网络适配器来解决它。这样做:

    1. 转到 Windows 中的控制面板\网络和 Internet\网络连接
    2. 禁用所有 vmware 适配器
    3. 再次启用它们
    4. 测试你的 ssh 和 ping,尽情享受吧!
    • 0
  3. mohsen ilanluo
    2021-11-30T10:56:38+08:002021-11-30T10:56:38+08:00

    开窗设置:

    1. 单击网络_和 Internet。
    2. 选择更改网络选项。
    3. 禁用任何 VMware 网络适配器并再次启用它们。

    如果您没有看到任何与 VMware 相关的内容,我建议您删除并重新安装您的 VMware。

    • 0

相关问题

  • Gnome-terminal 快捷方式在选项卡中打开多个 ssh 连接

  • 通过 SSH 禁用密码访问?

  • ssh 如何使用多个私钥?

  • 如何通过一个 SSH 连接拥有多个终端会话?

  • 如何与无头服务器进行图形交互?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve