LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: port translation in lvs

To: "LinuxVirtualServer.org users mailing list." <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: port translation in lvs
From: Ryan Leathers <ryan.leathers@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 09 Mar 2004 11:33:31 -0500
I asked several days ago for advice about how to handle port translation
for lvs servers.  Thanks for the help so far.

I have written a simple script to load the service table.
(The IP addresses have been obscurred)

My goal is to have 3 real servers all accepting requests for a web
service listening on a high port, 7777 in this example.  Clients may
attempt to connect to a variety of ports at the VIP which will be
directed to real servers by wlc.  I also want each real server to have
its own VIP, but the primary goal is to distribute load using the main
VIP.

#!/bin/sh
 
echo "
-A -t 123.456.789.202:80
-A -t 123.456.789.203:80
-A -t 123.456.789.204:80
 
-A -t 123.456.789.210:80 -s wlc
-A -t 123.456.789.210:443 -s wlc
-A -t 123.456.789.210:7777 -s wlc
-A -t 123.456.789.210:9999 -s wlc
 
-a -t 123.456.789.202:80 -r 172.16.240.202:7777 -m
-a -t 123.456.789.203:80 -r 172.16.240.203:7777 -m
-a -t 123.456.789.204:80 -r 172.16.240.204:7777 -m
 
-a -t 123.456.789.210:80 -r 172.16.240.202:7777 -m -w 2
-a -t 123.456.789.210:80 -r 172.16.240.203:7777 -m -w 2
-a -t 123.456.789.210:80 -r 172.16.240.204:7777 -m -w 2
-a -t 123.456.789.210:443 -r 172.16.240.202:7777 -m -w 2
-a -t 123.456.789.210:443 -r 172.16.240.203:7777 -m -w 2
-a -t 123.456.789.210:443 -r 172.16.240.204:7777 -m -w 2
-a -t 123.456.789.210:7777 -r 172.16.240.202:7777 -m -w 2
-a -t 123.456.789.210:7777 -r 172.16.240.203:7777 -m -w 2
-a -t 123.456.789.210:7777 -r 172.16.240.204:7777 -m -w 2
-a -t 123.456.789.210:9999 -r 172.16.240.202:7777 -m -w 2
-a -t 123.456.789.210:9999 -r 172.16.240.203:7777 -m -w 2
-a -t 123.456.789.210:9999 -r 172.16.240.204:7777 -m -w 2
" | ipvsadm -R

Now my question is:
How do I get the virtual interfaces created in order to handle the 3
additional VIP addresses?  I do not see clearly how to do this in lvs.cf
and I suspect that building virtual interfaces by hand is not
sufficient.  Somehow the virtual interface must be included in a lvs
table known to the kernel right?

I don't understand what is reading and parsing lvs.cf and where the
results are placed.  Perhaps if I could gain this insight the rest would
become clear.


On Thu, 2004-03-04 at 16:07, Joseph Mack wrote:
> Francois JEANMOUGIN wrote:
> 
> > Well, if you need to keep DR or Tun LVS, just use :
> > 
> > /sbin/iptables -t nat -A PREROUTING -d VIP -p tcp -m tcp --dport 80 -j DNAT 
> > --to-destination VIP:9999
> > 
> > on the realserver. It works for me for tomcat standalone servers.
> 
> does this rewrite the packets in the reverse direction too?
> 
> Joe
-- 
Ryan Leathers <ryan.leathers@xxxxxxxxxxxxxxxxxxx>
Global Knowledge

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