Centos7-keepalived配置 firewalld 防火墙:
现象:
主备节点同时绑定VIP无法切换。
查看 firewalld 状态:
查看 firewalld 状态
systemctl status firewalld
启动 firewalld
systemctl start firewalld
关闭 firewalld
systemctl stop firewalld
配置方法:
配置前需要启动 firewall 服务
systemctl start firewalld
使用 firewall 配置
firewall-cmd --add-rich-rule='rule protocol value="vrrp" accept' --permanent
firewall-cmd --reload
使用 iptables 配置
iptables -I INPUT -p vrrp -j ACCEPT
iptables-save > /etc/sysconfig/iptables
systemctl restart iptables
参考文档
Firewall Requirements
If you are running a firewall (by means of firewalld or iptables), you must allow VRRP traffic to pass between the keepalived nodes. To configure the firewall to allow the VRRP traffic with firewalld, run the following commands:
# firewall-cmd --add-rich-rule='rule protocol value="vrrp" accept' --permanent
# firewall-cmd --reload
If the zone is omitted the default zone will be used.
If, however, you need to allow the VRRP traffic with iptables, run the following commands:
# iptables -I INPUT -p vrrp -j ACCEPT
# iptables-save > /etc/sysconfig/iptables
# systemctl restart iptables