Tech News Today
  • Hardware
    • Motherboards
    • CPUs
    • Graphic Cards
    • RAM
    • SSDs
    • Computer Cases
    • Monitors
    • Peripherals
    • Power Supply Unit
    • PC Builds
    • Computer Tips
  • Software
  • Operating System
    • Windows
    • Mac
    • Linux
  • Gaming
  • Mobile
  • Console
  • More
    • Internet
    • Networking
    • Security
    • Buyer’s Guide
    • Gadgets
    • Laptops
    • Reviews
    • How To
    • News
Facebook Twitter Instagram
Tech News Today
  • Hardware
    • Motherboards
    • CPUs
    • Graphic Cards
    • RAM
    • SSDs
    • Computer Cases
    • Monitors
    • Peripherals
    • Power Supply Unit
    • PC Builds
    • Computer Tips
  • Software
  • Operating System
    • Windows
    • Mac
    • Linux
  • Gaming
  • Mobile
  • Console
  • More
    • Internet
    • Networking
    • Security
    • Buyer’s Guide
    • Gadgets
    • Laptops
    • Reviews
    • How To
    • News
Tech News Today
Home » Networking

How To Fix “No Route To Host” In Linux

Anup ThapaBy Anup ThapaAugust 25, 2022
no route to host

In a local network, the No Route to Host error generally occurs due to ARP resolution failure. Without the destination host’s Layer 2 address, the data packets can’t be forwarded, which leads to this error. 

In the case of a remote host, users encounter this error due to an offline or non-responding host, permissions/firewall issue, or in some rare cases, DNS resolution.

We’ve detailed the probable causes and ways to resolve this error in both scenarios in this article.

Table of Contents

  • How to Fix No Route To Host
    • Check Host Status
    • Configure Firewall
    • Create Ingress Rule
    • Check Routing Table

How to Fix No Route To Host

We recommend starting with basic troubleshooting steps like checking the status of the host server.

Check Host Status

It may seem obvious, but you should first ping the remote host and make sure it’s actually online. 

If you can ping the IP but not the hostname, the error is most likely due to a DNS issue. In such cases, use sudo nano /etc/systemd/resolved.conf and change the DNS address.

etc systemd resolved conf

If you have access to the host, run the sudo systemctl status <servicename> command and make sure the relevant service is actually running.

Assuming the host is online and the service is running, the error is most likely due to permission issues. First, check /etc/hosts.allow and /etc/hosts.deny. If there’s no issue with these config files, it’s best to troubleshoot firewall issues, as shown below.

Configure Firewall

Before fiddling with the firewall, it’s worth confirming that you’re actually trying to connect to the correct port with sudo nmap -sS <hostIP>.

Assuming the port is correct, we recommend using iptables to edit the firewall rules. The commands shown below allow the specified port through the firewall and save the changes in /etc/iptables/rules.v4.

sudo iptables -I INPUT 6 -m state --state NEW -p tcp --dport <portno> -j ACCEPT
sudo netfilter-persistent save

sudo iptables open port

Create Ingress Rule

In the case of Virtual Cloud Networks (VCN), you’ll have to add an ingress rule to your subnet to make your VM accessible from the internet. When creating the rule, use the following values:

Source Type: CIDR
Source CIDR: 0.0.0.0/0
IP Protocol: TCP
Destination Port Range: 80
add ingress rules

Check Routing Table

You may also be encountering this error due to issues with the host’s routing table. You can use netstat -rn to display the routing table and check if anything is off. For instance, one user found that one of the entries was incorrect.

netstat rn

Upon checking /etc/network/interfaces, he found that one of the interfaces had two IP addresses, but they were both public-facing. Adding the correct netmask to one of the addresses resolved the routing issue.

fix
Anup Thapa
  • Instagram
  • LinkedIn

Anup Thapa primarily covers Windows systems, networking, and computer hardware at TechNewsToday. Anup has been writing professionally for almost 5 years, and tinkering with PCs for much longer. His love for all things tech started when he got his first PC over 15 years ago. It was a Pentium IV system running Windows XP on a single 256 MB stick. He spent his formative years glued to this PC, troubleshooting any hardware or software problems he encountered by himself. Professionally, Anup has had brief forays into a variety of fields from coding and hardware installation to writing. In doing so, he's worked with people of different backgrounds and skill levels, from average joes to industry leaders and experts. This has given him not just a versatile skill set, but also a unique perspective for writing that enables him to concisely communicate complex information and solve his reader's problems efficiently. You can reach out to him at anup@technewstoday.com.

Related Posts

intel wireless ac 9560 not working

Intel Wireless AC 9560 Not Working? Try these Fixes

September 16, 2023
does your ip address change when you move

Does Your IP Address Change When You Move?

July 16, 2023
locate wifi access point

How to Locate a Wi-Fi Access Point

July 6, 2023
lease time dhcp

What is DHCP Lease time? Can You Change It?

July 2, 2023
Failed to obtain IP address 1

5 Ways to Fix “Failed to Obtain IP Address”

June 30, 2023
How to Forget a Network

How to Forget a Network on Windows

June 27, 2023
Add A Comment

Leave A Reply Cancel Reply

Latest Posts
how to clean RAM

How to Clean RAM? Step-By-Step Guide

October 2, 2023
motherboard form factors

Motherboard Types: ATX, Micro ATX, and Mini ITX Explained

September 28, 2023
how to download and use rufus

How to Download and Use Rufus

September 28, 2023
You may also like
printer-not-printing

How to Fix a Printer That’s Not Printing

September 26, 2023
Share Location With Friends and Family

Share Location With Friends and Family (iPhone and Android)

September 18, 2023
how-to-print-without-a-printer

How to Print Without a Printer

September 18, 2023
Recommended
Cookie Clicker Garden Guide

Cookie Clicker Garden Guide to Unlocking Every Seed

September 26, 2021
monitor no signal

Computer Turns On But Monitor Says No Signal (9 Ways To Fix)

November 10, 2022
Facebook Twitter Pinterest
  • Home
  • About Us
  • Our Team
  • Editorial Guidelines
  • Privacy Policy
  • Affiliate Disclosure
© 2023 TechNewsToday, editor@technewstoday.com | Tech Central Pvt. Ltd.

Type above and press Enter to search. Press Esc to cancel.