San*_*dra 2 linux firewall failover iptables ucarp
我有两台使用 ucarp 作为故障转移的服务器。在每台服务器上eth1:1都为 ucarp 的 keepalive 连接保留。
ucarp 使用目标 IP 作为多播地址224.0.0.18。
在 ucarp 主服务器上是eth1:1IP 192.168.245.2,在辅助服务器上是eth1:1IP 192.168.245.3。
题
我想在每台服务器上制定一个 iptables 规则,这样任何人都不会错误地使用这些 NIC。即放弃所有对 ucarp 的期望。
对于主服务器,这样的规则会是什么样子?
我假设这样的事情?
iptables -P INPUT -i eth1:1 -j DROP
iptables -A INPUT -i eth1:1 ? something with multicast ? -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
iptables -A INPUT -i eth1:1 -m pkttype --pkt-type multicast -j ACCEPT
Run Code Online (Sandbox Code Playgroud)
确保xt_pkttype模块已加载到正在运行的内核中:
--- Networking support
Networking options --->
[*] Network packet filtering framework (Netfilter) --->
Core Netfilter Configuration --->
<*> "pkttype" packet type match support
Run Code Online (Sandbox Code Playgroud)