No Route to Host error and solution

I am getting error that read as No Route to Host. I am trying to ping my ISP gateway as well as DNS server but I am getting this error. How do I solve this problem?

This problem indicate networking conflicts or some sort of networking configuration problem.

Here are things to check:

Can you ping to your local router interface (such as 192.168.1.254)?

Make sure your card (eth0) is properly configured with correct IP address and router address. Use ifconfig command to configure IP address and route command to setup correct router address. If you prefer to use GUI tools:

  • redhat-config-network – Works on Red Hat and Fedora Linux/Cent OS.
  • network-admin – Debian and Other Linux distribution use this GUI too

Use above two GUI tools to setup correct IP address, DNS address and router address.

b) Make sure firewall is not blocking your access

iptables is default firewall on Linux. Run following command to see what iptables rules are setup:
# /sbin/iptables -L -n

You can temporary clear all iptables rules so that you can troubleshoot problem. If you are using Red Hat or Fedora Linux type command:
# /etc/init.d/iptables save
# /etc/init.d/iptables stop

If you are using other Linux distribution type following commands:
# iptables -F
# iptables -X
# iptables -t nat -F
# iptables -t nat -X
# iptables -t mangle -F
# iptables -t mangle -X

c) Finally make sure you are using a router and not a proxy server. Proxy servers are good for Internet browsing but not for other work such as ftp, sending ICMP request and so on.

See also:

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source & DevOps topics via:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
32 comments… add one
  • Elvie Bata Sep 10, 2016 @ 15:01

    I am getting error when I signed up and I ping one box then I read error gateway timeout and No Route to Host . I’m trying to fix it but I don’t know how do I solve this problem

  • mura Aug 2, 2016 @ 5:08

    It works properly now.thanx

  • ashish Jun 19, 2016 @ 21:15

    i was trying to mount one filesystem from one system to another and on the second system i got the error no route to host .
    steps took
    1 )checked if i am able to ping one server from another and vice versa(if yes then the routes are good and the packet reaches the second server successfully … so no routing issues)

    2) check the firewall and flushed the iptables on both the servers .

    problem was solved and then i was able to mount the nfs filesystem to the second server .

    please correct me if i am wrong . … but the problem got solved .

    thanks for the post . guys .

  • Saurabh Feb 16, 2015 @ 2:55

    Thanks,very useful.

  • KJ Oct 6, 2014 @ 9:44

    Thnaks

    It Works !!!!

  • Devaki Prabhu Apr 14, 2014 @ 9:17

    when i execute this command ” puppetd –verbose –waitforcert 60 –server_name –noop ” i’m getting error as “Could not prepare for execution: Could not create PID file: /var/run/puppet/agent.pid”… please let me know about the solution.

  • vishal Mar 4, 2014 @ 9:01

    Thanks!

  • Yu Feb 28, 2014 @ 2:59

    Thanks very much for your solution !

  • vijay Oct 14, 2013 @ 6:29

    We are getting error in Axis2

    org.apache.axis2.AxisFault: No route to host
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:193)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:371)
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:209)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
    at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
    at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
    

    please suggest solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.