# Keepalived
# 安装
dnf install -y keepalived
systemctl enable keepalived
systemctl start keepalived
# 配置
! /etc/keepalived/keepalived.conf
! Configuration File for keepalived
vrrp_instance VI_1 {
state BACKUP
interface bond0
virtual_router_id 2
priority 100
advert_int 1
nopreempt
authentication {
auth_type PASS
auth_pass 1234
}
virtual_ipaddress {
100.127.255.2
}
}
# 防火墙
firewall-cmd --add-rich-rule='rule protocol value="vrrp" accept' --permanent
firewall-cmd --reload
# 查看防火墙规则
firewall-cmd --list-all
# 启动
systemctl enable keepalived
systemctl start keepalived
# 验证
ip addr show bond0
# 日志
journalctl -u keepalived
# 关闭
systemctl stop keepalived
systemctl disable keepalived