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