1

I just got a Pi 3, model B. It's running raspbian, and I have it on power and Ethernet only. I have internet connection when on the Pi itself, and can SSH into it for up to ~30 minutes after I last touch it. However, if I leave it running with the monitor disconnected, then it no longer accepts connections. The IP remains correct, and if I return to my room and stir the Pi, then it will respond to SSH again.

I'm new to the Pi. Does it have some kind of sleep mode? Or am I losing my connection from the router.

Thanks!

Zarocross
  • 11
  • 3
  • Is the problem that the SSH loses if left idle for 30 minutes? That's probably a NAT in between that is timing out the connection information. You can adjust for this by keeping something going over the SSH connection. There are options in SSH to do keep-alives, which are for this purpose. What I do is run an xclock on each remote host I connect to, which, in addition to the traffic to keep updating the clock, gives me a visual indicator that the connection is still there. – MAP Jan 11 '17 at 03:54

3 Answers3

1

Similar questions have been asked before. Here are some things to check to start debugging this:

Raspberry Pi sleep mode, how to avoid

Without some troubleshooting, the answer to one of your questions is that no, the PI doesn't have a sleep mode. However, other devices in the chain might.

J. McCabe
  • 11
  • 1
  • 3
  • Links should form part of an answer rather than being the answer – Darth Vader Jan 10 '17 at 18:17
  • Well I was going to just comment, but I don't have enough reps to comment. And I can't get reps until I answer. And so on... – J. McCabe Jan 10 '17 at 18:19
  • 1
    Then you could take the time to make a decent stab at an answer. You'll find that if you write a reasonable answer then your reputation will increase. So then you will gain the ability to comment on posts. – Darth Vader Jan 10 '17 at 18:22
0

Found the answer - it needed to ping the router occasionally to maintain a connection. I set mine to ping ever ten minutes.

Zarocross
  • 11
  • 3
0

You can modify the SSH server or client configuration to avoid timeouts this.

On the server side add the following lines:

ClientAliveInterval 120
ClientAliveCountMax 720

to the /etc/ssh/sshd_config file.

This will send a null packet very 120 seconds and not disconnect the client for 24 hours.

On the client (Mac or Linux) you can add the following line:

ServerAliveInterval 120

to your ~/.ssh/config file, to send a null packet every 120 seconds.

If you are using Putty (PC) you can set the seconds between keep alive to 120. This option is located under the connection menu.

Of the two options, I would suggest using the server based approach first, as you only need to make a single change no matter how many clients you use to connect.

Steve Robillard
  • 34,687
  • 17
  • 103
  • 109