I have a raspberry pi setup. When connected over ethernet ssh sometimes hangs, but generally works. When connected over wifi ssh is extremely choppy (8/10 connections fail, if I connect it drops within 5 minutes).

The interesting part: ssh -v pi.local works flawlessly every time. Potentially some sort of network issue, that the verboseness of -v fixes? Acting as a keep alive?

Any idea what config I can set to get this reliable connection without -v? Keep-alives? QOS settings? TCP fun?

This is a default Raspbian Bullseye install (Debian), with no system network config changes other than setting wifi SSID/password. Wifi signal is strong.

I have a Tailscale VNP setup, and the issues don't occur when using it for SSH. I'm guessing the extra layer of the wireguard tunnel resolves what ever routing or packet dropping is causing this. It's only when I try to access it over local network (not the VPN) that I have issues.

Thanks in advance

  • Offhand, my first guess would be your network configuration is screwed up. But you gave no details on that, so ... ?
    – Seamus
    Mar 28 at 4:49
  • I would do two network captures, one for ssh -v, one for ssh without -v and try and spot the differences. Even though, AFAIK, and excluding bugs, -v should have no influence on what is sent over the network other than possibly on timing. Mar 28 at 6:55
  • 1
    Updated original question with details. Default fresh install so screwed up network config unlikely (unless Tailscale install changed it). VPN is not involved in the problematic case (clarified that as well). I'm guessing the -v is working as a pseudo keep alive and resolving something on my network.
    – scosman
    Mar 28 at 13:49
  • If you switch off your tailscale VPN on the Pi can you then connect locally? If so it's a routing issue, probably to do with redirection of the LAN route to use the VPN Mar 28 at 14:34

1 Answer 1


Add this to your ~/.ssh/config file:

TCPKeepAlive yes
ServerAliveInterval 30

This would be applied to any ssh you make.

  • That didn't work for me. Connecting through my Tailscale network has fixed it (ssh pi instead of ssh pi.local), so not critical to find a fix. But leaving question up to help find issue.
    – scosman
    Mar 27 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .