4

I have an SSH server where multiple clients SSH in to maintain a bunch of port forwards.

What I want to do is, if the server goes down, have the clients automatically connect to the next server.

The question is, how would this be accomplished?

user9517
  • 114,104
  • 20
  • 206
  • 289
Leo
  • 41
  • 2
  • 1
    You're question as asked is unanswerable. You need to expand it to explain what software you're running, what's connected to what, and what you've done so far (if anything) in order for someone to help. – Holocryptic May 14 '11 at 14:06
  • OpenSSH server. Nothing special. It is just a VPS sitting out there. Several SSH clients just connect in and forward some ports. That is all there is too it. – Leo May 14 '11 at 14:18
  • Do your users connect for the pleasure of ssh use? What Holocryptic means is what do they access at? Probably you'll need to make redundant either the access tool (ssh) and the objective (the services they reach through ssh). Please elaborate a bit more your question. – hmontoliu May 14 '11 at 14:30
  • No. They are port forwarding. That is all. The ports are available only to the ssh server (as in, local access only). I need to make the server itself redundant, without the clients noticing. That is to say, if the server goes down, the next server takes over and the clients connect to that. – Leo May 14 '11 at 14:37

1 Answers1

2

If you have access to the clients configuration you can use autossh on their side to handle reconnects (to the same IP, that is - autossh doesn't handle reconnects to different servers).

On the server side I'd say you have multiple options - you can take a look at Heartbeat - it's the simplest solution I'm aware of. This is assuming you can move at least one IP reachable from the clients from server to server.

If you can't you should probably take a look at Linux Virtual Server, in which you use one or more servers as front ends. It's designed primarily for load balancing instead of failover but I think it can be fitted partially to your needs.

Eduardo Ivanec
  • 14,531
  • 1
  • 35
  • 42
  • Even with access to clients, can autossh be used to connect to a different server on failure? I have used it successfully for reconnecting to the same server before but this scenario is different. – john May 14 '11 at 15:38
  • Ultimately, instructing the client to try multiple servers on failure would be the easiest option to implement. On the Linux clients this is likely possible. However I am unsure how to do this with the Bitvise Windows clients. – Leo May 14 '11 at 15:41
  • @john: sorry, I wasn't clear on that - you can't actually use autossh for that as far as I know. I meant it to be used combined with either Heartbeat or LVS on the server side. – Eduardo Ivanec May 14 '11 at 16:11