centos7:
问题:连接本地虚拟机时,连接不上,报错--Network error: Connection refused
原因:
1.刚开始直接ping主机,是可以ping通的,说明网络是正常的
[root@szb ~]# ping 192.168.8.132
PING 192.168.8.132 (192.168.8.132) 56(84) bytes of data.
64 bytes from 192.168.8.132: icmp_seq=1 ttl=64 time=0.969 ms
64 bytes from 192.168.8.132: icmp_seq=2 ttl=64 time=4.00 ms
2.查询sshd安装了没,说明是存在的
[ly@192 ~]$ ps -e |grep ssh
8245 ? 00:00:00 ssh-agent
3.ss -ntl 查询22端口是否开启,此处没有22端口
[ly@192 ~]$ ss -ntl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 5 192.168.122.1:53 *:*
LISTEN 0 128 127.0.0.1:631 *:*
LISTEN 0 128 [::1]:631 [::]:*
解决办法:确认一下是否还是默认的端口,vim /etc/ssh/sshd_config,显示没有被修改
4.重启sshd服务,在查看端口,已经存在22端口了,MobaXterm软件重连接,可以了
systemctl restart sshd
Ubuntu 18.04:
sudo apt-get update
sudo apt-get install -y openssh-server
systemctl start sshd
Find your Ubuntu IP address
ifconfig
Finally open mobaXterm
Seeing that the connection is successful