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.