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

  • 3
    If you get the same IP address both ways, then this should Just Work. If not, it's pretty much impossible. – Alan Curry Aug 15 '12 at 20:28
  • @AlanCurry If both client and server support MPTCP, then it is possible. But MPTCP support is still very limited, so that's unlikely to be the case. – kasperd Apr 3 '16 at 14:07

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.

  • This looks like a very good solution, but unfortunately it needs to be installed on the server too, which is not always possible due to permissions. – user000001 Oct 26 '18 at 15:18

I'm afraid you cannot do this, by definition. An SSH session runs over a TCP connection, which is defined by the four-tuple (source address, source port, destination address, destination port). You cannot shift the existing connection to a different address on the client (aside from the fact that the OS will tear down the connection when the interface goes down).

NAT may complicate this picture, but not in any way that will help you.

  • Yes, but the application can reconnect once it knows that the socket has closed. Does the SSH protocol have a provision to resume an old session? – Ajay Brahmakshatriya Sep 20 '18 at 18:33
  • @AjayBrahmakshatriya SSH has no tools to resume sessions – Ferrybig Aug 16 '19 at 20:55

Old thread, I know, but for sake of completeness since I was looking for the same thing...

In Windows 7 or newer you should simply be able to select both your wifi adapter and Ethernet adapter and choose "Bridge Connection". This will give you a single IP address for both, and you will now be able to disconnect and reconnect Ethernet at will (given continuous wifi coverage).

  • Good idea, I will have to try this. – Doug Apr 3 '16 at 14:03
  • If doing this, don't cannot to both networks at once, depending on the setup, it kicks everyone in area of the network (source: this happened to me) – Ferrybig Aug 16 '19 at 20:56

I manage this in two ways:

Start the session from a terminal server in your datacenter (RDP/Windows/etc)


Install GNU or and start them after login.

I prefer tmux because screen is pretty old school, but if you are only allowed to install supported packages, screen is in the RHEL repo.


Do both.

  • tmux is really handy. Running remote stuff inside of tmux is an excellent habit to get into. – chicks Apr 3 '16 at 15:01
  • Yes, I agree. The multiple window function is great. – Doug Apr 3 '16 at 15:17

It can't be done easily.

I can point you at a number of very expensive applications that allow you to keep a telnet or SSH session when moving between IPs or APs, or even for periods of extended periods network disconnection, but they basically achieve this by creating an always-open server-side session for the client machine so the server doesn't know the connection's different or dropped.

I suppose you could code up such a thing, but I imagine that if it was easy to do, my clients wouldn't be getting raped with 5 figure costs for keeping their terminal connections open on wireless handheld scanners.

Though, I did stumble across screen, which claims to create persistent SSH sessions, which may actually work... give it a shot.


The problem is probably that your source IP address changes when you switch between cabled and wifi. This will prevent ssh sessions from coming back.

I handled this in linux by connecting over a vpn and making sure that the vpn connection always gives the same ip to your account (not difficult to enforce, but chance is high that you will receive the same ip over vpn already by default anyway if it's available, but better enforce it to be sure). I mostly use vtun, but openvpn is ok too. Make sure your connections go over the vpn (correct routing, pushed prefixes,...)

I've been able to be offline from the cable for even as long as 5 minutes and then connect to wifi and still be able to stay connected to all my ssh sessions. Ongoing ping, mtr, htop,... just continue when the vpn is restored as if nothing happened.


Try being only on wifi when you first start the ssh session. Then plug your ethernet in. That should allow new connections to go over the ethernet, but the established connection will remain on wifi. At least I have seen it work like this with OSX, so OS/hardware may vary.


I'm pretty sure you can do this with some silly amount of hacking w/ VMs and Tunneling.

This is untested, but let me know if it does indeed work.

  1. Create a guest VM that has 2 interfaces, 1 bridged adapter (to wifi) and 1 host only networking
  2. Lets say the VM has for the bridged adapter to the wife and to the host only.
  3. Within the vm create the ssh connection w/ a tunnel to the remote side's port 22 ssh -L 10022:remote.server.example.com:22
  4. Now connect through the tunnel. ssh -p 10022
  5. When you lose your wifi connection, change the adapter on the VM over to the ether net adapter .
  6. Hopefully it doesnt hup or screw up the routing table

let me know if it works.

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.