2023年12月2日发(作者:)

ssh连接不上,显示port22:Noroutetohost问题:ssh从到同一猫下的ubuntu电脑(从A到B),连接不上,提示:port 22: No route to host X X X X port 22: No route to host解决办法:1、 在A上ping B:ping xxxx(B):From XXXX(B) icmp_seq=1 Destination Host UnreachableFrom XXXX(A) icmp_seq=4 Destination Host Prohibited从B上ping A是通的,在B上ssh A也时可以的在B上查看防火墙是否打开:a、service iptables statusb、systemctl status firewalld如果有dead inactive,就是关闭的,有active runing就是打开的关闭防火墙:a、service iptables stopb、service firewalld stop然后查看端口22是否开放firewall-cmd --query-port=22/tcp如果打印no表示没有开放开启端口:firewall-cmd --permanent --add-port=22/tcp然后再在A上ssh B,提示:@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!Someone could be eavesdropping on you right now (man-in-the-middle attack)!It is also possible that a host key has just been fingerprint for the ECDSA key sent by the remote host isSHA256:3QAGDLxRu0eK/tXjwV9I8KvEPwAjrbs5/ contact your system correct host key in /home/xxx/.ssh/known_hosts to get rid of this ing ECDSA key in /home/xxx/.ssh/known_hosts:5 remove with: ssh-keygen -f "/home/xxx/.ssh/known_hosts" -R "10.0.0.40"ECDSA host key for 10.0.0.40 has changed and you have requested strict key verification failed.用提示的命令:ssh-keygen -f "/home/xxx/.ssh/known_hosts" -R "10.0.0.40"删除key,重新ssh成功