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