Do you have a firewall on the transit link?
Usually stateful firewall add a connection in their table and set a timeout on it (30minutes.., so that no connection stays for years).
Everytime a byte is sent , the connection is updated and the timeout set back to 30mn.
When the timeout arrives at 0, the connection is removed and no more traffic is allowed.
In tcp exist a mechanism for knowing when a connection is broken ( one of the two have disconnected whithout telling the other)
. This mechanism is KEEP_ALIVE and can be set on TCP sockets.
I guess you have to :
-> tell SSH to use KEEP_ALIVE in his sockets:
-> lower the keepalive of your server to a value inferior to the timeout of your firewall. Here I put 300seconds
echo "300" > /proc/sys/net/ipv4/tcp_keepalive_time
This assumes that the firewall takes this keepalive packets (ack) as normal traffic and refreshes the connection timeout (this is dependent on the fw implementation)
in your firewall configuration, increase the timeout for ssh connection to a value higher than /proc/sys/net/ipv4/tcp_keepalive_time
use an app that constantly refreshes the screen: X window tunneled in ssh , xterm with a clock,...
I would be interested by your result because I have the same issue at work but I'm not the sshd administrator, so I use X forwarding.
Hope it helps