Skip to content

Commit f2c3b83

Browse files
authoredJul 31, 2020
Enable the ability to block multicast traffic for testing (#1061)
In order to properly test unicast VRRP with keepalived, it is desirable to block multicast on the provisioning host. This patch does so with ebtables. Additional config will be required in vm_setup_vars.yml to create external SRV records, since coredns-multicast will no longer be working.
1 parent 6f942fd commit f2c3b83

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed
 

‎02_configure_host.sh

+16
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,19 @@ OPENSTACKCLIENT_PATH="${OPENSTACKCLIENT_PATH:-/usr/local/bin/openstack}"
235235
if ! command -v openstack | grep -v "${OPENSTACKCLIENT_PATH}"; then
236236
sudo ln -sf "${METAL3_DEV_ENV_PATH}/openstackclient.sh" "${OPENSTACKCLIENT_PATH}"
237237
fi
238+
239+
# Block Multicast with ebtables
240+
if [ "$DISABLE_MULTICAST" == "true" ]; then
241+
for dst in 224.0.0.251 224.0.0.18; do
242+
sudo ebtables -A INPUT --pkttype-type multicast -p ip4 --ip-dst ${dst} -j DROP
243+
sudo ebtables -A FORWARD --pkttype-type multicast -p ip4 --ip-dst ${dst} -j DROP
244+
sudo ebtables -A OUTPUT --pkttype-type multicast -p ip4 --ip-dst ${dst} -j DROP
245+
done
246+
247+
for dst in ff02::fb ff02::12; do
248+
sudo ebtables -A INPUT --pkttype-type multicast -p ip6 --ip6-dst ${dst} -j DROP
249+
sudo ebtables -A FORWARD --pkttype-type multicast -p ip6 --ip6-dst ${dst} -j DROP
250+
sudo ebtables -A OUTPUT --pkttype-type multicast -p ip6 --ip6-dst ${dst} -j DROP
251+
done
252+
fi
253+

‎config_example.sh

+4
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ set -x
153153
# Enable FIPS mode
154154
#export FIPS_MODE=true
155155

156+
# In order to test using unicast for keepalived, one needs to disable multicast.
157+
# Setting this variable to true will block multicast via ebtables for both IPv4 and IPv6.
158+
#export DISABLE_MULTICAST=false
159+
156160
##
157161
## Multi-cluster/Hive variables
158162
##

‎host_cleanup.sh

+4
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,9 @@ if [ "$MANAGE_BR_BRIDGE" == "y" ]; then
6262
sudo ip link delete ${BAREMETAL_NETWORK_NAME} || true
6363
sudo rm -f /etc/sysconfig/network-scripts/ifcfg-${BAREMETAL_NETWORK_NAME}
6464
fi
65+
66+
# Drop all ebtables rules
67+
sudo ebtables --flush
68+
6569
# Kill any lingering proxy
6670
sudo pkill -f oc.*proxy

0 commit comments

Comments
 (0)
Please sign in to comment.