LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: [lvs-users] IPVS NAT source IP selection

To: Leandro R <leandro.rhcp99@xxxxxxxxx>
Subject: Re: [lvs-users] IPVS NAT source IP selection
Cc: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
From: Julian Anastasov <ja@xxxxxx>
Date: Sat, 5 Jan 2019 17:51:10 +0200 (EET)
        Hello,

On Thu, 27 Sep 2018, Leandro R wrote:

> Hi there,
> 
> I have a simple L4 Director setup with multiple real network interface
> (eth0, eht1, and eth2) my real servers only have access to the director
> through its eth1 <IP> interface.
> 
> When I create a simple rule (L4 NAT (masquerading) pointing to all my
> reals) it does the NAT using the eth0 as the source ip to the real. Now my
> questions:
> 
> How does the ipvs choose which ip / network interface to be its SNAT to the
> reals? (the first one eth0)

        For NAT method: only based on the real server IP.

> Can I induce/setup it to pick a specific one? (like eth1)

        Probably, you should have host route in director, one per real 
server:

ip route add RIP1/32 dev eth1 src IP_X

        Note that IPVS sends packets to real server by preserving the
client IP in the IP saddr. If you later do MASQ, then check the code in
nf_nat_masquerade_ipv4(): it selects local IP from the output interface
that is already selected by IPVS. But may be you can do SNAT as well,
in this case you can specify the desired saddr.

Regards

--
Julian Anastasov <ja@xxxxxx>

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

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

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [lvs-users] IPVS NAT source IP selection, Julian Anastasov <=