LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Set tap device in libvirt xml for virt-manager? (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/set-tap-device-in-libvirt-xml-for-virt-manager-842027/)

davelowndes 11-02-2010 10:01 PM

Set tap device in libvirt xml for virt-manager?
 
Hi,

I'm using wireless on my kvm host so have set up a tap device. I can launch my guest using this command:

sudo kvm /path/to/guest.img -net nic,macaddr=DE:AD:BE:EF:90:26 -net tap,ifname=tap0,script=no

This gives me everything I need network-wise with full access to 192.168.1.0/24.

How do I set these parameters in /etc/libvirt/qemu/guest.xml so it starts with these settings when using virt manager? I've tried:

Code:

<interface type='ethernet'>
  <target dev="tap0" />
</interface>

And various incarnations without luck. It seems virt-manager complains mostly about "tap0 is not a bridge device".

Thanks!

module0000 11-03-2010 11:38 AM

libvirt won't present a non-NAT or loopback interface unless it is bridged.

If you have the bridge-utils package installed, you would run:

Code:

brctl addbr br0
brctl addif br0 tap0

(br0 could be renamed if that name is undesirable of unavailable)

Once you run this, you will notice tap0 appears to be in a downed state, this is normal...all control over tap0 should be exercised over br0 instead. Now you can use br0 as the interface for your guest and libvirt shouldn't complain.

If you are using RHEL/CentOS/Fedora, this article is applicable..it shows the steps to create/use bridges in the distros config files so you don't have to manually do it.

link: Creating an RHEL 5 KVM Networked Bridge Interface

davelowndes 11-04-2010 03:20 AM

Hi. Thanks, this lets the guest (ubuntu) see the bridge/interface but I can't connect to the network.

Quote:

Once you run this, you will notice tap0 appears to be in a downed state
It looked to me like tap0 was still up.

I'm way out of my depth but I get the feeling that any attempt at bridging on wireless won't work and if libvirt requires a bridge I'm outta luck. I'll just have to launch my guests via the command line.


All times are GMT -5. The time now is 10:12 AM.