“No route to host” until “ping” or “route”

arpgatewayroute

I have two computers in one WiFi network:

  • A – client
  • B – server

Sometimes (once in ten times) after B reboot I am unable to ssh from A to B:

$ ssh 192.168.201.128
ssh: connect to host 192.168.201.128 port 22: No route to host

When I try to ping it, I get:

$ ping 192.168.201.128
PING 192.168.201.128 (192.168.201.128) 56(84) bytes of data.
From 192.168.201.133 icmp_seq=1 Destination Host Unreachable
From 192.168.201.133 icmp_seq=2 Destination Host Unreachable
From 192.168.201.133 icmp_seq=3 Destination Host Unreachable

ARP might be the issue:

$ arp
Address                  HWtype  HWaddress           Flags Mask            Iface
_gateway                 ether   70:4c:a5:a7:c2:57   C                     wlp2s0
192.168.201.128                  (incomplete)                              wlp2s0

I was trying to fix it like this:

$ sudo arp -d 192.168.201.128
$ arping -c 10 -I wlp2s0 192.168.201.128
ARPING 192.168.201.128 from 192.168.201.133 wlp2s0
Sent 10 probes (10 broadcast(s))
Received 0 response(s)

no effect 🙁

I can workaround the issue by plugging in monitor and keyboard to B (server) and doing either:

1) ping A (client)

OR

2) typing "route" in terminal

Then everything goes back to normal.

Any idea why this might be happening?
My guess is that B sometimes doesn't discover gateway correctly. I am unable to verify this, because when I type "route" in B terminal everything goes back to normal.

Side notes:

  1. There is no firewall on B (server)
  2. A (client) is Ubuntu 18.04 Desktop
  3. B (server) is Ubuntu 16.04 minimal (maybe missing some important package for arp/ auto gw discovery?)
  4. B (server) interfaces configuration:
$ cat /etc/network/interfaces
auto lo
iface lo inter loopback

Best Answer

I suggest you to check your WiFi router. After rebooting your server, are you able to see in router's administrative interface an IP address lease from its internal DHCP server to your server? Can you ping the server from your router? A cable link between router and server is feasible?

I experience a similar problem at home with a laptop computer and a smartphone connected to a WiFi network provided by an old TP-Link TLWR340G router. Sometimes, I am unable to establish a connection from smartphone to computer, despite both devices establish internet connections successfully. When such problem occurs, I solve it by pinging smartphone from computer until I get a response, which is generally after 20 packet misses.

Related Topic