ping 有效,ssh 超时

ping 有效,ssh 超时

我的笔记本电脑 (10.197.1.xx) 和台式机 (10.141.200.xxx) 上运行着 ubuntu 16.04 (mate)。从其中任何一个我都可以 ping 另一个。但是 ssh 去暂停(它不会拒绝连接,或给出任何警告或错误消息)。

OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 10.197.1.xxx [10.197.1.xxx] port 22.
debug1: connect to address 10.197.1.xxx port 22: Connection timed out
ssh: connect to host 10.197.1.xxx port 22: Connection timed out

有问题的 PC 和笔记本电脑都具有openssh 服务器安装。

$ sudo service sshd status

● ssh.service - OpenBSD Secure Shell server
   Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
   Active: active (running) since Mon 2017-04-10 09:59:50 IST; 4h 49min ago
  Process: 3682 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCES
 Main PID: 1096 (sshd)
   CGroup: /system.slice/ssh.service
           └─1096 /usr/sbin/sshd -D

Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloading OpenBSD Secure Shell serve
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Received SIGHUP; restarting.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloaded OpenBSD Secure Shell server
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on 0.0.0.0 port 22.
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on :: port 22.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloading OpenBSD Secure Shell serve
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Received SIGHUP; restarting.
Apr 10 10:37:18 H110M-DS2 systemd[1]: Reloaded OpenBSD Secure Shell server
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on 0.0.0.0 port 22.
Apr 10 10:37:18 H110M-DS2 sshd[1096]: Server listening on :: port 22.

防火墙状态为不活跃的

sudo ufw status
Status: inactive

可能出什么问题了?我如何让 ssh 工作。

更新

traceroute程序产生以下输出

traceroute to 10.197.1.xxx (10.197.1.xxx), 30 hops max, 60 byte packets
 1  router.xxx.xxxx.xx.in (10.xxx.xxx.1)  1.069 ms  1.388 ms  1.691 ms
 2  10.xxx.xxx.1 (10.xxx.xxx.1)  0.820 ms  0.814 ms  0.974 ms
 3  172.xx.x.1 (172.xx.x.1)  0.371 ms  0.384 ms  0.375 ms
 4  * * *
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  * * *
11  * * *
12  * * *
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *

答案1

sudo apt-get update
sudo apt-get install ssh
sudo ufw allow 22

这是最低限度。它允许在已知端口上无限制地尝试失败的密码。直接 root 登录已禁用(登录后您仍然可以 su 和 sudo)。如果您的用户名和密码是可猜测的,并且互联网可以看到服务器,那么最终就会有人闯入。

默认情况下,root 用户不允许从 ubuntu 外部进行 ssh。你可以改为

sudo sed -ir 's/^(PermitRootLogin) .+/\1 yes/' /etc/ssh/sshd_config
sudo /etc/init.d/ssh restart

如果您仍然遇到问题,请尝试一下,telnet machineip 22它会显示您可以从其他计算机访问 22 端口。尝试按照此使 ssh 安全关联

相关内容