[lvs-users] netmask for vip?

Andrew Smalley asmalley at loadbalancer.org
Thu Jun 22 13:27:29 BST 2017


Hello Linbo

You will want to configure keepalived in the subnet that your VIP
should be assigned.

also you will want to configure it for the interface it should be
brought up on too.

Example : I have a LVS director and it has 2 interfaces.

eth0 192.168.100.1/28
eth1 172.31.1.10/12

I want to bring up the VIP on eth1 as IP 172.31.1.11/12

You only configure the 172.31.1.11/32 on the LO interface on each real
server for the VIP itself it should be as above in the same subnet as
the primary IP Address.

I hope that makes sense
Andrew Smalley

Loadbalancer.org Ltd.

www.loadbalancer.org
+1 888 867 9504 / +44 (0)330 380 1064
asmalley at loadbalancer.org

Leave a Review | Deployment Guides | Blog


On 22 June 2017 at 13:01, linbo liao <llbgurs at gmail.com> wrote:
> Thanks Julian, I  understand /32 for "lo" interface.
>
> But my question is VIP for director, it usually configure in other
> interface than "lo" , what's the difference between /32 and actual subnet
> of the VIP.
>
> In keepalived, if no netmask provide, vip will configure with /32 netmask,
> for example:
>
> virtual_ipaddress {
>     192.168.0.111    ; it will use /32 netmask
>     192.168.0.112/24    ; it will use /24 netmask
> }
>
> Thanks,
> Linbo
>
> 2017-06-22 5:10 GMT+08:00 Julian Anastasov <ja at ssi.bg>:
>
>>
>>         Hello,
>>
>> On Sun, 18 Jun 2017, linbo liao wrote:
>>
>> > If vip 192.168.0.111 from subnet 192.168.0.0/24, and no netmask support
>> in
>> > configuration, the default netmask is 255.255.255.255. I test default
>> > netmask, looks everything works fine.
>> >
>> > So what's the proper netmask for vip, 255.255.255.255 or 255.255.255.0?
>>
>>         The "lo" interface is special in Linux, if you
>> add IP/24 on lo, what is added actually is a range of local
>> addresses, i.e. 256 local addresses in the case for /24.
>> As result, for the 127.0.0.1/8 case, we actually have
>> 16,777,216 local addresses, i.e. you can use 127.0.0.1 but
>> also 127.0.0.2 ... 127.255.255.255.
>>
>>         In the common case with IPVS, we add single VIP, so
>> only 255.255.255.255 should be used. And I don't think
>> 255.255.255.255 is a default mask, it should be specified in
>> all commands.
>>
>> Regards
>>
>> --
>> Julian Anastasov <ja at ssi.bg>
>>
> _______________________________________________
> Please read the documentation before posting - it's available at:
> http://www.linuxvirtualserver.org/
>
> LinuxVirtualServer.org mailing list - lvs-users at LinuxVirtualServer.org
> Send requests to lvs-users-request at LinuxVirtualServer.org
> or go to http://lists.graemef.net/mailman/listinfo/lvs-users



More information about the lvs-users mailing list