No route to host

Cause:

This error may be due to network connectivity from source to destination host

-bash-4.2$ telnet 192.168.1.123 4903
Trying 192.168.1.123...
telnet: connect to address 192.168.1.123: No route to host

Solution:

1)Ping the server to check if the destination host is reachable or not via icmp packets

-bash-4.2$ ping oem
PING oem (192.168.1.123) 56(84) bytes of data.
64 bytes from oem (192.168.1.123): icmp_seq=1 ttl=64 time=0.649 ms
64 bytes from oem (192.168.1.123): icmp_seq=2 ttl=64 time=0.525 ms
64 bytes from oem (192.168.1.123): icmp_seq=3 ttl=64 time=0.471 ms
64 bytes from oem (192.168.1.123): icmp_seq=4 ttl=64 time=0.442 ms

2)If ping is fine, then network connection is fine. Check for the port as the next focus

If port is open on the destination server

[root@oem log]# netstat -tuplan|grep '4903'
tcp6       0      0 :::4903                 :::*                    LISTEN      7542/httpd

3) If still issue persist, then error should be related to firewall blockage issues

Check iptables and stop it

[root@orcl19x oracle]# service iptables stop
Redirecting to /bin/systemctl stop  iptables.service
Failed to stop iptables.service: Unit iptables.service not loaded.

Check if the port status is “established” from the source ipaddress. If not, then firewall block the incoming connection. In the below output , we dont see established and hence connectivity is blocked by firewall

[oracle@oem ~]$ netstat -tuplan|grep '4903'
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp6       0      0 :::4903                 :::*                    LISTEN      8235/httpd

Check if firewalld is running on (disable firewall)

[root@oem oracle]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2021-12-01 14:42:49 IST; 3h 43min ago
     Docs: man:firewalld(1)
 Main PID: 802 (firewalld)
    Tasks: 2
   CGroup: /system.slice/firewalld.service
           └─802 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

[root@oem oracle]# systemctl stop firewalld


[root@oem oracle]# firewall-cmd --permanent --add-port=22/tcp
FirewallD is not running

Check if selinux is enabled (–disable it if enabled)

-bash-4.2$ getenforce
Disabled

Atlast telnet should be connecting fine

-bash-4.2$ telnet 192.168.1.123 4903
Trying 192.168.1.123...
Connected to 192.168.1.123.
Escape character is '^]'.

Leave a Reply