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

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

Anup Thapa is a tech writer at TechNewsToday. He mostly writes informative articles, tutorials, and troubleshooting guides related to Windows systems, networking, and computer hardware. 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 like coding, hardware installation, writing, etc. 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 skillset, but also a unique perspective for writing that enables him to concisely communicate complex information and solve his reader's problems efficiently. You can contact him at anup@technewstoday.com

Related Posts

wifi-keeps-disconnecting-windows-11

Wi-Fi Keeps Disconnecting on Windows 11? 9 Ways to Fix It

February 26, 2023
windows-cannot-access-network-drive

Fix: Windows Cannot Access Network Drive

February 23, 2023
how to check wifi speed in laptop

3 Simple Ways to Check Wi-Fi Speed in Laptop

February 23, 2023
network_adapter_not_working

Network Adapter Not Working? 15 Ways to Fix It

February 22, 2023
Surface WiFi Not Working

Why is My Wi-Fi Not Working on Surface Laptop? 10 Ways to Fix It

February 22, 2023
change-network-profile-windows

4 Ways to Change Network Profile in Windows

February 22, 2023
Add A Comment

Leave A Reply Cancel Reply

Latest Posts
Memory-Compression

What is Memory Compression in Windows? Should You Enable or Disable It

March 1, 2023
dism-vs-sfc-vs-chdsk

DISM, SFC, CHKDSK: What’s the Difference

February 28, 2023
bios-settings-for-gaming

Best BIOS Settings for Gaming

February 16, 2023
You may also like
how-to-clean-hp-printer-rollers

How to Clean HP Printer Rollers

March 3, 2023
keyboard input lag

9 Ways to Fix Keyboard Input Lag

March 3, 2023
keyboard key is stuck

How to Fix a Stuck Key on a Keyboard

March 3, 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.