Ssh – keep ssh connection alive and persistant while switching network interface connections

keepalivenetworkingsshsshfswifi

Scenario:

  1. At my desk with laptop plugged in to ethernet and connected to remote server over SSH
  2. Want to move to other side of office with laptop and change to WiFi without interrupting SSH connection

I've tried: connecting to WiFi first then disconnecting ethernet; and also disconnecting ethernet first then connecting to WiFi. Neither approach works. Also tried when using Ubuntu and OS X servers along with both OS options as well for the client. No luck.

It seems like I need some way of telling my SSH connection that it should begin using the newly connected network interface instead of the old disconnected interface. Any ideas?

I realize that I could just stay on WiFi the whole day, but I don't want to do that. I also realize that I can just work from within a screen session on the remote server and then re-connect to that screen session after changing interfaces, but I don't want to do that either. For example, I might be piping some big command like a database dump over SSH or I might have files open through SSHFS, or I might just want to avoid the nuisance of re-connecting

Best Answer

I suspect that this solution will not work for SSHFS, etc, but you could take a look at Mosh which provides roaming support for at least the shell itself.

Related Topic