Re: iptables based load balancing doesn't work on lo interface

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Paul for the reply.
How do I use dummy interface to achieve my goal ?
Basically my problem is

I have two processes A and B
B is listening on 4 ports on 4 different threads
A will be sending message to B in the first port using <ipaddress>:<firstport>
This need to be load balanced across 4 ports in round robin fashion.

Thanks
~S


On 24 March 2018 at 18:13, Paul Robert Marino <prmarino1@xxxxxxxxx> wrote:
> Well first things first.
> lo does not work the same way on linux as it does with other operating
> systems. because of a security feature which was added to the 2.4 and higher
> kernel you can not route any thing in or out of a lo device. instead what
> you should use is a dummy interface.
>
> On Sat, Mar 24, 2018 at 8:02 AM, salil GK <gksalil@xxxxxxxxx> wrote:
>>
>> Hello
>>
>>   I have made iptables rules for load balancing traffic over a set of
>> ports. When packets coming through eth0, this load balancing works
>> perfect. But when packets are coming through loopback interface 'lo' (
>> another process in the same machine writes to
>> <ipaddress>:<destinationport>, load balancing rules are not getting
>> into effect. Is this expected behaviour or do I need to do some
>> settings to get it worked.
>>
>> My server is debian based linux.
>>
>> Below are my rules
>>
>> -A TURN_TCP -p tcp -i lo --dport 3477 -m statistic --mode nth --every
>> 4 --packet 0 -j REDIRECT --to-port 3477
>> -A TURN_TCP -p tcp -i lo --dport 3477 -m statistic --mode nth --every
>> 3 --packet 0 -j REDIRECT --to-port 3478
>> -A TURN_TCP -p tcp -i lo --dport 3477 -m statistic --mode nth --every
>> 2 --packet 0 -j REDIRECT --to-port 3479
>> -A TURN_TCP -p tcp -i lo --dport 3477 -j REDIRECT --to-port 3480
>> -A PREROUTING -i lo -m multiport -p tcp  --dports 3477:3480 -j TURN_TCP
>>
>> -A TURN_TCP -p tcp -i eth0 --dport 3477 -m statistic --mode nth
>> --every 4 --packet 0 -j REDIRECT --to-port 3477
>> -A TURN_TCP -p tcp -i eth0 --dport 3477 -m statistic --mode nth
>> --every 3 --packet 0 -j REDIRECT --to-port 3478
>> -A TURN_TCP -p tcp -i eth0 --dport 3477 -m statistic --mode nth
>> --every 2 --packet 0 -j REDIRECT --to-port 3479
>> -A TURN_TCP -p tcp -i eth0 --dport 3477 -j REDIRECT --to-port 3480
>> -A PREROUTING -i eth0 -m multiport -p tcp  --dports 3477:3480 -j TURN_TCP
>>
>>
>> Thanks and regards
>> ~S
>> --
>> To unsubscribe from this list: send the line "unsubscribe netfilter" in
>> the body of a message to majordomo@xxxxxxxxxxxxxxx
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux