On boot, I can successfully SSH into my pi. Then when I exit the session, I can immediately SSH back into it but if I wait some variable length of time (usually a few hours but sometimes more and a lot less), can’t SSH into it anymore. When I ping it (using ping, I get ping: sendto: No route to host \nRequest timeout for icmp_seq 0\nping: sendto: Host is down messages. When I look at the SSH status or run SSH in verbose mode on the pi, SSH seems to be running fine but just doesn’t see that anything is trying to connect to it.

At the moment, I can successfully ping and SSH in again if I restart the pi or if I try to SSH back into my laptop (doesn’t matter if I was successful or not).

I’ve tried all of the below but none of them have worked.

Some other ideas I haven’t tried:

  • Turning off APSD / WMM in my router settings. Haven’t done because struggling to access my router settings and also read that this feature makes other devices on the network more energy efficient
  • Setting up a cron job to attempt to SSH into my laptop every minute. This is just my idea based on the workaround I mentioned. I haven’t done this as it seems a bit hacky and will probably be unreliable

Other things that could be relevant:

  • Pi model: 3B+
  • Laptop model: 2019 M1 Macbook Pro
  • Connection method: WiFi
  • ISP: 3 UK 4G Broadband

Anyone got any ideas on what to try next? Or so I can stop wildly trying random things on the internet, better ways for me to troubleshoot so I can identify whether the issue is my laptop, network or pi?

  • Might have missed this if you mentioned it, but I am guessing you are using Wifi rather then ethernet? There is certainly some quarks about the pi's wifi loosing connection when not used, and since you are unable to ping it, it might be going to sleep on you.
    – Chad G
    Commented May 31, 2023 at 21:54
  • are you using a hostname or an ip address Commented Jun 1, 2023 at 0:38
  • "I’ve … set a static IP for the pi" "Assigning the Pi's static IP to the Pi's MAC address on the server" 1. If you set a static IP the router or network won't know anything about it. 2. you can't assign a static IP on the router although you can reserve an IP (this is acceptable if you want a known IP but relies on DHCP). The link you referenced contains a number of factual errors and confuses static, inform & request. You have posted no diagnostics. Raspberry Pi OS works well if you leave networking at the default.
    – Milliways
    Commented Jun 1, 2023 at 6:11
  • @JaromandaX I'm to SSHing and pinging into it using an IP address. ping I've added this to the post
    – occrg
    Commented Jun 1, 2023 at 7:09
  • @ChadG yeah, I'm using WiFi and not ethernet. I've added that to the post. Could a loss of WiFi connection still be the case if the problem still occurs when I'm successfully using the internet on the Pi using a monitor?
    – occrg
    Commented Jun 1, 2023 at 7:43

1 Answer 1


Make sure you are not running a cron job that is calling an inaccessible address. I changed my router and forgot to update my cron (Check both user and root crons)

The culprit was

*/5 * * * * /home/cam/bin/keep-wifi-link-alive.sh >/dev/null 2>&1

Where keep_wifi_link_alive.sh was


# keep wifi alive

ping -c2

if [ $? != 0 ]
  echo " "
  echo "No network connection, restarting wlan0"
  ifconfig wlan0 down
  sleep 30
  ifconfig wlan0 up
    echo " "

My rPi was dropping and restarting the link every 5 minutes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.