Linux的Xshell连接Centos7能Ping通但无法连接问题[ssh(d)+firewall(d)]【转载转载转载】
生活随笔
收集整理的這篇文章主要介紹了
Linux的Xshell连接Centos7能Ping通但无法连接问题[ssh(d)+firewall(d)]【转载转载转载】
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
一 方案與思路
- 0 xshell客戶端監測是否能夠ping通目標服務器。
- 前提:知曉目標服務器IP地址
- Linux: ifconfig -a
- Windows: ipconfig -a
- 前提:知曉目標服務器IP地址
- 1 利用firewall工具,檢查是否已開啟ssh的22端口。若無,則:開啟22端口
- 2 利用sshd工具,檢查是否已開啟sshd服務。若無,則:開啟sshd服務
- 開(重)啟ssh服務: system (re)start sshd
- 3 利用systemctl工具,檢查是否已開啟sshd、firewalld的開機自啟服務。若無,則:開啟sshd、firewalld服務的開機自啟
- systemctl enable sshd
- systemctl list-unit-files | grep sshd
- systemctl enable firewalld[.service]
- systemctl list-unit-files | grep firewall
回到頂部
二 相關知識及操作命令
關鍵工具
ssh:客戶端,主要進行服務器端的連接
sshd:服務端,作用于服務器端(開閉ssh服務等操作)
ssh————————————>sshd
client serve
firewalld(防火墻)
firwall-cmd(Linux提供的操作firewall的一個工具)
systemctl(服務控制命令)
1 sshd
- 查看服務狀態
inactive(不可用),active(可用,活動狀態)
systemctl status sshd- 列出已開啟服務當前狀態
- 開啟ssh服務
- 設定服務開機啟動
- 查看sshd開機自啟服務是否已開啟
- 關閉ssh服務
- 設定服務開機不啟動
- 重啟ssh服務
- 重新加載服務配置
2 防火墻
2.1 查看
- 查看firewall服務狀態
- 查看防火墻狀態
- 查看防火墻規則
?
- 查詢端口是否開放
2.2 操縱
1.2.1 firewall端口
- 開放端口
例如,80端口
--permanent:表示設置為持久;
--add-port:標識添加的端口;
- 移除端口
1.2.2 firewall服務
- 開啟
- 重啟
- 啟用/禁用 開機自啟
- 關閉
2.3 補充: CentOS6的防火墻操作
# 查看防火墻狀態 service iptables status# 停止防火墻 service iptables stop# 啟動防火墻 service iptables start# 重啟防火墻 service iptables restart# 永久關閉防火墻 chkconfig iptables off# 永久關閉后重啟 chkconfig iptables on總結
以上是生活随笔為你收集整理的Linux的Xshell连接Centos7能Ping通但无法连接问题[ssh(d)+firewall(d)]【转载转载转载】的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: tft lcd驱动参数详解_LED拼接屏
- 下一篇: mysql 命令 _Mysql常用命令行