Need a way to use 2 networks to access the server in parallel sharing data traffic

Posted on

Problem :

I have a server connected to Internet via two networks – A microwave link and an ADSL Link. The server has been assigned static IP address in both network.

Both both the networks are not reliable and get disconnected often. So whatever task I run from my client through ssh gets interrupted and I have to close everything and switch to the other connection.

Its frustrating to do this every time and hence I was wondering if there is a way that I can open a ssh connection that uses both the network in parallel, share the data transfer between the two and if there is any failure in one of the network,redirect the entire data traffic to the other in a way that my ssh doesn’t get affected and I can seamlessly work without knowing which network the ssh is actually using?

This may be ridiculously senseless question but I am no networking expert.Please tell me if this is possible or please suggest me other ways to accomplish this, if any.

My server uses CentOS and my client is Ubuntu and Mac.

Solution :

I’d suggest another tactic – While there are tools that allow for load balancing, it may not work for your use case as it is. I suggest having a session thats resilient to disconnections

Firstly, I’d run my commands in screen or tmux – that way your commands keep running even if you get disconnected. You can then log back in and re-attach the session. You want to do this in any scenario. You want screen installed on your servers. You start a ssh session (or a mosh session), start screen in that, and any tasks started in that session (or other screen sessions) will just keep running. You can even detatch the screen session to do other things, or completely quit your ssh session and come back to the screen session later.

I’d also suggest looking at mosh rather than plain vanilla ssh. Mosh is designed to let you roam between connections, and designed for high latency connections like yours. I’d use this with screen to be safe, but this should let you do what you want to do.

I’d be tempted to experiment with load balancing – I use dispatch proxy, which would switch over if a connection was bad but I’m not sure if this works with a ssh or mosh client. Either or both of the above suggestions would probably handle this cleanly, even with one bad connection.

Leave a Reply

Your email address will not be published. Required fields are marked *