Using haproxy for tcp-port forwarding/mapping

I'm looking for an "easy" way to setup simple tcp port-forwarding with
haproxy alongside normal load-balancing. Thing is, the incoming ports
are random within 5900-6000 so I need to forward the same incoming
port to the backend(s). I tried doing this with a "listen" directive
and with "frontend"/"backend" setups but couldn't get it to work
properly. The haproxy server can "bind" on these ports just fine, I
just need to make sure that the incoming connection is forwarded to
the same port on the backend-servers. Has someone else done something
like this?

TCP: 5972 -> haproxy-server -> TCP: 5972 backend-server

As you may see it's for pushing VNC-connections through haproxy
because all other traffic is going through there as well. I'm using
"balance src" so I'm not that fussed about "sessions" or "state" at
this point. Any info or pointers are much appreciated.

If you don't specify the destination port on the backend servers then
it defaults to using the port the traffic requested.

2012/4/2 Timh Bergström <[email protected]>:
> Hi,
>
> I'm looking for an "easy" way to setup simple tcp port-forwarding with
> haproxy alongside normal load-balancing. Thing is, the incoming ports
> are random within 5900-6000 so I need to forward the same incoming
> port to the backend(s). I tried doing this with a "listen" directive
> and with "frontend"/"backend" setups but couldn't get it to work
> properly. The haproxy server can "bind" on these ports just fine, I
> just need to make sure that the incoming connection is forwarded to
> the same port on the backend-servers. Has someone else done something
> like this?
>
> TCP: 5972 -> haproxy-server -> TCP: 5972 backend-server
>
> As you may see it's for pushing VNC-connections through haproxy
> because all other traffic is going through there as well. I'm using
> "balance src" so I'm not that fussed about "sessions" or "state" at
> this point. Any info or pointers are much appreciated.
>
> Timh Bergström
> www.quickvz.com
>

Thanks, I wonder why it doesn't work for me then, how do you solve "server
checking" when no backend or server port is configured?

The vnc servers is created on the fly so theyre not always running.

//T

On Monday, April 2, 2012, Malcolm Turnbull wrote:

> Timh,
>
> If you don't specify the destination port on the backend servers then
> it defaults to using the port the traffic requested.
>
>
>
> 2012/4/2 Timh Bergström <[email protected] <javascript:;>>:
> > Hi,
> >
> > I'm looking for an "easy" way to setup simple tcp port-forwarding with
> > haproxy alongside normal load-balancing. Thing is, the incoming ports
> > are random within 5900-6000 so I need to forward the same incoming
> > port to the backend(s). I tried doing this with a "listen" directive
> > and with "frontend"/"backend" setups but couldn't get it to work
> > properly. The haproxy server can "bind" on these ports just fine, I
> > just need to make sure that the incoming connection is forwarded to
> > the same port on the backend-servers. Has someone else done something
> > like this?
> >
> > TCP: 5972 -> haproxy-server -> TCP: 5972 backend-server
> >
> > As you may see it's for pushing VNC-connections through haproxy
> > because all other traffic is going through there as well. I'm using
> > "balance src" so I'm not that fussed about "sessions" or "state" at
> > this point. Any info or pointers are much appreciated.
> >
> > Timh Bergström
> > www.quickvz.com
> >
>
>
>
> --
> Regards,
>
> Malcolm Turnbull.
>
> Loadbalancer.org Ltd.
> Phone: +44 (0)870 443 8779
> http://www.loadbalancer.org/
>