Ssh connection keeps droping

hello and thanks,

using ssh, over internet, i am able to connect to my openwrt router.

the problem is the ssh connection keeps dropping.

note: i have a continuous ping to the openwrt router.
when the ssh does down, the ping do not go down

here is the error message from bitvise ssh client, running on windows.

"The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host."

i do not know how to diagnose this, why the openwrt router is closing the connection over and over again.

thanks,
david

Is it due to inactivity or does it also happen while you are doing something?

thanks,
i do not recall an error when using the command prompt but i have not used the ssh much in the past, not really sure.
not sure how to test for that?

is there a setting that control inactivity?
i just created a new user, non-root, does that matter?

here is the timestamps, weird that the seconds, are always based on 10s
10,20,30,40,50, never 11, 22,34,47,56

09:05:30.687 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:08:50.686 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:12:20.688 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:15:50.680 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:19:20.684 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:27:40.676 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:30:50.663 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:34:20.663 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:37:40.661 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:41:10.655 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:44:30.650 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:47:40.644 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:51:00.641 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:54:20.637 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
09:57:40.639 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:01:00.641 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:04:20.633 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:07:40.624 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:11:00.621 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:14:20.627 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:17:40.621 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:21:00.608 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:27:30.609 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:30:40.596 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:36:30.602 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:39:40.595 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:42:50.582 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.
10:46:00.582 The SSH session has terminated with error. Reason: FlowSocketReader: Error receiving bytes. Windows error 10054: An existing connection was forcibly closed by the remote host.

Yes, both on client and on server.

no.

That could explain the disconnection by inactivity.

1 Like

how can i test about inactivity?
i do not recall this happening when i am local on the lan and ssh in.

as a test, on the ssh prompt, i have continous ping.
will that be considered activity?
so far, in 10 minutes, no drops.

No, I am referring to inactivity of the ssh connection.
Depending on the client and the server there are anti-idle or keepalive settings.
The default in Dropbear is 5'

on client, do no remember this happening before with any other server.

sudo uci show dropbear
Password:
dropbear.@dropbear[0]=dropbear
dropbear.@dropbear[0].Port='34431'
dropbear.@dropbear[0].GatewayPorts='on'
dropbear.@dropbear[0].PasswordAuth='off'

i made the following change.

uci set dropbear.@dropbear[0].IdleTimeout=9999
uci commit

The idle timeout is by default zero (not to time out), so I wouldn't mess with that.

1 Like

thanks, i set it back to zero.

root@OpenWrt:~# uci show dropbear
dropbear.@dropbear[0]=dropbear
dropbear.@dropbear[0].Port='34431'
dropbear.@dropbear[0].GatewayPorts='on'
dropbear.@dropbear[0].PasswordAuth='off'
dropbear.@dropbear[0].IdleTimeout='0'

about SSHKeepAlive, not sure what that is?
if the client does not send a keep alive packed in 300 seconds, close the connection?
if true, then i can raise the value, correct?

Try instead to send more often keepalives.

not sure how to increase the keep alives on the client, trying to figure that out.

about the server, SSHKeepAlive, not sure what that value does?
if the client does not send a keep alive packed in 300 seconds, close the connection?
if true, then i can raise the value, correct?

It defines when to send keepalives.

No, to send to the client a keepalive every 300".

No, you want to lower it.

1 Like

thanks much for now.

i am back inside the lan and the same client has been connectect for 30 minutes.
so far, the session has not closed.

i am going to test at another location outside the lan and see what happens.

hi,

not sure what changed, but no the ssh connection does not drop.

thanks much,
david

Did you set any keepalives or prolonged the idletimeout time on both sides?

1 Like

no changes since you helped me.
could have been a internet glitch, tho it happened for a few days before i asked for help.

i am going to install tmux in case this happens again.

1 Like