#!/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 DEFAULT=/etc/default/snf-network NFDHCPD_STATE_DIR=/var/lib/nfdhcpd source $DEFAULT source $CONF source $STATE_DIR/infra function clear_routed_setup_ipv4 { arptables -D OUTPUT -o $INTERFACE --opcode request -j mangle while ip rule del dev $INTERFACE; do :; done iptables -D FORWARD -i $INTERFACE -p udp --dport 67 -j DROP } function clear_routed_setup_ipv6 { while ip -6 rule del dev $INTERFACE; do :; done } function clear_routed_setup_firewall { for oldchain in protected unprotected limited; do iptables -D FORWARD -o $INTERFACE -j $oldchain ip6tables -D FORWARD -o $INTERFACE -j $oldchain done } function clear_ebtables { TAP=$INTERFACE FROM=FROM${TAP^^} TO=TO${TAP^^} ebtables -D INPUT -i $TAP -j $FROM ebtables -D FORWARD -i $TAP -j $FROM ebtables -D FORWARD -o $TAP -j $TO ebtables -D OUTPUT -o $TAP -j $TO ebtables -X $FROM ebtables -X $TO } if [ $# -ne 1 ]; then echo "Usage: $0 " exit 1 fi INTERFACE=$1 clear_routed_setup_ipv4 clear_routed_setup_ipv6 clear_routed_setup_firewall clear_ebtables rm $NFDHCPD_STATE_DIR/$INTERFACE