[lvs-users] Deploy a lvs on only one host

net.study.sea at gmail.com net.study.sea at gmail.com
Sun Apr 27 10:42:56 BST 2014



thanks for reply!

I know it could work in nat mode,but I want to know why it does not work in dr mode?

I have done some test,  and find the director just refuse any request to VIP ,without routing to real server .what is the reason?



在 2014-4-26,14:03,Julian Anastasov <ja at ssi.bg> 写道:

> 
>    Hello,
> 
> On Sun, 20 Apr 2014, Hatt Tom wrote:
> 
>> hi:
>> 
>>   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 :
>> 
>> VIP=192.168.1.118
>>  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?
> 
> Regards
> 
> --
> Julian Anastasov <ja at ssi.bg>



More information about the lvs-users mailing list