Statistics
| Branch: | Tag: | Revision:

root / snf-deploy / scripts / ifup @ 38cfb0c3

History | View | Annotate | Download (477 Bytes)

1 0ac84a9a Dimitris Aragiorgis
#! /bin/bash
2 0ac84a9a Dimitris Aragiorgis
# Script to bring a network (tap) device for qemu-kvm up
3 0ac84a9a Dimitris Aragiorgis
# The idea is to add the tap device to the same bridge
4 0ac84a9a Dimitris Aragiorgis
# as we have default routing to.
5 0ac84a9a Dimitris Aragiorgis
6 0ac84a9a Dimitris Aragiorgis
# in order to be able to find brctl
7 0ac84a9a Dimitris Aragiorgis
PATH=$PATH:/sbin:/usr/sbin
8 0ac84a9a Dimitris Aragiorgis
9 0ac84a9a Dimitris Aragiorgis
: ${BRIDGE:=auto_nodes_br}
10 0ac84a9a Dimitris Aragiorgis
11 0ac84a9a Dimitris Aragiorgis
ip=$(which ip)
12 0ac84a9a Dimitris Aragiorgis
13 0ac84a9a Dimitris Aragiorgis
brctl=$(which brctl)
14 0ac84a9a Dimitris Aragiorgis
15 0ac84a9a Dimitris Aragiorgis
if [ ! "$ip" -o ! "$brctl" ]; then
16 0ac84a9a Dimitris Aragiorgis
   echo "W: $0: not doing any bridge processing: ip or brctl utility not found" >&2
17 0ac84a9a Dimitris Aragiorgis
   exit 0
18 0ac84a9a Dimitris Aragiorgis
fi
19 0ac84a9a Dimitris Aragiorgis
20 0ac84a9a Dimitris Aragiorgis
$ip link set "$1" up
21 0ac84a9a Dimitris Aragiorgis
22 0ac84a9a Dimitris Aragiorgis
brctl addif $BRIDGE "$1"
23 0ac84a9a Dimitris Aragiorgis
24 0ac84a9a Dimitris Aragiorgis
exit 0