Multiple SSH Connections over different connections

2

I have a Linux box with a couple of 3G/HSDPA modems, seen as network connections, and i would like to get each to connect to a server over SSH. The server could be the same server, and i would need each 3G modem and network to connect to the server once... For example: 2 Modems (10.4.5.6 with GW 10.4.5.1 and 10.5.6.7 with GW 10.5.6.1, since most 3G modems give internal network IP addresses, but could be anything...). server is at 1.2.3.4. the Linux box should be able to connect to server 1.2.3.4 twice.... once though the 5.1 GW and once though the 6.1 GW. Is it possible to set this up?

TiernanO

Posted 2012-07-06T07:11:25.793

Reputation: 678

Look for a bonding howto, like on http://unixfoo.blogspot.de/2007/10/yet-to-add.html

– ott-- – 2012-07-06T08:57:00.413

Bonding is not possible for this set-up... bonding only works (tell me if i am wrong here) if the network cards are on the same network, eg, a machine with 4GigE connections to a single switch. in this case, the IPs i am given are dynamic, on different subnets, have different gateways, dns, etc... would be nice if it worked, but it wont... – TiernanO – 2012-07-06T09:06:46.317

possible duplicate of Force an application to use a specific network interface

– Bobby – 2012-07-06T09:10:53.317

Arrrr...crap, that is for OSX...might still work, though. – Bobby – 2012-07-06T09:11:15.190

it looks like it could work, technically, but since the server is going to have the same IP, only one route would actually be used... If i had 2 IPs on the server, which for 2 connections is not a problem, but for more, they could be, then routing would do the job... – TiernanO – 2012-07-06T09:29:32.223

If I see that correctly, you could try to set up aliases for the server and route via that. – Bobby – 2012-07-06T14:01:41.147

i have created 2 aliases in the hosts file on an unbuntu box ssh1 and ssh2. i then used <route add -host nr1 gw <gwip1> dev eth0> and the <route add -host nr2 gw <gwip2> dev eth1> but when i ssh into ssh1, it tells me i am logged in though ETH1's IP, and when i ssh into ssh2 i get the same info... or am i doing something wrong? CNAMEs? – TiernanO – 2012-07-06T14:30:48.377

@TiernanO Hi, I've done such setup with iproute mainly because of other requirements, what you are doing should work. If you still have this issue paste your route -n output I'll gladly help you out. – Valor – 2012-10-08T22:00:20.930

No answers