I set up an SSH Reverse tunnel using ssh -o StrictHostKeyChecking=no -R 2222:localhost:22 [email protected]
. The tunnel connect to the remote server and opens port 2222. I connect into the tunnel with ssh -p 2222 user@tunnelclient
and it works fine.
I jump into the tunnel and land on the other machine. A few minutes go by an then the remote host closes the connection.
I start a ping to keep the activity going, and still, the remote host (the client that starts the tunnel to the remote server) drops the connection.
Q: How can I stop this from happening?
... snip ...
64 bytes from 127.0.0.1: icmp_seq=70 ttl=64 time=0.080 ms
64 bytes from 127.0.0.1: icmp_seq=71 ttl=64 time=0.079 ms
64 bytes from 127.0.0.1: icmp_seq=72 ttl=64 time=0.076 ms
64 bytes from 127.0.0.1: icmp_seq=73 ttl=64 time=0.080 ms
64 bytes from 127.0.0.1: icmp_seq=74 ttl=64 time=0.080 ms
64 bytes from 127.0.0.1: icmp_seq=75 ttl=64 time=0.080 ms
64 bytes from 127.0.0.1: icmp_seq=76 ttl=64 time=0.080 ms
Connection to localhost closed by remote host.
Connection to localhost closed.
user@remoteserver:~$
netstat -i
at each end. If possible, you could run the ssh server and/or client with the-d
option and it should tell you why it is closing the connection.Type=
field in the systemd service.