Mailing List Archive

[lvs-users] Deploy a lvs on only one host
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
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?



--
Best Regards!

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@LinuxVirtualServer.org
Send requests to lvs-users-request@LinuxVirtualServer.org
or go to http://lists.graemef.net/mailman/listinfo/lvs-users
Re: [lvs-users] Deploy a lvs on only one host [ In reply to ]
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@ssi.bg>

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@LinuxVirtualServer.org
Send requests to lvs-users-request@LinuxVirtualServer.org
or go to http://lists.graemef.net/mailman/listinfo/lvs-users
Re: [lvs-users] Deploy a lvs on only one host [ In reply to ]
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@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@ssi.bg>

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@LinuxVirtualServer.org
Send requests to lvs-users-request@LinuxVirtualServer.org
or go to http://lists.graemef.net/mailman/listinfo/lvs-users
Re: [lvs-users] Deploy a lvs on only one host [ In reply to ]
Hello,

On Sun, 27 Apr 2014, net.study.sea@gmail.com wrote:

> 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?

The packet is "routed" (passed) to the local stack
but as the dest address is not changed the local stack
lookups for listener on VIP, not on RIP. OTOH, -m
will change the dest address to RIP and the RIP
listener is used.

Regards

--
Julian Anastasov <ja@ssi.bg>

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@LinuxVirtualServer.org
Send requests to lvs-users-request@LinuxVirtualServer.org
or go to http://lists.graemef.net/mailman/listinfo/lvs-users
Re: [lvs-users] Deploy a lvs on only one host [ In reply to ]
I understand what you mean.but I have bind VIP on lo:1,so I am puzzled for that.

ÔÚ 2014-4-28£¬14:49£¬Julian Anastasov <ja@ssi.bg> дµÀ£º

>
> Hello,
>
> On Sun, 27 Apr 2014, net.study.sea@gmail.com wrote:
>
>> 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?
>
> The packet is "routed" (passed) to the local stack
> but as the dest address is not changed the local stack
> lookups for listener on VIP, not on RIP. OTOH, -m
> will change the dest address to RIP and the RIP
> listener is used.
>
> Regards
>
> --
> Julian Anastasov <ja@ssi.bg>

_______________________________________________
Please read the documentation before posting - it's available at:
http://www.linuxvirtualserver.org/

LinuxVirtualServer.org mailing list - lvs-users@LinuxVirtualServer.org
Send requests to lvs-users-request@LinuxVirtualServer.org
or go to http://lists.graemef.net/mailman/listinfo/lvs-users