Add qemu ifup/ifdown scripts
This commit is contained in:
parent
c4f7ca2241
commit
ab4841031d
4 changed files with 73 additions and 0 deletions
27
scripts/qemu-custom-ifup
Executable file
27
scripts/qemu-custom-ifup
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
# This script adds an specified tap interface to first bridge
|
||||
# found with the name containing br0
|
||||
|
||||
if [[ $EUID != 0 ]]; then
|
||||
echo "This script needs sudo priveleges"
|
||||
echo "Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for INT in $(ls /sys/class/net); do
|
||||
if [[ $INT == *"br0"* && -d /sys/class/net/$INT/bridge/. ]]; then
|
||||
BRIDGE="$INT"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ -z $BRIDGE ]]; then
|
||||
echo 'No bridge INTerfaces seen'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/sbin/ip tuntap add dev $1 mode tap
|
||||
/sbin/ip link set $1 up
|
||||
|
||||
/sbin/ip link set dev $1 master $BRIDGE
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue