#!/bin/bash # This is an example of a Ganeti kvm ifup script that configures network # interfaces based on the initial deployment of the Okeanos project source /etc/default/snf-network source /usr/lib/snf-network/common.sh FROM=FROM${INTERFACE^^} TO=TO${INTERFACE^^} try clear_routed_setup_ipv4 try clear_routed_setup_ipv6 try clear_routed_setup_firewall try clear_ebtables try clear_nfdhcpd if [ "$MODE" = "routed" ]; then TABLE=$LINK ip link set $INTERFACE addr $TAP_CONSTANT_MAC up INDEV=$INTERFACE DROPDHCPREQCMD="iptables -A FORWARD -i $INTERFACE -p udp --dport 67 -j DROP" elif [ "$MODE" = "bridged" ]; then ip link set $INTERFACE up brctl addif $BRIDGE $INTERFACE INDEV=$BRIDGE try init_ebtables DROPDHCPREQCMD="runlocked $RUNLOCKED_OPTS ebtables -A $FROM -p ipv4 --ip-protocol udp --ip-destination-port 67 -j DROP" fi for tag in $NETWORK_TAGS; do case $tag in $IP_LESS_ROUTED_TAG) try routed_setup_ipv4 try routed_setup_ipv6 try routed_setup_firewall ;; $NFDHCPD_TAG) # Drop unicast BOOTP/DHCP packets $DROPDHCPREQCMD try setup_nfdhcpd ;; $MAC_FILTERED_TAG) try setup_ebtables ;; $MASQ_TAG) try setup_masq ;; esac done if [ -x "$IFUP_EXTRA_SCRIPT" ]; then exec $IFUP_EXTRA_SCRIPT "$@" fi exit 0