无法从 22.04 LTS 进行 SSH

无法从 22.04 LTS 进行 SSH

我正在通过 USB 连接到我的电脑的外部 SSD 驱动器上运行 22.04 LTS。

我完全无法从那里通过 SSH 连接到任何地方,而且我不知道为什么或者发生了什么(没有发生)。

我可以轻松地从 Windows 以及在普通联想机器上运行的 Ubuntu Server 22.04 LTS 进行连接。

我按照以下说明进行操作https://www.linuxcapable.com/install-enable-connect-to-ssh-on-ubuntu-22-04-lts/总结起来就是:

$ sudo apt install openssh-server -y (Install and enable OpenSSH Server)
$ sudo systemctl enable --now ssh

$ sudo systemctl status ssh:

> ● ssh.service - OpenBSD Secure Shell server
>      Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: e>
>      Active: active (running) since Tue 2022-06-28 23:36:54 CEST; 11h ago
>        Docs: man:sshd(8)
>              man:sshd_config(5)    Main PID: 1004 (sshd)
>       Tasks: 1 (limit: 18726)
>      Memory: 3.1M
>         CPU: 29ms
>      CGroup: /system.slice/ssh.service
>              └─1004 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"
> 
> jun 28 23:36:54 Hakuna systemd[1]: Starting OpenBSD Secure Shell
> server... jun 28 23:36:54 Hakuna sshd[1004]: Server listening on
> 0.0.0.0 port 22. jun 28 23:36:54 Hakuna sshd[1004]: Server listening on :: port 22. jun 28 23:36:54 Hakuna systemd[1]: Started OpenBSD
> Secure Shell server.

$ sudo ufw allow 22/tcp (allow port 22)

> sudo ufw status Status: active
> 
> Til                        Handling    Fra
> ---                        --------    --- 
> 22/tcp                     ALLOW       Anywhere                   
> 22/tcp (v6)                ALLOW       Anywhere (v6)

从现在开始,我应该能够 ssh 到我的 Pihole:

> ssh [email protected] ssh: connect to host 10.0.0.5 port 22: Connection timed out

任何帮助都值得感激,谢谢!

编辑:

从 Ubuntu 桌面到目标

 $ ip addr show
    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
    2: enp0s31f6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
        link/ether f8:75:a4:12:a0:88 brd ff:ff:ff:ff:ff:ff
    3: wlp5s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
        link/ether 28:7f:cf:2b:9e:2c brd ff:ff:ff:ff:ff:ff
        inet 10.0.0.215/24 brd 10.0.0.255 scope global dynamic noprefixroute wlp5s0
           valid_lft 46015sec preferred_lft 46015sec
    5: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
        link/ether 52:54:00:c5:ce:7d brd ff:ff:ff:ff:ff:ff
        inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
           valid_lft forever preferred_lft forever
    6: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 500
        link/none 
        inet 10.8.1.4/24 scope global tun0
           valid_lft forever preferred_lft forever
    11: wlx00c0cab15fb4: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state DORMANT group default qlen 1000
        link/ether 00:c0:ca:b1:5f:b4 brd ff:ff:ff:ff:ff:ff

    $ netstat -r -n
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    0.0.0.0         10.0.0.1        0.0.0.0         UG        0 0          0 wlp5s0
    10.0.0.0        0.0.0.0         255.255.255.0   U         0 0          0 wlp5s0
    10.8.1.0        0.0.0.0         255.255.255.0   U         0 0          0 tun0
    169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 virbr0
    192.168.122.0   0.0.0.0         255.255.255.0   U         0 0          0 virbr0

$ ping 10.0.0.5
PING 10.0.0.5 (10.0.0.5) 56(84) bytes of data.
^C
--- 10.0.0.5 ping statistics ---
188 packets transmitted, 0 received, 100% packet loss, time 191470ms

从 Ubuntu Server 22.04 到目标:

$ ping 10.0.0.5
PING 10.0.0.5 (10.0.0.5) 56(84) bytes of data.
64 bytes from 10.0.0.5: icmp_seq=1 ttl=64 time=33.9 ms
64 bytes from 10.0.0.5: icmp_seq=2 ttl=64 time=1.66 ms
64 bytes from 10.0.0.5: icmp_seq=3 ttl=64 time=1.94 ms
64 bytes from 10.0.0.5: icmp_seq=4 ttl=64 time=1.74 ms
64 bytes from 10.0.0.5: icmp_seq=5 ttl=64 time=13.8 ms
64 bytes from 10.0.0.5: icmp_seq=6 ttl=64 time=1.45 ms
64 bytes from 10.0.0.5: icmp_seq=7 ttl=64 time=1.68 ms
64 bytes from 10.0.0.5: icmp_seq=8 ttl=64 time=4.43 ms
64 bytes from 10.0.0.5: icmp_seq=9 ttl=64 time=1.53 ms
64 bytes from 10.0.0.5: icmp_seq=10 ttl=64 time=4.20 ms
64 bytes from 10.0.0.5: icmp_seq=11 ttl=64 time=5.94 ms
64 bytes from 10.0.0.5: icmp_seq=12 ttl=64 time=2.71 ms
^C
--- 10.0.0.5 ping statistics ---
12 packets transmitted, 12 received, 0% packet loss,

从通过以太网连接到路由器的 Pihole:

ip addr show
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
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether dc:a6:32:33:8c:bd brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.5/24 brd 10.0.0.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever

$ netstat -r -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG        0 0          0 eth0
10.0.0.0        0.0.0.0         255.255.255.0   U         0 0          0 eth0

$ ping 10.0.0.10 (Pinging my 22.04 server)
PING 10.0.0.10 (10.0.0.10) 56(84) bytes of data.
64 bytes from 10.0.0.10: icmp_seq=1 ttl=64 time=1.63 ms
64 bytes from 10.0.0.10: icmp_seq=2 ttl=64 time=1.77 ms
64 bytes from 10.0.0.10: icmp_seq=3 ttl=64 time=1.72 ms
64 bytes from 10.0.0.10: icmp_seq=4 ttl=64 time=5.97 ms
64 bytes from 10.0.0.10: icmp_seq=5 ttl=64 time=0.870 ms
64 bytes from 10.0.0.10: icmp_seq=6 ttl=64 time=6.84 ms
^C
--- 10.0.0.10 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 13ms
rtt min/avg/max/mdev = 0.870/3.134/6.844/2.346 ms

我已经从我的服务器连接到我的 pihole。一切按计划进行。

答案1

禁用 NordVPN 就成功了。难以置信这么简单!

为了使 Ubuntu 与 NordVPN 一起工作,我对设置进行了以下更改:

> $ nordvpn whitelist add subnet 10.0.0.0/24

我还添加了我的 pihole DNS 服务器,如下:

> $ nordvpn set dns 10.0.0.5

来源: https://support.nordvpn.com/da/Forbindelse/Linux/1807056062/Installation-af-NordVPN-pao-Debian-Ubuntu-Raspberry-Pi-Elementary-OS-og-Linux-Mint.htm

现在,请允许我先对着枕头尖叫一会儿,然后再想办法感谢@user68186 提供了正确的答案。

再次感谢大家对我的帮助。这对我意义重大。

相关内容