keepalived virtual_ipaddress and network mask
7,426
You can simply modify the virtual ip addresses block to read:
virtual_ipaddress {
192.168.120.25/27 label ens160:10
}
The default mask is /32
or 255.255.255.255
.
Related videos on Youtube
![Saurabh pandey](https://i.stack.imgur.com/4eesP.jpg?s=256&g=1)
Author by
Saurabh pandey
Updated on September 18, 2022Comments
-
Saurabh pandey almost 2 years
I have the following keepalived.conf file:
vrrp_script chk_nginx { script "curl http://localhost/vrrp_healthcheck/" interval 2 # every 2 seconds weight 2 # add 2 points if OK } vrrp_instance VI_1 { interface ens160 # interface to monitor virtual_router_id 50 priority 100 virtual_ipaddress { 192.168.120.25 label ens160:10 } track_script { chk_nginx } notify /usr/local/bin/notify.sh }
On the master node I see the following in the ifconfig output:
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.120.20 netmask 255.255.255.224 broadcast 192.168.120.31 ether 00:50:56:a5:c5:3a txqueuelen 1000 (Ethernet) RX packets 138308 bytes 130425415 (124.3 MiB) RX errors 0 dropped 73 overruns 0 frame 0 TX packets 122917 bytes 50788591 (48.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ens160:10: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.120.25 netmask 255.255.255.255 broadcast 0.0.0.0 ether 00:50:56:a5:c5:3a txqueuelen 1000 (Ethernet) lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 loop txqueuelen 1 (Local Loopback) RX packets 9730 bytes 812897 (793.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9730 bytes 812897 (793.8 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
What worries me, is the different broadcast and network address in the ens160:10 entry (which is the one created by keepalived).
Shouldn't those match the ones from the regular interface?
For the moment, my setup seems to work, but I want to make sure it is setup correctly.