I have +10 servers with a tunnel to a master server. Unfortunately, from time to time some of these servers are losing the connection and do not restore. The way I understand it is that the monitoring port doesn't need to be unique in the network. Am I mistaken?

If this isn't the issue, how should I go about debugging it? The logs only state connection lost.


The manual of autossh clearly states that if you dont need it for purposes other than checking of the connection broke, you shouldnt be using monitoring.

For example, if you are using a recent version of OpenSSH, you 
may wish to explore using the ServerAliveInterval and 
ServerAliveCountMax options to have the SSH client exit if it 
finds itself no longer connected to the server. In many ways 
this may be a better solution than the monitoring port.

So just disable autossh monitoring with -M 0 and configure the ServerAlive options (interval 30, max 3 is a reasonable default) instead.

You next debugging step (after ensuring the new sshd config is loaded) is checking the server log (sshd will likely log to /var/log/auth.log) and a verbose client log (try something like ssh -vvv -R port:ip:port master on one of your servers and see if the connection loss is indeed not network-related).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.