Unable to connect to remote host: No route to host---------------能ping通但是不能telnet通的解决办法
问题描述
最近不小心操作了一下Windows Defender,然后自己写的c/c++服务器项目就无法在浏览器中访问了,而且使用cmd中的telnet工具也不能访问对应的ip和端口
总的来说,就是能ping通但是不能telnet通!
以下为解决办法
- 看下iptables是不是有防火墙的设置:
sudo iptables -L INPUT --line-numbers
需要注意的是上面的命令必须是在root超级用户的权限下,才能操作成功!
- 结果如下:
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
2 ACCEPT all -- anywhere anywhere
3 INPUT_direct all -- anywhere anywhere
4 INPUT_ZONES_SOURCE all -- anywhere anywhere
5 INPUT_ZONES all -- anywhere anywhere
6 DROP all -- anywhere anywhere ctstate INVALID
7 REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
- 解决方法,删除这条记录:
sudo iptables -D INPUT 7
成果
可以看到不管是浏览器,还是telnet工具都可以访问成功!