keepalived+lvs子网掩码造成VIP切换故障架构:keepalived+lvs ,前端调度器是双主模型现象:keepalived手动停掉一台,但是虚拟IP不会切换整体网络是24位VIP:172.18.3.200keepalived的路由[root@Sserver3-53 clouder]# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 172.18.3.1 0.0.0.0 UG 0 0 0 eth0169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0172.18.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0PS:不fail over 原因就是这条16位的路由作怪: eth0:mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 06:cf:56:00:01:3b brd ff:ff:ff:ff:ff:ff inet 172.18.3.53/24 brd 172.18.3.255 scope global eth0 valid_lft forever preferred_lft forever inet 172.18.3.200/16 scope global eth0 #没有secondary valid_lft forever preferred_lft forever inet 172.18.3.201/16 scope global secondary eth0 valid_lft forever preferred_lft forever解决,配置检查:后端realserver配置的虚拟IP为:/sbin/ifconfig lo:0 172.18.3.200 broadcast 172.18.3.200 netmask 255.255.255.255 up/sbin/route add -host 172.18.3.200 dev lo:0前端keepalived:virtual_ipaddress { 172.18.3.200/16 }明显子网掩码出问题了。virtual_ipaddress { 172.18.3.200/24}重启keepalived,检查现象:[root@Sserver3-53 clouder]# route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 172.18.3.1 0.0.0.0 UG 0 0 0 eth0169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 eth0172.18.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 06:cf:56:00:01:3b brd ff:ff:ff:ff:ff:ff inet 172.18.3.53/24 brd 172.18.3.255 scope global eth0 valid_lft forever preferred_lft forever inet 172.18.3.200/24 scope global secondary eth0 valid_lft forever preferred_lft forever15.2 keepalived在centos7.2中的bugkeepalived 在centos7.2 使用 /bin/systemctl restart keepalived.service 配置文件没有生效需要使用reload参数来重新生效
参考:
https://www.cnblogs.com/paul8339/p/9644821.html