root / kvm-ifdown @ 58645c13
History | View | Annotate | Download (1.3 kB)
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 |
GANETI_INSTANCE_NAME=$INSTANCE |
10 |
|
11 |
if [ "x$INTERFACE" = "x" ]; then |
12 |
$SNF_NETWORK_LOG $0 "INTERFACE not set. Aborting" |
13 |
else |
14 |
$SNF_NETWORK_LOG $0 "Unconfiguring interface $INTERFACE of $GANETI_INSTANCE_NAME" |
15 |
fi |
16 |
|
17 |
FROM=FROM${INTERFACE^^} |
18 |
TO=TO${INTERFACE^^} |
19 |
|
20 |
ONLY_LOCAL=$2 |
21 |
|
22 |
if [ "$MODE" = "routed" ]; then |
23 |
TABLE=$LINK |
24 |
DROPDHCPREQCMD="iptables -A FORWARD -D $INTERFACE -p udp --dport 67 -j DROP" |
25 |
elif [ "$MODE" = "bridged" ]; then |
26 |
DROPDHCPREQCMD="runlocked $RUNLOCKED_OPTS ebtables -D $FROM -p ipv4 --ip-protocol udp --ip-destination-port 67 -j DROP" |
27 |
fi |
28 |
|
29 |
|
30 |
for tag in $NETWORK_TAGS; do |
31 |
case $tag in |
32 |
$IP_LESS_ROUTED_TAG) |
33 |
try clear_routed_setup_ipv4 |
34 |
try clear_routed_setup_ipv6 |
35 |
try clear_routed_setup_firewall |
36 |
;; |
37 |
$NFDHCPD_TAG) |
38 |
# Drop unicast BOOTP/DHCP packets |
39 |
$DROPDHCPREQCMD |
40 |
try clear_nfdhcpd |
41 |
;; |
42 |
$MAC_FILTERED_TAG) |
43 |
try clear_ebtables |
44 |
;; |
45 |
$DNS_TAG) |
46 |
if ! $ONLY_LOCAL; then |
47 |
get_rev4_info "$IP" |
48 |
get_eui64 "$MAC" "$SUBNET6" |
49 |
get_rev6_info "$EUI64" |
50 |
$SNF_NETWORK_LOG $0 "delete dns entry for $GANETI_INSTANCE_NAME $IP $EUI64" |
51 |
update_all delete |
52 |
fi |
53 |
;; |
54 |
esac |
55 |
done |
56 |
|
57 |
exit 0 |