Score:1

SSH hangs even after enabling ServerAliveInterval

cl flag
Luc

Basically the same question as ssh hangs even after putting ServerAliveInterval 60, except I checked that the configuration is being used:

$ man 5 ssh_config | grep -A1 '^\s*ServerAliveInterval'
Sets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server.

$ cat ~/.ssh/config
host myalias
    hostname example.org
    ServerAliveInterval 200

$ ssh myalias 'echo "Greetings from $USER@$(hostname)"'
Greetings from [email protected]

Running ssh with -vvv, nothing shows up while the connection is idle. Perhaps the packets are not being logged despite this (per the man page) being the highest available debug level. Looking in Wireshark, no packets are being sent over the connection whatsoever. I see the packets when I type or when the server sends data, but during 45 minutes of idle shell, no packets showed up.

When using ssh -o ServerAliveInterval=60, packets do show up, but it gets a bit cumbersome to type that every time. Perhaps a bash alias would work but... ssh should just read the config.

SSH client version: OpenSSH_9.2p1 Debian-2

Background: The configuration became necessary after getting a new consumer router (crap ISP ate the good ISP which we were subscribed to, so now we got the crap router), which appears to have a habit of pruning its state table from open-but-idle connections every so often (15 minutes maybe? I'm still figuring this out). The connection stays on successfully for the entire day when running `while :; do date; sleep 300; done`, so keepalives ought to solve the problem ...if they were only being sent as configured.
alexus avatar
sa flag
Does this answer your question? [ssh hangs even after putting ServerAliveInterval 60](https://serverfault.com/questions/810108/ssh-hangs-even-after-putting-serveraliveinterval-60)
ws flag
Make sure that multiplexing is disabled (or ControlPersist is off). I've seen this cause some pain with flaky uplinks.
cl flag
Luc
@symcbean Thanks for the suggestion. I just checked and am not using that anymore (I did a few years ago, but there was indeed some trouble with it). Using `ssh -vvv -E /tmp/debug` and searching the file for 'control' or 'multi', there are no results so I can't confirm that this specific variable is off, but I don't have a config that enables it anymore so it ought to be off.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.