Welcome! Log In Create A New Profile

Advanced

Using haproxy for tcp-port forwarding/mapping

Posted by Timh Bergström 
Timh Bergström
Using haproxy for tcp-port forwarding/mapping
April 02, 2012 01:30PM
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
Malcolm Turnbull
Re: Using haproxy for tcp-port forwarding/mapping
April 02, 2012 02:00PM
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]>:
> 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/
Timh Bergström
Re: Using haproxy for tcp-port forwarding/mapping
April 02, 2012 06:20PM
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/
>


--
Timh Bergström
www.quickvz.com
Baptiste
Re: Using haproxy for tcp-port forwarding/mapping
April 02, 2012 08:50PM
Hi,

You have a "port" parameter to tell on which port the health check
have to be performed.

cheers

2012/4/2 Timh Bergström <[email protected]>:
> 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]>:
>> > 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/
>
>
>
> --
> Timh Bergström
> www.quickvz.com
>
>
Sorry, only registered users may post in this forum.

Click here to login