keepalived在没有iptables的情况下运行良好

时间:2012-10-16 06:25:55

标签: iptables

我设置了keepalived,只有当我停止iptables服务时才能正常工作。我的iptables配置如下,请告诉我应该为keepalived添加哪些规则

# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22   -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80   -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5666 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6379 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT

3 个答案:

答案 0 :(得分:3)

这几天正好解决这个问题,哈哈

执行:

iptables -I INPUT -d 224.0.0.0/8 -j ACCEPT
iptables -I INPUT -p vrrp -j ACCEPT

答案 1 :(得分:1)

您必须接受ip protocol 112(vrrp)和组播流量到224.0.0.18。如果您使用的是auth_type AH,则必须接受proto 51

iptables -I INPUT -p 112 -d 224.0.0.18 -j ACCEPT
iptables -I INPUT -p 51  -d 224.0.0.18 -j ACCEPT 

答案 2 :(得分:0)

到MASTER keepalived机器:

iptables -I OUTPUT -p vrrp -s 192.168.10.1 -d 224.0.0.0/24 -j ACCEPT

到BACKUP keepalived机器:

iptables -I INPUT -p vrrp -s 192.168.10.1  -d 224.0.0.0/24 -j ACCEPT

192.168.10.1是主要的keepalived ip