20 lines
339 B
Bash
Executable File
20 lines
339 B
Bash
Executable File
#!/bin/sh
|
|
|
|
nic=$1
|
|
|
|
if [ -f /etc/default/qemu-kvm ]; then
|
|
. /etc/default/qemu-kvm
|
|
fi
|
|
|
|
if [ -z "$TAPBR" ]; then
|
|
switch=$(ip route list | awk '/^default / { print $5 }')
|
|
if [ ! -d "/sys/class/net/${switch}/bridge" ]; then
|
|
switch=virbr0
|
|
fi
|
|
else
|
|
switch=$TAPBR
|
|
fi
|
|
|
|
ifconfig $nic 0.0.0.0 up
|
|
brctl addif ${switch} $nic
|