I have problems with autossh in case short network interrupts (up to 60s). This happens daily due to a network disconnect by my ISP in the morning. Even with usage of autossh the ssh tunnel stays broken until manually restarted. If I test it with a longer outage autossh reestablish the tunnel fine.
When starting autossh with "AUTOSSH_DEBUG=1" the following is shown during a short disconnect:
Warning: remote port forwarding failed for listen port
When looking at the same time to the ssh server, I see with "netstat -pln" that the old port is kept there for about 60s until it finally disappears. If the client tries to reconnect during this time it fails with the message above, it don't recreate the tunnel and also don't retries. When it reconnect after the port disappears on server, ssh succeeds recreating the tunnel.
Is there a way to delay the autossh client reconnection? Is there a way to retry reconnection if it failed (I guess currently there is no retry, because it is classified as Warning only)? Is there a way to shorten the time until the remaining port is removed by sshd?
My Environment is Debian Squeeze on client side and Wheezy on server.
EDIT: I forgot to mention, this happens if I use autossh without management port "-M 0" or with an echo-port "-M 2000:7" or with a full paired management loop "-M 2000".