Setting up network for KVM guests
Hello!
I have installed KVM/QEMU on my LMDE (Linux Mint Debian Edition) system.
On this webpage I found some instructions howto setup the network:
http://www.linux-kvm.org/page/Networking
My first question is:
For a public bridge, should I configure /etc/network/interfaces in order to create the bridge static. Or should I use a script to create a bridge dynamically when the virtual machine starts.
Second question:
I made some tests with this script that is shown in section public bridge -> Solution 2: manual:
#!/bin/sh
set -x
switch=br0
if [ -n "$1" ];then
/usr/bin/sudo /usr/sbin/tunctl -u whoami -t $1 /usr/bin/sudo /sbin/ip link set $1 up sleep 0.5s
/usr/bin/sudo /usr/sbin/brctl addif $switch $1 exit 0
else
echo "Error: no interface specified" exit 1
fi
When I debug this script I can see that it always ends up in "Error: no interface specified":
bash -x /usr/local/bin/networkbridge_setup.sh
+ set -x
+ switch=br0
+ '[' -n '' ']'
+ echo 'Error: no interface specified'
Error: no interface specified
+ exit 1
Why is that?
THX
Quoted 9 lines · On 05/26/2011 03:40 PM, [email protected] wrote:
Hello!
I have installed KVM/QEMU on my LMDE (Linux Mint Debian Edition) system.On this webpage I found some instructions howto setup the network:
http://www.linux-kvm.org/page/NetworkingMy first question is:
For a public bridge, should I configure/etc/network/interfacesin order to create the bridge static. Or should I use a script to create a bridge dynamically when the virtual machine starts.
I doubt there's a correct answer. I create the bridges I use statically at boot time and create bridge taps on demand when I launch VMs (probably because I always found the VMWare bridges appealing). If you want to have physical network access for VMs or a stable routing environment for them at launch or host services like dhcpd/pxe/etc to support them then I recommend static bridges that you consider part of the host environment.
Quoted 30 lines
Second question:
I made some tests with this script that is shown in section public bridge -> Solution 2: manual:#!/bin/sh
set -xswitch=br0
if [ -n "$1" ];then
/usr/bin/sudo/usr/sbin/tunctl-uwhoami-t $1/usr/bin/sudo/sbin/iplink set $1 up sleep 0.5s
/usr/bin/sudo/usr/sbin/brctladdif $switch $1 exit 0
else
echo "Error: no interface specified" exit 1
fiWhen I debug this script I can see that it always ends up in "Error: no interface specified":
bash -x/usr/local/bin/networkbridge_setup.sh
+ set -x
+ switch=br0
+ '[' -n '' ']'
+ echo 'Error: no interface specified'
Error: no interface specified
+ exit 1
Quoted 1 line
Why is that?
It looks like $1 must be empty because the script was run with no command line arguments/parameters.
Signature · 1 line
David.