From: David Mair Subject: Re: Setting up network for KVM guests Date: Thu, 26 May 2011 16:04:06 -0600 Message-ID: <4DDECE56.3070607@mair-family.org> References: <374843856.1181206.1306446026196.JavaMail.fmail@mwmweb002> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: c.monty@web.de To: kvm@vger.kernel.org Return-path: Received: from mair-family.org ([160.7.248.25]:56725 "EHLO mail.mair-family.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756699Ab1EZWEJ (ORCPT ); Thu, 26 May 2011 18:04:09 -0400 In-Reply-To: <374843856.1181206.1306446026196.JavaMail.fmail@mwmweb002> Sender: kvm-owner@vger.kernel.org List-ID: On 05/26/2011 03:40 PM, c.monty@web.de 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/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. 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. > 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? It looks like $1 must be empty because the script was run with no command line arguments/parameters. -- David.