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](https://i-blog.csdnimg.cn/blog_migrate/055fc530b1008d654bf86c0e8ec7e0dd.png)
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](https://i-blog.csdnimg.cn/blog_migrate/77a590e1ab0cff1b6a1ef60293110286.png)
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](https://i-blog.csdnimg.cn/blog_migrate/e923a5180f971f18a9ca6ee8de61b35a.png)
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
本教程。
PS> Get-Service Apache2.2
![Service Do Not Running](https://i-blog.csdnimg.cn/blog_migrate/fa22e8d6fe7ef3e62d400a19510ae94e.png)
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](https://i-blog.csdnimg.cn/blog_migrate/f4f0e93c21559ac9ed4fe8f98d92b3c8.png)
Talk with the system administrator or ISP.
与系统管理员或ISP交谈。
远程系统防火墙块(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