Stable reverse port forwarding in SSH and stale sessions
- by Vi
Using VPS to forward ports behind NAT:
for((;;)) { ssh -R 2222:127.0.0.1:22 [email protected]; sleep 10; }
When connection is broken somehow and it is reconnecting.
Warning: remote port forwarding failed for listen port 2222
Linux vi-server.no-ip.org 2.6.18-92.1.13.el5.028stab059.3 #1 SMP Wed Oct 15 13:33:44 MSD 2008 i686
I type:
vi@vi-server:~$ killall sshd
Connection to vi-server.org closed by remote host.
Connection to vi-server.org closed.
Linux vi-server.no-ip.org 2.6.18-92.1.13.el5.028stab059.3 #1 SMP Wed Oct 15 13:33:44 MSD 2008 i686
vi@vi-server:~$
Now it's OK.
How it's simpler to make this automatic?