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

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:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 32 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig 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 glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep 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
  • CALLISTO MUPFUNYE Mar 5, 2007 @ 9:53

    I’m using Redhat 7.3 and running sendmail for my email but the emails are not getting out the email server which is my linux 7.3 box and if I run the command # sendmail -v -q from the command prompt, it tries to send but with an error message saying “no route to host” ?


  • 🐧 nixCraft Mar 5, 2007 @ 14:54

    Make sure you have correct routing setup. Also check file /var/log/message for details.

    Make sure you have correct DNS setup. Finally some ISP do block access to 3rd party SMTP server to avoid spam.

    On a side note RH7.2 is outdated get latest version such as CentOS 4.x or Fedora Core.

  • Ajayan Alphonse Apr 11, 2008 @ 12:04

    very useful , my problem solved against no route to host

  • Kumar Aug 22, 2008 @ 8:03

    with regards to your suggestion “Make sure you have correct routing setup. Also check file /var/log/message for details.” above, could you tell me how to look and setup routing.

  • Kumar Aug 22, 2008 @ 8:06

    In the error logs I see this.
    bound to — renewal in 294 seconds.

    Do I have to make any changes in the DHCP server.


  • chabza May 19, 2009 @ 12:09

    thanks a lot guys, my problem solved also. linux rocks 🙂

  • addhe Jun 10, 2009 @ 9:09

    here it is, i have 2 Computer, 2 ip address A ( and ip address B ( i can ping but not, i cannot ssh directly but yes i can directly remote ssh to please help mee, what hapen to my network ???

    # 3Com Corporation 3c905C-TX/TX-M [Tornado]

  • no route to host Aug 13, 2009 @ 5:20

    sir, i cannot run default page in local host. i am using windows 2003 server-OS. can you please help?

  • Nikhil Sep 8, 2009 @ 10:20

    i helped a lot guys,it was mainly due to iptables ,i just flushed it using iptables -F and now no worry..

  • SSSSSSSe Dec 14, 2009 @ 14:17

    Monsieur,I just installed Tor ,when it’s started connecting,stopped and showed (no route to host)….Can u tell me how to work that out,please?thanks…

  • yogendra athalye Feb 7, 2010 @ 18:10

    Thanks a lot. I just cleared the iptables and nfs started working.
    thanks a ton……… 🙂

  • kanhaiya lal laxkar Jul 27, 2010 @ 2:47

    Dear Sir
    getting problem with yahoomail acconut errer show certificate errer and

    • Saj Sep 5, 2010 @ 14:23

      Accept the certificate or change the browser… Simple…:P

  • tafadzwa Sep 11, 2010 @ 5:13

    help please. i recently installed a new cisco router at one of our branches. i am able to ping the head office router and other hosts on the head office lan except the sco unix server. i added a route to the new site in the etc/hosts file but still i cannot telnet or ping the new remote site form the unix server. is there anything i need to do before i get fired

    • Shepherd Nhongo Sep 25, 2012 @ 4:54

      FYI /etc/hosts is just a hosts file to help point your hostname to ip or vice versa without relying on dns. it does not do any routing or adding a route.

  • Koushik Das Feb 22, 2011 @ 10:12

    Way to go man………………..
    It worked

    I checked everything except the firewall settings….

    With this help I was abe to solve the problem of ftp connection…..

    such a small thing but it almost dumbed me


  • New_Linux_User May 31, 2011 @ 0:08

    Thank you so much, flushing the iptables worked, although of what it means and if it has long-term effects are a mystery to me… All I know is that I can use a SSH between my laptop and desktop, just the way I wanted! Thank you guys for the help, was looking for an entire day on how to find out how to do it. Fedora is pretty cool, but I think Ubuntu is much simpler

  • Tirumala Marri Mar 29, 2012 @ 1:38

    Amazing my problem solved as soon as I stopped iptables. Now wget and curl works fine.

  • ajay singh Sep 3, 2012 @ 7:07

    what is a meaning of no route to host.and why it will come.which problem.

  • Vivek Oct 7, 2012 @ 16:36

    Hi there,

    We have a cluster that has Ubuntu 10.04 installed. The cluster was working fine i.e. we were able to connect to all the compute nodes fine. But recently after some restarts, I get the following error when I try to log into the compute nodes from the head node:
    vbharadwaj@deepblue:~$ ssh deepblue-1-8
    ssh: connect to host deepblue-1-8 port 22: No route to host

    I looked up the iptables command and this was my output
    vbharadwaj@deepblue:~$ sudo /sbin/iptables -L -n
    [sudo] password for vbharadwaj:
    Chain INPUT (policy ACCEPT)
    target prot opt source destination

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    I have also physically checked if the head node and compute nodes are connected to the network switch and if the compute nodes are switched on and working ok.

    I have also checked the /etc/hosts file and it has all the ip addresses listed for the head node and compute nodes.
    I am new to cluster administration and would be glad to receive any advise as to what could be wrong with the system.

    Thank you.

  • Bogdan-Constantin PETCU Jan 30, 2013 @ 18:48

    I am trying to obtain this error(it could be one of my exam questions). what do i have to do(on debian)?

  • pradeep Jun 16, 2013 @ 5:39

    sir i tried the above solutions its worked for me , so thanks a lo sir ….. but i m not getting the solutions persistent across the reboot , again it is showing no route to host after reboot ….. please help me

    • David Trest Jun 28, 2013 @ 14:11

      iptables commands are not persistent across reboots. You need to set them up in a script, such as an initscript, to have them stay persistent.

  • 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(
    at org.apache.axis2.transport.http.HTTPSender.sendViaPost(
    at org.apache.axis2.transport.http.HTTPSender.send(
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(
    at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
    at org.apache.axis2.engine.AxisEngine.send(
    at org.apache.axis2.description.OutInAxisOperationClient.send(
    at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
    at org.apache.axis2.client.OperationClient.execute(

    please suggest solution.

  • Yu Feb 28, 2014 @ 2:59

    Thanks very much for your solution !

  • vishal Mar 4, 2014 @ 9:01


  • 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/”… please let me know about the solution.

  • KJ Oct 6, 2014 @ 9:44


    It Works !!!!

  • Saurabh Feb 16, 2015 @ 2:55

    Thanks,very useful.

  • 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 .

  • mura Aug 2, 2016 @ 5:08

    It works properly now.thanx

  • 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

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum