0

I am using ubuntu 20 and I am connected with wifi to the hotspot of a Galaxy A20e running android 12 which is receiving 4G. I have a connection problem that is not occuring when using my ADSL connection.

Test description : I opened a dozen of shells and established ssh connections to a dozen of servers and I just wait without interacting with the shells. After some time (usually 5 to 10 minutes), I observe a "client_loop: send disconnect: Broken pipe ssh" message on some of the shells, then after a longer time, I observe the same message on some other shells, until after maybe one hour, all connections are gone.

Using wireshark, I have filtered on packets exchanged with one of the servers and I notice no packets exchanged except the "keep alive" signal that is send from my computer every 5 minutes, (which is conform to my ssh client configuration). At some point, in response to one of those signal, the server returns RST ACK which means that the connection has been interrupted.

I tried to find the root cause of the connection cut by using pings but I did not find anything special during the 5 minutes window when the connection cut happens. Only thing I noticed is that some pings are sometimes not received.

Any idea ? Thanks

Yvon
  • 15
  • 5

1 Answers1

0

This question belongs to https://serverfault.com/

Try adding this to your .ssh/config:

Host *
    ServerAliveInterval 60
    ServerAliveCountMax 5

Most probably your 4G router or your 4G operator terminate idle connections.

mmomtchev
  • 2,497
  • 1
  • 8
  • 23
  • Hi, thank you, I am currently testing with an even more frequent keepalive based on explanation found here : https://lafibre.info/tcpip/ssh-cg-nat/ – Yvon Jan 12 '23 at 12:38
  • It worked with ServerAliveInterval at 4 seconds. As the link I provided is in french, I translate what is said in case some want a clue on what is possibly going on when using 4G behing a CG-NAT : "CG-NAT free inactive connexion after some time varying from 5 seconds to several minutes". I did not test with 60 seconds therefore I don't know if this is sufficient. – Yvon Jan 12 '23 at 15:03