Skip to content

No route to host: Quick Fix

  • by
  • 4 min read

Linux is more often than not a hassle-free operating system to use. However, no OS on the planet is immune to networking issues, and the same stands true for Linux.

In this article, we’re looking at the “no route to host” error in Linux, its causes and how you can fix the problem.

What causes the ‘no route to host’ issue?

The error is primarily triggered when the network, server or host you’re trying to connect to you is not responding. It could indicate an inactive internet connection, incorrectly set up router profiles or any number of settings that can restrict your access to the particular server you’re trying to reach.

Also read: How to change file permissions recursively using Chmod in Linux?

How to fix the ‘no route to host’ issue?

Here are six solutions to try out and fix the no route to host issue.

Check your internet connection

Minecraft requires an active internet connection to work. If you have an unstable internet connection, chances are you’re going to miss out on notifications. Suppose you’re on WiFi check to see if you’ve got internet access and strong signals. If you’re on mobile data, check to see if data is enabled and that you’ve got good network coverage.

Incorrect network or host configuration files

Linux uses a bunch of configuration files to define several rules, which it then uses to connect to either the internet or a dedicated host over the internet or even your local network. Check to see if these files are in order and allow outgoing connections. Be sure to check the following three files at least:

/etc /hosts
/etc /hosts.allow
/etc /hosts.deny

Check your services

The most obvious thing can be whether the service you’re trying to connect to you is running or not. If you’re trying to connect to an external server, check its status to see if it’s running or not.

If you’re operating a server yourself, use the systemctl command to see if the service is running. 

sudo systemctl status [service name]

Also read: How to rename a directory in Linux?

Check the port

If the service is online, the next point of failure is most likely the port you’re connecting to. Most services change their default port as a security measure to avoid attackers from snooping in and causing damage. Check to see if you’re using the right port number.

If you’re using your server, try using NMAP to determine which port your service is running using the following command.

sudo nmap -sS [your server's IP]

Check IPTables

Another possible reason for the error could be IPTables blocking connections on the port the service is trying to communicate through. Check to see if the service is allowed to get through IPTables.

sudo iptables -S

DNS issues

If you can ping your server’s IP address but can’t resolve the domain name, you’re most likely facing a DNS issue. In most cases, your PC will fetch DNS information automatically using DHCP, but things can be different if you’re using static IP assignments. 

Here’s how you can set up your DNS manually.

Step 1: Navigate to the following directory and open the resolved.conf file.


Step 2: Uncomment the DNS= line and add your router’s default IP.

If you’re using OpenRC or any other systemd alternative, your DNS files will be in /etc/resolve.conf. Once you’ve updated the rules, try restarting your router and PC. 

Also read: How to access command line history on Linux?

Yadullah Abidi

Yadullah Abidi

Yadullah is a Computer Science graduate who writes/edits/shoots/codes all things cybersecurity, gaming, and tech hardware. When he's not, he streams himself racing virtual cars. He's been writing and reporting on tech and cybersecurity with websites like Candid.Technology and MakeUseOf since 2018. You can contact him here: