问题分析

vmware配置的fedora虚拟机, 主机能ping通虚拟机, 虚拟机也能ping通主机。但是用PUTTY连接虚拟机的时候出现 Network error: Connection refused。

排查方法

1、查看SSH服务有没有安装

#rpm -qa | grep ssh

[root@localhost ~]# rpm -qa|grep ssh
openssh-clients-6.1p1-4.fc18.i686
openssh-6.1p1-4.fc18.i686
libssh2-1.4.2-2.fc18.i686
openssh-server-6.1p1-4.fc18.i686

2、查看SSH服务有没有开启

#/bin/systemctl status  sshd.service

sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: active (running) since Wed, 2018-12-19 07:45:03 EST; 2h 1min ago
Process: 687 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
Main PID: 695 (sshd)
CGroup: name=systemd:/system/sshd.service
└ 695 /usr/sbin/sshd -D Dec 19 07:45:03 localhost.localdomain systemd[1]: Started OpenSSH server daemon.
Dec 19 07:45:03 localhost.localdomain sshd[695]: Server listening on 0.0.0.0 port 22.
Dec 19 07:45:03 localhost.localdomain sshd[695]: Server listening on :: port 22.
Dec 19 08:41:30 localhost.localdomain sshd[14675]: Nasty PTR record "192.168.2.1" is set up for 192.168.2.1, ignoring
Dec 19 08:41:32 localhost.localdomain sshd[14675]: Accepted password for root from 192.168.2.1 port 8883 ssh2

如果没有开启sshd

#/bin/systemctl start sshd.service

#/bin/systemctl enable sshd.service

   3、查看所有的端口

#netstat  -tlnp

[root@localhost init.d]# netstat -tlnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 686/rpcbind
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 695/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 14031/sendmail: acc
tcp6 0 0 :::111 :::* LISTEN 686/rpcbind
tcp6 0 0 :::22 :::* LISTEN 695/sshd

4、查看ssh使用的22号端口有没有enable

#netstat -an|grep 22

[root@localhost init.d]# netstat -an|grep 22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 192.168.2.10:22 192.168.2.1:8883 ESTABLISHED
tcp 0 0 192.168.2.10:22 192.168.2.1:10291 ESTABLISHED
tcp6 0 0 :::22 :::* LISTEN
unix 3 [ ] STREAM CONNECTED 16822
unix 3 [ ] STREAM CONNECTED 14221 /run/systemd/journal/stdout
unix 3 [ ] STREAM CONNECTED 18622
unix 3 [ ] STREAM CONNECTED 16722 /var/run/dbus/system_bus_socket

5、采用SSH能不能正常连接

#ssh root@192.168.2.10

[root@localhost init.d]# ssh root@192.168.2.10
The authenticity of host '192.168.2.10 (192.168.2.10)' can't be established.
RSA key fingerprint is dd:bc:ab:9f:46:e9:7a:e8:47:37:41:3b:3e:af:a4:25.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.2.10' (RSA) to the list of known hosts.
Last login: Wed Dec 19 09:52:01 2018 from 192.168.2.1

6、把Linux防火墙都关闭

[root@localhost ~]# /bin/systemctl status  iptables.service
iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
Active: inactive (dead)
CGroup: name=systemd:/system/iptables.service

vmware上虚拟机:Network error: Connection refused 排查的更多相关文章

  1. 亚马逊的PuTTY连接AWS出现network error connection refused,终极解决方案。

    使用PuTTY连接AWS的时候,一直出现network error connection refused.百度了这个问题,大家都说是SSH要设置成22.但是我已经设置过了,为什么还是遇到这个问题呢? ...

  2. 使用putty远程登录Ubuntu时,报Network error:Connection refused错误及解决(记录)

    putty远程登录Ubuntu,弹出Network error:Connection refused的错误提示框,就是因为Ubuuntu没有安装ssh服务.执行命令: sudo apt-get ins ...

  3. 使用putty远程登录Ubuntu时,报Network error:Connection refused错误及解决

    putty远程登录Ubuntu,弹出Network error:Connection refused的错误提示框,就是因为Ubuuntu没有安装ssh服务. 执行命令: sudo apt instal ...

  4. 使用putty远程登录Ubuntu时,报Network error:Connection refused错误

    putty远程登录Ubuntu,弹出Network error:Connection refused的错误提示框,就是因为Ubuuntu没有安装ssh服务.执行命令: sudo apt-get ins ...

  5. putty连接ubuntu:network error:connection refused

    原因: ubuntu存在一个bug:在/var/run/目录下缺少一个文件夹sshd 解决方法: 在命令行输入: sudo mkdir /var/run/sshd sudo /usr/sbin/ssh ...

  6. 《tortoisegit》 Network error:Connection refused

    在用tortoisegit克隆的时候,或者push的时候出现错误提示: 尝试修改:c:\windows\system32\drivers\etc\services 中的ssh端口,但是发现是22端口, ...

  7. vmware复制虚拟机出现Error:No suitable device found:no device found for connection 'System eth0'

    vmware复制虚拟机出现Error:No suitable device found:no device found for connection 'System eth0' 废话不多说,直接给出解 ...

  8. Ganglia 入门介绍及解决fsockopen error: Connection refused问题

    一,问题描述 Ganglia的各个组件安装情况(不是我装的,只知道这些信息): 集群一共有4台机器,分别是192.168.121.34-37.Gmetad.Gweb和httpd 安装在 192.168 ...

  9. 项目的ip地址更改,用git从远程提取代码出现错误,提示为 network error connection timed out

    昨天公司的ip进行了修改,在今天从远程提取代码的过程中提示network error connection timed out错误,从网上看了一下解决方法 1:打开项目文件夹,点击查看 2:勾选隐藏的 ...

随机推荐

  1. 三星S8相机黑画面解决

    最近手机刷机卸载系统软件后有遇到相机黑化面不能工作的情况,同时闪光灯也无法开启,人脸识别也无法使用.具体情况如下图. 后来接上电脑打开logcat,发现相机相关的错误,说libquramresize. ...

  2. Python 从入门到实践 试一试 参考代码

    这两天学习Python 看了python从入门到实践的书籍,里面有课后题“试一试” 然后就跟着写了,代码在以下地址,如果需要自取 https://files.cnblogs.com/files/fud ...

  3. (原创)Verilog三段式状态机

    下面以上图一个简单的FSM说明三段式Verilog状态机范式: `timescale 1ns / 1ps module FSM( clk,rst_n, in1,in2, out1,out2, CS,N ...

  4. vue生命周期中created和mounted的区别

    created在渲染页面之前使用,通常是用来渲染页面 mounted通常是在渲染页面之后,用来操作dom节点 通常情况下使用created比较多,使用mounted相对少一些,一些情况使用mounte ...

  5. erlang开发工具之intellij idea基本使用

    其他废话就不多说了,接下来主要是介绍怎么来用idea搭建项目让我们能更好的使用好开发工具. (这边假设你已经下载好了intellij idea关于erlang的插件,如果没有安装好,请先去google ...

  6. Linux命令基础2-ls命令

    本文介绍的是linux中的ls命令,ls的单词是list files的缩写,意思的列出目录文件. 首先我们在admin用户的当前路径,新建一个test的文件夹,为了方便本文操作和介绍,创建了不同文件类 ...

  7. 常用的CMD & Linux命令

    [CMD命令] 1.分行输入环境变量 使用echo %PATH%输出环境变量的时候没有分行输出,看起来十分麻烦: 通过xargs命令可以实现分行输出,命令如下: echo %PATH% | xargs ...

  8. Mysql远程访问报错2003

    如果没有权限新建一个mysql用户给添加远程连接的权限(推荐设置) 1.例如,你想admin使用123456从任何主机连接到mysql服务器的话. GRANT ALL PRIVILEGES ON *. ...

  9. windows下用XShell远程控制ubuntu时连接失败

    主机和Ubuntu可以相互Ping通,但是XShell远程控制失败. 查看Ip地址方法:ifconfig 解决方案: 1.查看,关闭防火墙状态:sudo ufw disable 2.开放22端口:su ...

  10. spring注解注入:<context:component-scan>详解

    spring从2.5版本开始支持注解注入,注解注入可以省去很多的xml配置工作.由于注解是写入java代码中的,所以注解注入会失去一定的灵活性,我们要根据需要来选择是否启用注解注入. 我们首先看一个注 ...