You are not logged in.

#1 2013-03-21 13:32:48

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

qemu tap networking method from wiki

The method described in the wiki for tap networking wouldn't work for me unless I ran run-qemu with sudo. I found another method using -net bridge rather than -net tap which seems simpler and more powerful and does not require root. I put an entry in the wiki describing how I did it.

I'm kind of suspicious since it seems to be superior to the other method, which seems to be prevalent all over the web. I'm hoping a few people would be willing to give it a test. It's also my first substantial wiki edit, so advice/criticism in that regard would be welcomed.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#2 2013-03-21 14:00:01

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: qemu tap networking method from wiki

It doesn't work here.

> qemu-system-x86_64 -m 512M -cdrom archlinux-2013.03.01-dual.iso -net nic -net bridge,br=virtnic 
failed to parse default acl file `/etc/qemu/bridge.conf'
failed to launch bridge helper
qemu-system-x86_64: -net bridge,br=virtnic: Device 'bridge' could not be initialized

It seems you may have some files from previous setups laying around in your hd. I also suspect this method will require root since adding a bridge might require modprobing some module.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#3 2013-03-21 15:51:49

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: qemu tap networking method from wiki

Oh, yeah. I forgot to mention that I had to deal with that file.

All you have to do is copy /etc/qemu/bridge.conf.sample to /etc/qemu/bridge.conf and populate it with the names of your bridges. I'll add that to the wiki soon.

Edit: And as to requiring root, as I said it does not [for me]. Existing bridges are used, just as in the other method.

Last edited by alphaniner (2013-03-21 16:33:14)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#4 2013-03-21 21:49:49

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: qemu tap networking method from wiki

alphaniner wrote:

Oh, yeah. I forgot to mention that I had to deal with that file.

All you have to do is copy /etc/qemu/bridge.conf.sample to /etc/qemu/bridge.conf and populate it with the names of your bridges. I'll add that to the wiki soon.

Edit: And as to requiring root, as I said it does not [for me]. Existing bridges are used, just as in the other method.

That explains it smile The setup part is what requires root, just like using the vde2 method (which I currently use). I'll probably give the bridge method a go when I have some free time and see how it compares with vde2.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#5 2013-03-22 13:10:54

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: qemu tap networking method from wiki

The setup part is what requires root, just like using the vde2 method (which I currently use).

OK, I thought you meant it would require root at runtime.

I didn't try vde2, so I don't know how it compares to that method. It seems entirely superior to the -net tap method, though.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#6 2013-03-22 13:36:40

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: qemu tap networking method from wiki

Using vde2 works pretty much like creating a bridge beforehand, you set it up before running any virtual machine (this requires root), then you run the virtual machines as a normal user.

The first difference I can see is that with vde2 you will need an extra program running (vde_switch), while with the bridge method the kernel handles it all. What I'm curious about is if there is any network speed difference between the 2 methods.

For my needs I'd say either method is ok, although I might change to the bridge method since it requires less things running (and I suspect it might have a speed/cpu usage advantage).


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#7 2013-03-22 13:56:27

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: qemu tap networking method from wiki

There may be a terminology issue here. Both -net tap and -net bridge require an existing bridge (I have two, configured by netcfg). When qemu is run with either method, tap devices are created. Ie. ip l sh will show one or more new tapX devices, which are removed when the VM is shut down.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#8 2013-03-22 22:27:08

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: qemu tap networking method from wiki

Maybe I didn't explain myself clearly, what I meant is that the setup of the bridges or the vde switch requires root, but using them can be done as a normal user, so in that regard they are similar.

On another note I was curious about performance, and as I suspected, using a bridge is faster. I did a few tests with iperf and I got something like this:

Using vde2 (-net nic,model=virtio -net vde):
- iperf running as server on the guest
-- unidirectional test: 301Mbit/s
-- bidirectional test : 136Mbit/s + 239MBit/s
- iperf running as server on the host
-- unidirectional test: 338Mbit/s
-- bidirectional test : 237Mbit/s + 135MBit/s

Using the bridge (-net nic,model=virtio -net bridge,br=virbr):
- iperf running as server on the guest
-- unidirectional test: 500Mbit/s
-- bidirectional test : 250Mbit/s + 248MBit/s
- iperf running as server on the host
-- unidirectional test: 544Mbit/s
-- bidirectional test : 251Mbit/s + 266MBit/s

Edit:
I'm now a happy user of the method you suggested smile

Last edited by R00KIE (2013-03-22 22:29:04)


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#9 2013-03-27 13:32:28

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: qemu tap networking method from wiki

It seems the misunderstanding was on my end. As my Geometry teacher used to say, "My mistake, your fault, I'll forgive you this time." tongue

Glad it works for you though. If you encounter any issues please post them here. I'm no guru (my "discovery" was a complete shot in the dark) but I'll do what I can to help. And at the very least, I need to make sure that wiki entry doesn't lead folks astray.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

Board footer

Powered by FluxBB