e3ac855dfca23ee6b9883f51c854149fa6e00c26
[snf-network] / kvm-ifup-custom
1 #!/bin/bash
2
3 # This is an example of a Ganeti kvm ifup script that configures network
4 # interfaces based on the initial deployment of the Okeanos project
5
6 source /etc/default/snf-network
7 source /usr/lib/snf-network/common.sh
8
9 get_info
10
11 try clear_routed_setup_ipv4
12 try clear_routed_setup_ipv6
13 try clear_routed_setup_firewall
14 try clear_ebtables
15 try clear_nfdhcpd
16
17 if [ "$MODE" = "routed" ]; then
18   ip link set $INTERFACE addr $TAP_CONSTANT_MAC up
19 elif [ "$MODE" = "bridged" ]; then
20   ip link set $INTERFACE up
21   brctl addif $BRIDGE $INTERFACE
22 fi
23
24 for tag in $NETWORK_TAGS; do
25   case $tag in
26   $IP_LESS_ROUTED_TAG)
27     try routed_setup_ipv4
28     try routed_setup_ipv6
29     try routed_setup_firewall
30     try send_garp
31   ;;
32   $NFDHCPD_TAG)
33     try setup_nfdhcpd
34   ;;
35   $MAC_FILTERED_TAG)
36     try init_ebtables
37     try setup_ebtables
38   ;;
39   $MASQ_TAG)
40     try setup_masq
41   ;;
42   esac
43 done
44
45 if [ -x "$IFUP_EXTRA_SCRIPT" ]; then
46   exec $IFUP_EXTRA_SCRIPT "$@"
47 fi
48
49 exit 0