keepalived+lvs子网掩码造成VIP切换故障

keepalived+lvs子网掩码造成VIP切换故障
架构:keepalived+lvs ,前端调度器是双主模型
现象:keepalived手动停掉一台,但是虚拟IP不会切换

整体网络是24位
VIP:172.18.3.200
keepalived的路由
[root@Sserver3-53 clouder]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.18.3.1      0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
172.18.0.0      0.0.0.0         255.255.0.0     U     0      0        0 eth0
172.18.3.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0

PS:不fail over 原因就是这条16位的路由作怪
: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.18.3.1      0.0.0.0         UG    0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
172.18.3.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0

eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 forever


15.2    keepalived在centos7.2中的bug
keepalived 在centos7.2 使用 /bin/systemctl restart keepalived.service 配置文件没有生效
需要使用reload参数来重新生效

 

上一篇:双vip的MySQL高可用集群


下一篇:CDH平台搭建遇到的问题