KVM - The Linux Kernel-Based Virtual Machine
News, Blogs and Resources on the Linux (KVM) Kernel-Based Virtual Machine

Simple Bridged Networking with Virt-Manager using macvtap

If you've been using kvm for any length of time , you'll know that network configuration is not a trivial process. GUI management tools have made this task somewhat easier but it was never as simple as tools by the leading hypervisor vendors. Although there are many options for KVM gui management tools available, I consider virt-manager to be an important one because it comes builtin to many distros and will be the entry point for many linux users wanting to try virtualization. When it comes to bridged network configuration in particular,  virt-manager has made many strides in simplifying configuration.  After the most recent patches however, you'll find that bridged network configuration in virt-manager is finally as simple as selecting a dropdown menu.  No more having to configure bridges, mapping interfaces to bridges and so on.  In the following sections, I'll walk through the latest virt-manager interface ( which should be released soon ) for configuring bridged networking.

 

macvtap

macvtap is a relatively recent device driver which was designed to share a physical network interface while using it's own mac address separate from the physical interface it is sharing.  One of the primary goals of this driver is actually to ease virtualized bridged network configuration. Virt-manager really needed a driver like this in order to simplify this configuration process.

 

Bridged networking using macvtap with virt-manager

With the latest patches to virt-manager, you simply select the source interface from a dropdown menu to configure bridged networking as shown in the snapshot below.

macvtap can run in three modes; vepa, bridge and private mode.  You need to select bridge mode for bridged networking.

Once this is selected, apply your settings and you're finished.

You can expect to see this feature in the next release/revision of virt-manager.  Bridged networking is a very common configuration with virtual machines on both the desktop and in the enterprise.  Thanks to the macvtap driver for finally making this a painless configuration for qemu KVM virtual machines.

 

See Also

Comments

That's great news! I always

That's great news! I always use bridged mode my self.

What does virbr0 and vnet0 be used?

I suppose macvtap is a kernel driver. What kernel version will it likely be merged to?

Cool

Good news.

Seems to simplify network configuration and to permit KVM access to everyone, even to Drand'Mother ;-P

macvtap is already provided

macvtap is already provided in last F15 kernel (actually 2.6.38.8-32.fc15).

VLAN tagging

This driver is indeed a great advancement, but there's really one thing that is really cool with interfaces of other vendors : vlan tagging.

On vmware this is made possible by creating a virtual switch and (optionnaly) putting a vlan ID on it;

On a fedora/rhel it requires to create a new interface em1.[vlanID] ... and then using it to bridge the vmnetXXX.

Further to that, the possibility to aggregate multiple physical links onto a virtual switch is also tremendously easy.

I completely agree that virt-manager being the entry point for the virtualization and being better and better at managing a lot of things, development should be put towards this tool.

By anyway, it is a real pleasure to work with the combination of all these tools.

Bruno

I don't see that option on FC15 nor RH6.1

Do I have to compile from sources?

If I use the settings directly from libvirt, I cant get macvtap to work, It creates the macvtap0 and it shows up on messages, but is not able to allocate an IP nor sees any traffic with tcpdump... any ideas?

Carlos

Re: don't see that option

In order for this to work, libvirt needs to be updated to the latest version on FC15 so yes, you do need to compile from sources. I have actually tried and haven't been able to get the latest libvirt to build on FC15. The example I used ran on FC14.  

very good

Very good news! I use bridged mode my self.

@louise

 Louise,

virbr0 and vnet0 are setup by libvirt by default. 

macvlan/macvtap kernel module was introduced around linux kernel version 2.6.34 or a little later. Haven't been able to pin this down. 

You can find out if your kernel has support by running the following command.

grep MACVLAN /boot/config-`uname -r`

 

 

Does this work on F16?

Hi,
I've been trying to set this up on F16 for a Debian guest and have not been successful. I am trying to bridge this with the macvtap driver and my wireless lan card. No matter what I select for the macvtap device or what mode I can't seem to get it to work. Do you have any tips to get this to work?

Have you had any luck finding

Have you had any luck finding a solution. I've been beating my head against the wall for a few days now. Same deal...Deb guest running on RHEL with macvtap...doesn't work.

macvtap and birdge?

Hello, i currently use a br0 interface for all VM.
So the birdge includes eth0, eth1 and the vmnet interfaces.

It is possible to use macvtap on a bridge?

Or are there any other options?

(I need the second eth interface to connect a printer to the network, i wouldn't use a second or bigger switch there)

Does not working

I just discovered this new feature and I was really happy because bridged networking in KVM is really a pain. VBox and VMware are really more simple.
But it does not works, I'm using Fedora 17.
Source device : Host device wlan0 : macvtap
Device model : virtio
Source mode : Bridge (tried Default too)
The guest is CentOS 6.2, I can see an eth3 device, but I can't get an IP from dhcp server. If a specify an IP manually I can't ping anything arround.
vhost_net is loaded. Is there something else to do ?

Post new comment

The content of this field is kept private and will not be shown publicly.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.