[root@node2 ~]# yum install keepalived -y
[root@node1 ~]# yum install tcpdump
[root@node1 ~]# tcpdump -n -i ens33 'host 224.0.0.18'
[root@node1 ~]# ip add li
[root@node1 ~]# systemctl start haproxy

[root@node1 keepalived]# tail -2000 /etc/keepalived/keepalived.conf
! Configuration File for keepalived

global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id haproxy_ha
vrrp_skip_check_adv_addr
#vrrp_strict
vrrp_garp_interval 0
vrrp_gna_interval 0
}

vrrp_instance HAPROXY_HA {
state MASTER
interface ens33
virtual_router_id 51
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass 123456
}
virtual_ipaddress {
192.168.1.21
192.168.1.22
192.168.1.23
192.168.1.24
192.168.1.25
192.168.1.26
}
}
[root@node1 keepalived]#

[root@node2 keepalived]# tail -2000 /etc/keepalived/keepalived.conf
! Configuration File for keepalived

global_defs {
notification_email {
[email protected]
}
notification_email_from [email protected]
smtp_server 127.0.0.1
smtp_connect_timeout 30
router_id haproxy_ha
vrrp_skip_check_adv_addr
#vrrp_strict
vrrp_garp_interval 0
vrrp_gna_interval 0
}

vrrp_instance HAPROXY_HA {
state BACKUP
interface ens33
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 123456
}
virtual_ipaddress {
192.168.1.21
192.168.1.22
192.168.1.23
192.168.1.24
192.168.1.25
192.168.1.26
}
}
[root@node2 keepalived]#