keepalived双网卡双网段热备配置
rehoni / 2022-06-30
参考
[keepalived双进程双VIP配置及原理图](keepalived双进程双VIP配置及原理图_花红羊蹄甲的博客-CSDN博客_keepalived 多进程)
简要实现
一般来说做两套配置即可,
master:
! Configuration File for keepalived
vrrp_script chk_haproxy {
script "</dev/tcp/127.0.0.1/80"
interval 2
weight -2
}
vrrp_instance VI_A {
state MASTER
interface eno6
track_interface {
eno6
}
virtual_router_id 81
priority 100
mcast_src_ip 10.228.96.230
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.228.96.232 label webvip
}
track_script {
chk_haproxy
}
}
vrrp_instance VI_B {
state MASTER
interface eno5
track_interface {
eno5
}
virtual_router_id 82
priority 100
mcast_src_ip 198.120.100.101
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
198.120.100.104 label webvip
}
track_script {
chk_haproxy
}
}
slave:
! Configuration File for keepalived
vrrp_script chk_haproxy {
script "</dev/tcp/127.0.0.1/80"
interval 2
weight -2
}
vrrp_instance VI_A {
state BACKUP
interface eno6
track_interface {
eno6
}
virtual_router_id 81
priority 90
mcast_src_ip 10.228.96.231
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.228.96.232 label webvip
}
track_script {
chk_haproxy
}
}
vrrp_instance VI_B {
state BACKUP
interface eno5
track_interface {
eno5
}
virtual_router_id 82
priority 90
mcast_src_ip 198.120.100.102
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
198.120.100.104 label webvip
}
track_script {
chk_haproxy
}
}