Unable to connect to remote host: No route to host---------------能ping通但是不能telnet通的解决办法

Unable to connect to remote host: No route to host---------------能ping通但是不能telnet通的解决办法

问题描述

最近不小心操作了一下Windows Defender,然后自己写的c/c++服务器项目就无法在浏览器中访问了,而且使用cmd中的telnet工具也不能访问对应的ip和端口

总的来说,就是能ping通但是不能telnet通!

以下为解决办法

  1. 看下iptables是不是有防火墙的设置:
sudo iptables -L INPUT --line-numbers

需要注意的是上面的命令必须是在root超级用户的权限下,才能操作成功!

  1. 结果如下:
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
  1. 解决方法,删除这条记录:
sudo iptables -D INPUT 7

成果

可以看到不管是浏览器,还是telnet工具都可以访问成功!

在这里插入图片描述

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
问题描述的是无法连接到远程主机,出现"No route to host"的错误。根据引用\[1\]提供的解决办法,可以尝试以下步骤来解决这个问题。 首先,使用ping命令检查是否可以ping远程主机。如果可以ping但无法telnet,可以按照以下步骤进行解决。 1. 使用iptables命令检查是否存在以下规则:\[2\] ``` iptables -L INPUT --line-numbers ``` 如果存在以下规则: ``` 7 REJECT all – anywhere anywhere reject-with icmp-host-prohibited ``` 需要删除这条规则。 2. 使用以下命令删除规则:\[3\] ``` sudo iptables -D INPUT 7 ``` 过执行以上步骤,应该能够解决"Unable to connect to remote host: No route to host"的问题。 #### 引用[.reference_title] - *1* *3* [Unable to connect to remote host: No route to host---------------ping但是不能telnet解决办法](https://blog.csdn.net/weixin_52668597/article/details/130729049)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [记关于Unable to connect to remote host: No route to host问题解决](https://blog.csdn.net/qq_32766863/article/details/125409556)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

踏过山河,踏过海

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值