All of lore.kernel.org
 help / color / mirror / Atom feed
* Setting up network for KVM guests
@ 2011-05-26 21:40 c.monty
  2011-05-26 22:04 ` David Mair
  0 siblings, 1 reply; 2+ messages in thread
From: c.monty @ 2011-05-26 21:40 UTC (permalink / raw)
  To: kvm

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Setting up network for KVM guests
  2011-05-26 21:40 Setting up network for KVM guests c.monty
@ 2011-05-26 22:04 ` David Mair
  0 siblings, 0 replies; 2+ messages in thread
From: David Mair @ 2011-05-26 22:04 UTC (permalink / raw)
  To: kvm; +Cc: c.monty

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-26 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 21:40 Setting up network for KVM guests c.monty
2011-05-26 22:04 ` David Mair

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.