LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: Using LVS to forward HTTP from port 80 to servers running on port 81

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: Using LVS to forward HTTP from port 80 to servers running on port 81
From: Graeme Fowler <graeme@xxxxxxxxxxx>
Date: Thu, 13 Jul 2006 22:46:40 +0100
Hi

Travis Melhiser wrote:
I'm pretty new to LVS and can't seem to find the right configuration or the right documentation to get my environment set up.

I would like to have requests come to the LVS server on port 80 an then have the LVS server forward these requests to the machines in the cluster running the web servers on port 81.

Does anyone have an example of how to set this up?

It depends how you're configuring your LVS. If you're using keepalived, ldirectord, or some other piece of automation then you'll simply need to setup your virtual server VIP on port 80 and the realservers behind it on port 81.

If you're doing your setup "by hand" using ipvsadm, then you'll do something like the following (but see the note below):

ipvsadm -A -t $VIP:80
ipvsadm -a -t $VIP:80 -r $RIP:81 -m -w $WEIGHT

...and so on for your other virtual servers. Other options may apply, and because it's fairly late I may have dropped a howler with the others, but you get the idea I'm sure :)

Here's the note mentioned above: as far as I am aware, you can likely only do this in an LVS NAT (masquerading) system. IN DR or TUN (gatewaying or ipip encapsulation respectively), the replies go diretly (in the majority of cases) from the realserver to the client, so if you wanted to reply from a different port your TCP three-way handshake won't work.

Hope that helps

Graeme

<Prev in Thread] Current Thread [Next in Thread>