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 Unreachable
From XXXX(A) icmp_seq=4 Destination Host Prohibited
從B上ping A是通的,在B上ssh A也時可以的
在B上查看防火墻是否打開:
a、service iptables status
b、systemctl status firewalld
如果有dead inactive,就是關閉的,有active runing就是打開的
關閉防火墻:
a、service iptables stop
b、service firewalld stop
然後查看端口22是否開放
firewall-cmd --query-port=22/tcp
如果打印no表示沒有開放
開啟端口:
firewall-cmd --permanent --add-port=22/tcp
然後再在A上ssh B,提示:
用提示的命令:
ssh-keygen -f "/home/xxx/.ssh/known_hosts" -R "10.0.0.40"
刪除key,重新ssh成功