Qemu Network Options: tap vs bridge

7k views Asked by At

I just started learning how to use Qemu for a project. I was trying to run Qemu using using bridge networking and was wondering what is the difference between the network options, tap and bridge.

I read the network options part in the Qemu document but is unable to understand the difference. The document mention that "-netdev tap" is use to configure a host TAP network backend with ID id while "-netdev bridge" is use to connect a host TAP network interface to a host bridge device. I also look at this website: https://wiki.archlinux.org/title/QEMU#Tap_networking_with_QEMU, but was still unable to understand the difference between using "-netdev tap" vs "-netdev bridge".

Can anyone help me by explaining the differences between using "-netdev tap" and "-netdev bridge" for Qemu?

Thank you.

2

There are 2 answers

0
schweik On

I am solving the same problem, and until now I did not find much diferences. Formerly I expected that bridge uses shorten TUN way (OSI level 3 - IP), but after I've succesfully configured two VM to be connected with -netdev bridge I found that qemu helper added two TAP dummy interfaces in host system and connected them to an existing bridge interface. After I 'poweroff' both VM, the qemu helper disconnected and deleted the TAP interfaces automaticaly.

Fo me this means that bridge saves my config time, but the result is the same as by use the tap . I can admit, the TAP configuration needs much attention, time and commands, hence I see -netdev bridge as more comfortable way. The TAP may offer more featueres, but I cannot appreciate them now.

There left a question about the capacity of the host kernel bridge. I did not find any limit for connected interfaces to a single br0 device (just feeling the bridge connects two watersides only, but who knows). I just read that more features gives the Open Virtual Switch, but I am not sure if I really need it.

0
stsquad On

They both provide different command line interfaces to use TAP as the network backend for the guest to connect to a host bridge. The TAP netdev allows for a finer degree of control of the TAP device that is used but in both cases the network path is the same. This is in contrast to user-mode networking which allows networking without privileged access to the host network stack albeit with some limitations on the sort of packets that can be sent.