ubuntu20.04物理机无法被ssh连接,也不能被ping通
-
- 帖子: 7
- 注册时间: 2022-04-02 14:36
- 系统: Ubuntu20.04
ubuntu20.04物理机无法被ssh连接,也不能被ping通
上周还能用装windows的新电脑通过ssh连接,昨天就不能连接了,但是昨天能被ping通。今天不能ssh也不能ping,ubuntu上运行ssh localhost没问题,也能上网。windows上显示 ssh: connect to host 192.168.31.129 port 22:Connection timed out.
krs@krs-Inspiron-3559:~$ sudo ufw status numbered
Status: active
To Action From
-- ------ ----
[ 1] 22/tcp ALLOW IN Anywhere
[ 2] 22 ALLOW IN Anywhere
[ 3] 80/tcp ALLOW IN Anywhere
[ 4] 22/tcp (v6) ALLOW IN Anywhere (v6)
[ 5] 22 (v6) ALLOW IN Anywhere (v6)
[ 6] 80/tcp (v6) ALLOW IN Anywhere (v6)
防火墙看22号端口也没问题啊。
krs@krs-Inspiron-3559:~$ sudo ufw status numbered
Status: active
To Action From
-- ------ ----
[ 1] 22/tcp ALLOW IN Anywhere
[ 2] 22 ALLOW IN Anywhere
[ 3] 80/tcp ALLOW IN Anywhere
[ 4] 22/tcp (v6) ALLOW IN Anywhere (v6)
[ 5] 22 (v6) ALLOW IN Anywhere (v6)
[ 6] 80/tcp (v6) ALLOW IN Anywhere (v6)
防火墙看22号端口也没问题啊。
- astolia
- 论坛版主
- 帖子: 6538
- 注册时间: 2008-09-18 13:11
Re: ubuntu20.04物理机无法被ssh连接,也不能被ping通
你确定ubuntu机器的ip地址是192.168.31.129?
-
- 帖子: 7
- 注册时间: 2022-04-02 14:36
- 系统: Ubuntu20.04
Re: ubuntu20.04物理机无法被ssh连接,也不能被ping通
确定 的我对了的
krs@krs-Inspiron-3559:~$ ifconfig | grep inet
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
inet 192.168.31.129 netmask 255.255.255.0 broadcast 192.168.31.255
inet6 fe80::8fe0:28a7:b7a1:172c prefixlen 64 scopeid 0x20<link>
- astolia
- 论坛版主
- 帖子: 6538
- 注册时间: 2008-09-18 13:11
Re: ubuntu20.04物理机无法被ssh连接,也不能被ping通
检查过硬件没有?说不定是两方连接的路由器故障,你重启一下路由器呢?
-
- 帖子: 7
- 注册时间: 2022-04-02 14:36
- 系统: Ubuntu20.04
- astolia
- 论坛版主
- 帖子: 6538
- 注册时间: 2008-09-18 13:11
Re: ubuntu20.04物理机无法被ssh连接,也不能被ping通
那你看一下sshd是不是在监听22端口,sudo ss -ltnp 和 systemctl status sshd
-
- 帖子: 7
- 注册时间: 2022-04-02 14:36
- 系统: Ubuntu20.04
Re: ubuntu20.04物理机无法被ssh连接,也不能被ping通
krs@krs-Inspiron-3559:~$ sudo ss -ltnp | grep 22
LISTEN 0 128 0.0.0.0:22 0.0.0.0:* users:(("sshd",pid=817,fd=3))
LISTEN 0 70 127.0.0.1:33060 0.0.0.0:* users:(("mysqld",pid=901,fd=22))
LISTEN 0 128 [::]:22 [::]:* users:(("sshd",pid=817,fd=4))
krs@krs-Inspiron-3559:~$ systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2022-04-02 13:33:32 CST; 1h 57min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 817 (sshd)
Tasks: 1 (limit: 9260)
Memory: 4.9M
CGroup: /system.slice/ssh.service
└─817 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
Apr 02 13:33:32 krs-Inspiron-3559 systemd[1]: Starting OpenBSD Secure Shell server...
Apr 02 13:33:32 krs-Inspiron-3559 sshd[817]: Server listening on 0.0.0.0 port 22.
Apr 02 13:33:32 krs-Inspiron-3559 sshd[817]: Server listening on :: port 22.
Apr 02 13:33:32 krs-Inspiron-3559 systemd[1]: Started OpenBSD Secure Shell server.
Apr 02 14:24:42 krs-Inspiron-3559 sshd[13008]: Accepted password for krs from 127.0.0.1 port 54494 ssh2
Apr 02 14:24:42 krs-Inspiron-3559 sshd[13008]: pam_unix(sshd:session): session opened for user krs by (uid=0)
这是OBS占用了22端口吗?
- astolia
- 论坛版主
- 帖子: 6538
- 注册时间: 2008-09-18 13:11
Re: ubuntu20.04物理机无法被ssh连接,也不能被ping通
你看一下windows机器分配的ip地址是什么,是不是和192.168.31.129在同一个子网。有可能是你的网络环境里有其他的dhcp服务器给你windows机器分配了其他的ip地址。
如果是在同一个子网,再到windows的命令行下面运行arp -a,看看192.168.31.129对应的mac地址是不是和ubuntu机器的一致,否则就是遭到了arp攻击
如果是在同一个子网,再到windows的命令行下面运行arp -a,看看192.168.31.129对应的mac地址是不是和ubuntu机器的一致,否则就是遭到了arp攻击
-
- 帖子: 7
- 注册时间: 2022-04-02 14:36
- 系统: Ubuntu20.04
Re: ubuntu20.04物理机无法被ssh连接,也不能被ping通
大神,我重新连的我宿舍的网,windows的ip是10.60.194.138 子网掩码是255.255.224.0, ubuntu的是10.50.7.171 子网掩码是255.255.248.0。但是windows上使用arp -a没有ubuntu的这个ip,也没它的mac地址
- astolia
- 论坛版主
- 帖子: 6538
- 注册时间: 2008-09-18 13:11
-
- 帖子: 7
- 注册时间: 2022-04-02 14:36
- 系统: Ubuntu20.04
-
- 帖子: 7
- 注册时间: 2022-04-02 14:36
- 系统: Ubuntu20.04
Re: ubuntu20.04物理机无法被ssh连接,也不能被ping通
找到问题了 我windows那边的ssh有问题不是ubuntu这边的问题,谢谢大神了