Ich habe meine SSH-Verbindung wie folgt konfiguriert: ~/.ssh/config
auf der Clientseite
ServerAliveInterval 1
ServerAliveCountMax 1200
und /etc/ssh/sshd_config
auf der Serverseite:
ClientAliveInterval 5
ClientAliveCountMax 1200
Wenn ich mich jedoch bei einem Remote-Server anmelde, und obwohl ich meine Verbindung als ziemlich stabil betrachte, sehe ich, dass meine SSH-Verbindung nach etwa 15 bis 60 Sekunden ständig unterbrochen wird. ssh <server> -vvv
endet immer mit
...
debug3: send packet: type 80
debug3: receive packet: type 82
debug3: send packet: type 80
debug3: receive packet: type 82
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 1
debug3: send packet: type 100
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 80
debug3: send packet: type 1
Connection reset by <IP> port <PORT>
Auf der Serverseite:
...
debug3: receive packet: type 80
debug1: server_input_global_request: rtype [email protected] want_reply 1
debug3: send packet: type 82
debug3: receive packet: type 80
debug1: server_input_global_request: rtype [email protected] want_reply 1
debug3: send packet: type 82
debug2: channel 0: request [email protected] confirm 1
debug3: send packet: type 98
debug2: channel 0: request [email protected] confirm 1
debug3: send packet: type 98
debug2: channel 0: request [email protected] confirm 1
debug3: send packet: type 98
debug2: channel 0: request [email protected] confirm 1
debug3: send packet: type 98
...
Der Server versucht es tatsächlich immer wieder. Außerdem kann ich parallel etwas herunterladen oder sogar eine parallele SSH-Verbindung zum selben Server öffnen.
Aber warum versucht der SSH-Client es nicht immer wieder, selbst wenn es einen kurzen Ausfall gab, sondern bricht vorzeitig ab? Wie kann ich SSH so konfigurieren, dass es (wirklich) immer wieder versucht?
Antwort1
Nicht unbedingt eine Lösung für mein Problem, aber zumindest kann ich das Problem umgehen, indem ich einen Prozess in einer anderen Shell ausführe, der sich parallel jede Sekunde beim Remote-Server anmeldet, wie
while true ; do ssh <server> "date; sleep 1s"; done
Ich weiß nicht, warum, aber es verhindert wirksam die in meiner ursprünglichen Frage oben genannten Probleme.