This is on linux, connecting to linux servers:

I love mosh, but it doesn't support port forwarding, and likely won't for a while since it's been almost a year now and it hasn't happened yet.

port forwarding over ssh is great, but because my laptop moves between networks several times a day, my ssh sessions die, and so do the port forwards.

I could script/hack something to detect hung ssh and reconnect to get my port forwards back, but before I do this, is there another way to do long lasting port forwards when your source IP changes several times daily (because you go on different networks)?

I'm thinking an ssh over UDP would do the trick but of course ssh is over TCP.

  • Get a static IP address. Get Mobile IPv6. – Michael Hampton May 29 '14 at 4:26
  • 2
    I have a static IP at home, but I just move around to other places, so that won't work. Mobile IPv6 will work when it's available most places I go. It's not yet. – Marc Merlin May 29 '14 at 14:37
  • In that case the long-term answer is Mobile IPv6, but it will be a while before you can use that everywhere. – Michael Hampton May 29 '14 at 14:37
  • 1
    you're right, although having a mosh like solution that includes port forwarding, would work today. Effectively that would be a mobile IPv4 tunnel. – Marc Merlin May 29 '14 at 14:39
  • This looks to be a duplicate of superuser.com/questions/37738/…. The answer there is autossh which restarts a slave ssh when it fails. – elifiner Mar 27 '16 at 8:12

You could try tinc: http://www.tinc-vpn.org/ which would let you connect directly despite the changing IPs.

| improve this answer | |

MOSH will never have PortForwarding because it does not work at the same level, it synchronizes the display of the client console with the server console with SSP (State Synchronization Protocol), it does not transmit real data

but you can use AutoSsh instead of SSH, is the same goes with connection monitoring and automatic reconnection

and if you want limit bandwith you can add trickle

sudo trickle -d 10 -u 10 -- autossh -F /path/to/config-file site1

like an open project : MAST (warning is very old!)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.