banner
约 300 字
1 分钟

记关于Unable to connect to remote host: No route to host问题解决

摘要

云服务器应用本地无法访问,ping通但telnet报错“No route to host”。经排查发现是iptables规则7禁止了所有流量。解决方法是删除该规则,命令为`iptables -D INPUT 7`。

问题场景:在云上服务器部署了一个应用,在本地测试可用性时发现无法访问与云上服务。

问题描述:云上服务器的ACL规则等都已放通,在本地测试时,可以ping通,但是telnet报错:

bash
Unable to connect to remote host: No route to host

原因分析:通过搜索报错发现,可能是icmp(Internet Control Message Protocol)被禁用了导致,在服务器上检查防火墙规则。

bash
iptables -L INPUT --line-numbers

检查是否有以下规则

bash
7    REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited

解决方法:

bash
iptables -D INPUT 7

参考内容:[Unable to connect to remote host: No route to host问题解决](https://www.jianshu.com/p/aef8903a88ee)

END