ssh遇到port 22:No route to host问题的解决方法
一 iptables 问题
1.没有安装,可以先安装
yum install iptables
2.防火墙的开启与关闭
即时生效,重启失效
service iptables start(开启)
service iptables stop(关闭)
service iptables restart(重启)
永久生效
chkconfig iptables on(开启)
chkconfig iptables off(关闭)
查看防火墙运行状态
service iptables status
3.清除防火墙规则
iptables -F
iptables -X
iptables -Z
4.开放端口22
iptables -A INPUT -p tcp –dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp –sport 22 -j ACCEPT
5保存设置
/etc/rc.d/init.d/iptables save
service iptables restart(重启一下)
iptables操作最后都记得要执行一下此步骤(如3, 4)
6 查看防火墙规则
iptables -nL
7 直接向防火墙?件中添加规则
vi /etc/iptables.test.rules
iptables-restore < /etc/iptables.test.rules(改完后先加载规则)
iptables-save > /etc/iptables.rules(保存规则)
二SSH问题
1 ssh运行状态
service sshd status
如果出现
Loaded: error (Reason: No such file or directory)
说明ssh没有安装
检查是否装了ssh包
rpm -qa|grep ssh
没?的话
yum install openssh-server
或者
yum install sshd
(卸载ssh服务)yum remove sshd
如果出现
openssh-daemon is stopped
说明安装了ssh但是没有开启
即时生效,重启失效
service sshd start
service sshd stop
永久生效
chkconfig sshd on
chkconfig sshd off
2修改ssh默认端口22(本例改为3547)
vi /etc/sysconfig/iptables
加入
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3547 -j ACCEPT
重启防火墙
/etc/init.d/iptables restart
(可选)
可根据你的ssh状况屏蔽22端口
vi /etc/sysconfig/iptables
在
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dport 22 -j ACCEPT
前面加上#注释掉此语句
记得重启防?墙
安装semanage
yum -y install policycoreutils-Python
开放指定端口
semanage port -a -t ssh_port_t -p tcp 3547
重启ssh服务
/etc/init.d/sshd restart
查看端口情况
semanage port -l|grep ssh
应该能看到
ssh_port_t tcp 3547, 22
3查看端口状态
netstat -antulp|grep ssh
ssh遇到port 22:No route to host问题的解决方法的更多相关文章
- ubuntu系统ssh遇到port 22:No route to host问题
ssh遇到这个port 22:No route to host这个问题 检查防火墙状态 (iptables -L) 检查ssh状态 (ps -elf |grep ssh) 检查网络状态(换根网线)
- <Linux> Ubuntu error: ssh: connect to host master port 22: No route to host lost connection
iptables当找到匹配的规则时,就会执行相应的动作,而不会向下继续匹配.因为ssh端口开放的规则在all规则之后,所以永远都不会匹配到,也就是ssh永远被禁止. root下执行:iptables ...
- 使用wifi ssh: connect to host hadoop000 port 22: No route to host
使用的wifi,在wifi下IP会自动分配. 先尝试能否ping通,如果都无法ping通那先把IP配置那些先搞定ping通之后遇到此问题再来尝试解决. 查看 /etc/hosts 中配置的 IP ...
- Windows10 下 github ssh 访问出现 Permission denied(publickey)错误的解决方法
Windows10 下 github ssh 访问出现 Permission denied(publickey)错误的解决方法. 错误信息: git clone git@github.com:ediw ...
- CentOS下配置Hadoop集群:java.net.NoRouteToHostException: No route to host问题的解决
我用的是hadoop 1.2.1 遇到的问题是: hadoop中datanode无法启动,报Caused by: java.net.NoRouteToHostException: No route t ...
- 批处理命令篇--配置免安装mysql 5.6.22, 以及1067错误的一个解决方法
mysql 服务启动出现1067错误的一个解决方法: 当服务启动出现1067错误时,可查看“windows 事件查看器”,发现类似错误提示 Can't find messagefile 'F:\ ...
- 修改ubuntu DNS的步骤/wget url报错: unable to resolve host address的解决方法
wget url 报错:unable to resolve host address ‘url’,显然是无法解析主机地址,这就能看出是DNS解析的问题.解决办法就是配置可用的dns 一般是修改成为谷歌 ...
- Cannot change network to bridged: There are no un-bridged host network adapters解决方法
首先,在你安装上了虚拟机后要确保你也安装了桥接的协议,这可以通过点击右键“网上邻居”,在其中可以看到有两个虚拟出来的网络一个VMnet1,另一个是VMnet8, 如下图所示. 如果没有安装,可以通过下 ...
- CentOS yum 命令出现 [Errno 14] curl#6 - "Couldn't resolve host ..." 的解决方法
安装svn的时候,发现报错说一个地址无法訪问. # yum list | grep subversion http://opensource.wandisco.com/centos/7/svn-1.8 ...
随机推荐
- elasticsearch window下配置安装
1.首先下载elasticsearch 下载链接:https://www.elastic.co/cn/downloads/elasticsearch 第一张图是下载的,第二章图是下载msi的程序,直接 ...
- 1_Swift概况
Swift 标准库 解决复杂的问题并编写高性能,可读的代码 概况 Swift标准库定义了用于编写Swift程序的基本功能,其中包括 1.如基本数据类型Int,Double以及String 2.共同的数 ...
- yum工具及源码包
目录 yum工具及源码包 yum yum源 yum实战案例 yum全局配置文件 制作本地yum仓库 构建企业级yum仓库 源码包 yum工具及源码包 yum yum是RedHat以及CentOS中的软 ...
- python3基础学习(1)
python基础内容讲解主要内容: 1.使用编辑器(IDE) 2.第一个“hello world” 3.何所谓“变量” 4.python与其他主流语言输出对比 5.数据类型 6.python用作“计算 ...
- SRDC - ORA-1555 during Export: Checklist of Evidence to Supply (Doc ID 1682706.1)
SRDC - ORA-1555 during Export: Checklist of Evidence to Supply (Doc ID 1682706.1) Action Plan 1. Exe ...
- Centos系统配置bond0
版权声明:本文为博主原创文章,支持原创,转载请附上原文出处链接和本声明. 本文链接地址:https://www.cnblogs.com/wannengachao/p/11942254.html 1.查 ...
- 修改postgresql 密码
sudo -u postgres psql -c "alter user postgres password '123456';"
- 爬虫---爬取b站小视频
前面通过python爬虫爬取过图片,文字,今天我们一起爬取下b站的小视频,其实呢,测试过程中需要用到视频文件,找了几个网站下载,都需要会员什么的,直接写一篇爬虫爬取视频~~~ 分析b站小视频 1.进入 ...
- toast文本提示信息元素获取
在做自动化的过程中,我们有可能会遇到toast提示语,这种提示语只会显示一两秒的样子,导致我们获取元素很困难 今天总结下怎么获取这个toast元素吧 例如下图所示的这种toast提示 图中红框的这种元 ...
- Kvm命令集管理虚拟机
KVM虚拟机配置文件位置 [root@localhost ~]# ll /etc/libvirt/qemu/ 总用量 drwxr-xr-x root root 12月 : autostart drwx ...