QEMU/Network

QEMU supports multiple virtual network backends for connecting guest virtual machines to either a LAN switch or the Internet.

Netdevs

Netdevs can be added with the syntax -netdev [type],id=[id],.... You must provide a unique object ID.

Netdev types
Type Description Options
user User networking, using a heavily modified SLiRP to proxy IP traffic to and from the guest. Requires no special permissions. N/A (TODO)
tap TAP networking.
This uses a Linux TAP device, and allows either local or full connectivity with the internet,
depending on what the bridge or network device it is connected to has.
Requires that the user QEMU is running as has permission to open the TAP device.
ifname - TAP interface name. (required)
script - Script to run if the tap requires elevated permissions to bring up. Set to literal no to disable.
downscript - Script to run if the tap requires elevated permissions to bring down. Set to literal no to disable.
vhost - Boolean option (default off) to enable vhost dataplane acceleration if attached to a Virtio adapter.
bridge Bridge networking.
This uses qemu-bridge-helper (or another helper program you provide) to create a TAP linked to the bridge, and deletes it when the VM stops.
Only requires permissions if qemu-bridge-helper is not setuid.
br - The bridge to use. (required)
helper - Path to an alternate helper (if not using qemu-bridge-helper).
l2tpv3 L2TPv3 passthrough network.
Encapsulates all the Ethernet frames created by the guest onto the host network using the L2TPv3 protocol.
TODO
vde VDE2 networking.
Allows connecting a QEMU VM to a VDE2 switch, which allows for a easier time dealing with network topologies. Additionally, if your QEMU is built against libvdeplug4, this allows alternate approaches to e.g VLAN trunking (which can be done by simply combining the VLAN plugin together with a switch attachment, or even its TAP plugin can be used.)
sock - Path to VDE switch socket. (required)
If built against vdeplug4, this can also be a VRL to use plugins.
port - Switch port to manually assign. If not specified, the switch will assign one. Only applicable for connecting to actual switches.