[lvs-users] Deploy a lvs on only one host
ja at ssi.bg
Sat Apr 26 07:03:47 BST 2014
On Sun, 20 Apr 2014, Hatt Tom wrote:
> I am trying to construct a lvs on my host to schedule different
> process listening on different tcp port .
> Here is the shell to config director :
> 8 RIP1=192.168.1.116
> 9 RIP2=192.168.1.117
> 10 PORT=8088
> 11 #
> 12 case "$1" in
> 13 start)
> 14 /sbin/ifconfig eth0:1 $VIP broadcast $VIP netmask 255.255.255.255 up
> 15 /sbin/route add -host $VIP dev eth0:1
> 16 # Since this is the Director we must be able to forward packets
> 17 echo 1 > /proc/sys/net/ipv4/ip_forward
> 18 # Clear all iptables rules.
> 19 /sbin/iptables -F
> 20 # Reset iptables counters.
> 21 /sbin/iptables -Z
> 22 # Clear all ipvsadm rules/services.
> 23 /sbin/ipvsadm -C
> 24 # Add an IP virtual service for VIP
> 25 # In this recipe, we will use the round-robin scheduling method.
> 26 # In production, however, you should use a weighted, dynamic
> scheduling method.
> 27 /sbin/ipvsadm -A -t $VIP:8088 -s rr
> 28 # Now direct packets for this VIP to
> 29 # the real server IP (RIP) inside the cluster
> 30 /sbin/ipvsadm -a -t $VIP:8088 -r $RIP1 -g -w 1
> 31 /sbin/ipvsadm -a -t $VIP:8088 -r $RIP2 -g -w 2
-g does not change IP addresses and ports,
so -m (for DNAT) would be needed. DNAT to local
RIP:RPORT should work on 2.6.37 and up.
> 32 /bin/touch /var/lock/subsys/ipvsadm &> /dev/null
> After I configure the director , the real server has not received
> any routed packet from director
> where haveI token a mistake?
Julian Anastasov <ja at ssi.bg>
More information about the lvs-users