1

This is a rather specific question, but it is one I haven't been able to find an answer to. I'm running a set of services on an LXC container in Ubuntu 16.04 LTS, specifically game servers. However, this service is known to fail, and so has its wrapper. So in order to maintain uptime and load balance where services are hanging or unresponsive, I need to be able to redirect both UDP and TCP traffic based on whether a service or services are responsive or not.

To better explain the scenario, I have an LXC container exposed to a public IP, with another LXC container nested with iptables redirecting traffic on port 21025 to the nested container. Inside that container, if the services that accept the traffic (called ServiceWrapper and ServiceMain) are unresponsive, the traffic must go to another service on another port which we'll call ServiceFallback. Otherwise, the traffic goes as expected to ServiceWrapper which then sends the traffic to ServiceMain.

My current attempt to implement this sort of routing has been to use HAProxy to loadbalance between ServiceWrapper and ServiceFallback, however at first glance it appears HAProxy does not detect or allow the redirection of additional ports based on how it is loadbalancing ServiceWrapper and ServiceFallback. You see, ServiceMain accepts UDP traffic on another port to facilitate server queries such as version, hostname, etc etc. And as far as I can tell, HAProxy will not route or detect UDP traffic.

I'm semi-desperate to get this to work. I know it is possible because the exact setup I'm attempting to perform has worked for one of my direct competitors, however they seem reluctant to share with me even the packages they used to do it (reasonable, but eh).

1
  • I feel you need NGINX
    – Geoduck
    Commented Mar 9, 2018 at 17:48

1 Answer 1

0

NGINX should do everything you need. It support UDP routing and has both passive and active health checks, so you can configure how it determines if the main service is running or not. It can be configured to only fall back to your backup service if the health checks fail.

2
  • Does NGINX rewrite the source IP? And if so, does it send traffic back to where it originally came from when it receives a response? This was another issue I encountered later with HAproxy: packets coming into the ServiceWrapper would read as coming from the internal IP HAproxy was running out of, and not the actual source IP.
    – Shigbeard_
    Commented Mar 10, 2018 at 5:32
  • Generally, yes, it will appear to be from an internal IP but be forwardd back to client. I haven't used the UDP proxy, however, as it seems like it would have to have the source IP somehow. For http traffic it would put the original in the header.
    – Geoduck
    Commented Mar 10, 2018 at 7:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .