LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

[LVS] Different Ports on Director (NAT) to distribute on differen t serv

To: "'lvs-users@xxxxxxxxxxxxxxxxxxxxxx'" <lvs-users@xxxxxxxxxxxxxxxxxxxxxx>
Subject: [LVS] Different Ports on Director (NAT) to distribute on differen t server Packages
From: Grames Gernot <gernot.grames@xxxxxxxxxxx>
Date: Thu, 2 Jun 2005 08:21:57 +0200
Hello,
 
I am faced to following problem:
 
I have an http request which can be logical splittet up to three different
request.
My idea is to use for this three different request a seperate port (8701,
8702 and 8703), to qualify this incoming request and to use qdisc filter
(ingress) on this (for each port different filter).
 
Hint: Port 8701 to RealServer1 and RealServer2
        Port 8702 and 8703 to RealServer3 and RealServer4
 
But now a have the problem with my lvs director, because i am only able to
forward (distribute) the port 8080.
How i can set it up to handle the other ports. The incoming ports for the
realserver have to be 8080. So on the realserver there is no change in my
script necessary!
 
I use following scripts:
Director:
 
#!/bin/sh
#------mini-HOWTO-setup-LVS-NAT-director----------
 
#set ip_forward ON for vs-nat director (1 on, 0 off).
cat /proc/sys/net/ipv4/ip_forward
echo "1" >/proc/sys/net/ipv4/ip_forward
 
#director is gw for realservers
#turn OFF icmp redirects (1 on, 0 off)
echo "0" >/proc/sys/net/ipv4/conf/all/send_redirects
cat       /proc/sys/net/ipv4/conf/all/send_redirects
echo "0" >/proc/sys/net/ipv4/conf/default/send_redirects
cat       /proc/sys/net/ipv4/conf/default/send_redirects
echo "0" >/proc/sys/net/ipv4/conf/eth0/send_redirects
cat       /proc/sys/net/ipv4/conf/eth0/send_redirects
 
#setup VIP
# VIP is the address which is used for the incoming traffic from the outside
network
/sbin/ifconfig eth1:10 192.168.0.10 broadcast 192.168.0.255 netmask
255.255.255.0
 
#set default gateway
#the default gateway in the siemens net is 158.226.150.254
/sbin/route add default gw 192.168.0.1 netmask 0.0.0.0 metric 1
 
#clear ipvsadm tables
/sbin/ipvsadm -C
 
#install LVS services with ipvsadm
#add telnet to VIP with rr sheduling
/sbin/ipvsadm -A -t 192.168.0.10:8080 -s rr
 
#first realserver iacapp3
#forward http to realserver 192.168.0.11 using LVS-NAT (-m), with weight=1
########Not Working#########/sbin/ipvsadm -a -t 192.168.0.10:8701 -r
192.168.0.20:8080 -m -w 1 #Return channel
########Not Working#########/sbin/ipvsadm -a -t 192.168.0.10:8702 -r
192.168.0.20:8080 -m -w 1 #Web connections
########Not Working#########/sbin/ipvsadm -a -t 192.168.0.10:8703 -r
192.168.0.20:8080 -m -w 1 #Soap connections
########Working but i need the other ones#########/sbin/ipvsadm -a -t
192.168.0.10:8080 -r 192.168.0.20:8080 -m -w 1 #Soap connections
#check that realserver is reachable from director
ping -c 1 192.168.0.20
 
#second realserver
#forward telnet to realserver 192.168.1.12 using LVS-NAT (-m), with weight=1
####/sbin/ipvsadm -a -t 158.226.149.123:telnet -r 192.168.0.21:telnet -m -w
1
########Not Working#########/sbin/ipvsadm -a -t 192.168.0.10:8701 -r
192.168.0.22:8080 -m -w 1 #Return channel
########Not Working#########/sbin/ipvsadm -a -t 192.168.0.10:8702 -r
192.168.0.22:8080 -m -w 1 #Web connections
########Not Working#########/sbin/ipvsadm -a -t 192.168.0.10:8703 -r
192.168.0.22:8080 -m -w 1 #Soap connections
########Working but i need the other ones#########/sbin/ipvsadm -a -t
192.168.0.10:8080 -r 192.168.0.22:8080 -m -w 1 #Soap connections
#checking if realserver is reachable from director
ping -c 1 192.168.0.22
 
#list ipvsadm table
/sbin/ipvsadm
#------mini-HOWTO-setup-LVS-NAT-director----------

 
Realserver:
 
#!/bin/sh
#---------mini-HOWTO-setup-LVS-NAT-realserver-------
#installing default gw 192.168.0.5 for vs-nat'
/sbin/route add default gw 192.168.0.10
#show routing table
/bin/netstat -rn
 
#checking if DEFAULT_GW is reachable
ping -c 1 192.168.0.10
 
#looking for VIP on director from realserver
###ping -c 1 158.226.149.123
 
#set_realserver_ip_forwarding to OFF (1 on, 0 off).
echo "0" >/proc/sys/net/ipv4/ip_forward
cat       /proc/sys/net/ipv4/ip_forward
 
#---------mini-HOWTO-setup-LVS-NAT-realserver-------
 
 
How can i solve this Problem.
 
Hint: I have i firewall in front of my director whith ip forwarding. It is
possible to use this as classifications ?????
 
Thanks for all infos which can bring me a step further!
 
Gernot
 
 
 

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