天天看点

Xshell 连接故障的解决方法

1、检查服务端:网卡、IP是不是启动和正确的

ip add / fconfig /ip a

(在虚拟机里检查网卡配置文件)

centos 6:setup 图形化更改网卡信息

centos7网卡配置文件:/etc/sysconfig/network- scripts/ifcfg-eht0

配置成功重启 :systemctl restart network

2、检查服务端:端口和进程

查端口:ss -lntup| netstat -lntup

查进程:ps -ef|grep ssh

想让他提供服务

systemctl start sshd

3、客户端:IP、端口、协议是不是对的。

眼睛查。

都是对的,就是连不上,咋办?

A、ping 10.0.0.200 检查物理连接能否到达。

[c:~]$ ping 10.0.0.200

正在 Ping 10.0.0.200 具有 32 字节的数据:

来自 10.0.0.200 的回复: 字节=32 时间=2ms TTL=64

来自 10.0.0.200 的回复: 字节=32 时间<1ms TTL=64

如果不可达:

1、连接的IP输入错了。(检查)

2、物理链路有问题(VM环境调虚拟网络编辑器 vm8/vm1网卡 修改后重启)

B、telnet 10.0.0.200 22 检查对方有没有提供服务,开启服务。

[c:~]$ telnet 10.0.0.200 22

Connecting to 10.0.0.200:22…

Connection established.

To escape to local shell, press ‘Ctrl+Alt+]’.

SSH-2.0-OpenSSH_7.4

连不上的状态:

[c:~]$ telnet 10.0.0.200 333

Connecting to 10.0.0.200:333…

1、服务端今天休息,没有提供服务(在此不成立)。

2、防火墙(6是iptables,7是firewalld)。

查看状态:systemctl status firewalld.service

#active (running)活着的状态

#Active: inactive (dead) 死的状态。

关闭:systemctl stop firewalld.service

启动:systemctl start firewalld.service

开机不自动启动:systemctl disable firewalld.service

继续阅读