Score:0

Redirect IP to another if not available

tr flag

I have 4 IPs something like that

  1. 10.10.10.11
  2. 10.10.10.12
  3. 10.10.10.13
  4. 10.10.10.14

and two ports 1000 and 1001.

my Linux server should connect those IPs with ports. Now I want to make this process automatic. To be more precise, the server tried to connect 10.10.10.11:1000 but it failed now it should try to connect 10.10.10.11:1001 automatically and so on. The problem is that I do not know how to do it. I looked for the answer but I was not able to find it and decided to ask here. Please if anyone did this can you help? If something is not clear let me know. Thank you beforehand!

vidarlo avatar
ar flag
What application is it? Some problems are easier to solve with an application aware proxy than L3...
exeral avatar
lk flag
be more precise, what should connect to those IPs ? a script ? a homemade app ? a third party software ?
coder avatar
tr flag
@exeral those IPs belong to third-party software. and I need to connect it with those IPs for data processing
Score:1
us flag

I would consider a load balancer for this use case.

A load balancer will distribute connections across all of the backend servers you configure.

If one of your backend servers goes down, the load balancer will see that and not direct traffic to it anymore until it comes back up.

You can change how connections are distributed in various ways depending on the load balancer.

Here is some great documentation on using NGINX as a load balancer (there are many others):

http://nginx.org/en/docs/http/load_balancing.html

Score:1
lk flag

your client/application must handle the logic to retry the different servers/IPs.

if it can't, you can put a loadbalancer between the app and the servers to take care of that behavior.

out of the box, iptables can't do that.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.