“无法路由到主机”错误和解决方案

While trying to ping or connect a remote host I can an error “no route to host”. How can I debug this error and solve it? As we know IP networks are constructed hop by hop which means there are different intermediate routers transmit packets between two remote hosts. These routers decide the route to the destination according to their routing tables. If destination route does not exist in the routers routing table it will return “no route to host error” with ICMP protocol.

尝试ping或连接远程主机时,出现“没有路由到主机”错误。 如何调试此错误并解决? 我们知道IP网络是逐跳构建的,这意味着有不同的中间路由器在两个远程主机之间传输数据包。 这些路由器根据其路由表决定到目的地的路由。 如果路由器路由表中不存在目标路由,它将使用ICMP协议返回“没有路由到主机错误”。

原因和解决方案 (Reasons and Solutions)

The No Rout To Host error is a very generic error but we will try to list some of the causes of the error.

No Rout To Host错误是一个非常普通的错误,但是我们将尝试列出一些导致错误的原因。

远程主机或IP地址处于脱机状态 (Remote Host or IP Address Is Offline)

The first reason may be the remote system is not running or in an offline position. It can not be connected to the network or internet. This can be tested with the traceroute command which will try to access remote system hope by hope but will also check each intermediate hop status.

第一个原因可能是远程系统未运行或处于脱机位置。 无法将其连接到网络或互联网。 可以使用traceroute命令进行测试,该命令将尝试通过希望访问远程系统,但是还将检查每个中间跃点状态。

$ traceroute 8.8.8.8
Remote Host or IP Address Is Offline
Remote Host or IP Address Is Offline
远程主机或IP地址处于脱机状态

The solution is contacting the remote system administrator and talking about the situation of the system.

解决方案是与远程系统管理员联系,并讨论系统情况。

尝试连接错误的端口 (Trying To Connect Wrong Port)

While trying to connect the remote system with the given port we may use the wrong port number which is not serving. Double-check the port number while connecting remote systems.

在尝试使用给定的端口连接远程系统时,我们可能使用了错误的端口号,该端口号不可用。 连接远程系统时,请仔细检查端口号。

$ telnet 8.8.8.8 23
Trying To Connect Wrong Port
Trying To Connect Wrong Port
尝试连接错误的端口

The solution is providing the correct port we want to access.

解决方案是提供我们要访问的正确端口。

服务无法运行 (Service Does Not Run)

Another reason may the service we want to access is not running. So the port will not open too. We can check service availability for Linux and Windows with the following ways.

另一个原因可能是我们要访问的服务未运行。 因此端口也不会打开。 我们可以通过以下方式检查Linux和Windows的服务可用性。

$ sudo systemctl status sshd
Service Do Not Running
Service Do Not Running
服务未运行

We will use Get-Service PowerShell commandlet to check Apache2.2 service. For more information about Get-Service look following the tutorial.

我们将使用Get-Service PowerShell Commandlet来检查Apache2.2服务。 有关Get-Service更多信息,请Get-Service本教程。

Windows Service Tutorial

Windows服务教程

PS> Get-Service Apache2.2
Service Do Not Running
Service Does Not Run
服务无法运行

Solutions for this problem is starting services with the related commands like below.

解决此问题的方法是使用如下相关命令启动服务。

$ sudo systemctl start sshd

OR

要么

PS> Start-Service Apache2.2

我们无法访问互联网 (We Can Not Access To The Internet)

We have mainly talked about the remote system problems for No route to host but in some cases, the problem may be related to our network and systems. We can check this with the simple ping command like below.

我们主要讨论了“ No route to host的远程系统问题,但在某些情况下,该问题可能与我们的网络和系统有关。 我们可以使用下面的简单ping命令来检查此情况。

$ ping google.com
We Can Not Access To The Internet
We Can Not Access To The Internet
我们无法访问互联网

Talk with the system administrator or ISP.

与系统管理员或ISP交谈。

LEARN MORE  Install Dnsmasq As Cache Dns Server
了解更多信息将Dnsmasq安装为缓存Dns服务器

远程系统防火墙块(Remote System Firewall Block)

Firewalls are main utility used for security systems. Servers or corporate networks generally utilize firewalls to prevent access to internal systems and ports. So this can prevent to access our target host. Contact with the remote network administrator.

防火墙是用于安全系统的主要实用程序。 服务器或公司网络通常利用防火墙来防止访问内部系统和端口。 因此,这可以防止访问我们的目标主机。 与远程网络管理员联系。

无法解析DNS (DNS Cannot Be Resolved)

If we are using domain names which are translated by DNS servers this can create problems. If the DNS named is not resolved properly we may not access to the remote system. Change DNS servers like 8.8.8.8. More DNS servers can be found in the following tutorial.

如果我们使用由DNS服务器转换的域名,则可能会造成问题。 如果命名的DNS无法正确解析,则我们可能无法访问远程系统。 更改DNS服务器,如8.8.8.8 。 在下面的教程中可以找到更多的DNS服务器。

Popular Free DNS Services Around The World

世界各地流行的免费DNS服务

翻译自: https://www.poftut.com/no-route-host-error-solution/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值