QEMU/Network: Difference between revisions

From Computernewb Wiki
Jump to navigation Jump to search
m (g)
(perms)
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
<!-- TODO: document more -->
<!-- TODO: document more -->


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


{| class="wikitable sortable"
{| class="wikitable sortable"
Line 14: Line 14:
| <kbd>user</kbd> || User networking, using a heavily modified SLiRP to proxy IP traffic to and from the guest. Requires no special permissions. || N/A (TODO)
| <kbd>user</kbd> || User networking, using a heavily modified SLiRP to proxy IP traffic to and from the guest. Requires no special permissions. || N/A (TODO)
|-
|-
| <kbd>tap</kbd> || TAP networking.<br>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. || <kbd>ifname</kbd> - TAP interface name. (required)<br><kbd>script</kbd> - Script to run if the tap requires elevated permissions to bring up. Set to literal <kbd>no</kbd> to disable.<br><kbd>downscript</kbd> - Script to run if the tap requires elevated permissions to bring down. Set to literal <kbd>no</kbd> to disable.<br><kbd>vhost</kbd> - Boolean option (default off) to enable vhost dataplane acceleration if attached to a Virtio adapter.<br>
| <kbd>tap</kbd> || TAP networking.<br>This uses a Linux TAP device, and allows either local or full connectivity with the internet,<br>depending on what the bridge or network device it is connected to has.<br>Requires that the user QEMU is running as has permission to open the TAP device. || <kbd>ifname</kbd> - TAP interface name. (required)<br><kbd>script</kbd> - Script to run if the tap requires elevated permissions to bring up. Set to literal <kbd>no</kbd> to disable.<br><kbd>downscript</kbd> - Script to run if the tap requires elevated permissions to bring down. Set to literal <kbd>no</kbd> to disable.<br><kbd>vhost</kbd> - Boolean option (default off) to enable vhost dataplane acceleration if attached to a Virtio adapter.<br>
|-
|-
| <kbd>bridge</kbd> || Bridge networking.<br>This uses <kbd>qemu-bridge-helper</kbd> (or another helper program you provide) to create a TAP linked to the bridge, and deletes it when the VM stops. || <kbd>br</kbd> - The bridge to use. (required)<br><kbd>helper</kbd> - Path to an alternate helper (if not using qemu-bridge-helper).<br>
| <kbd>bridge</kbd> || Bridge networking.<br>This uses <kbd>qemu-bridge-helper</kbd> (or another helper program you provide) to create a TAP linked to the bridge, and deletes it when the VM stops.<br>Only requires permissions if <kbd>qemu-bridge-helper</kbd> is not setuid. || <kbd>br</kbd> - The bridge to use. (required)<br><kbd>helper</kbd> - Path to an alternate helper (if not using qemu-bridge-helper).<br>
|-
|-
| <kbd>l2tpv3</kbd> || L2TPv3 passthrough network.<br>Encapsulates all the Ethernet frames created by the guest onto the host network using the L2TPv3 protocol. || TODO
| <kbd>l2tpv3</kbd> || L2TPv3 passthrough network.<br>Encapsulates all the Ethernet frames created by the guest onto the host network using the L2TPv3 protocol. || TODO

Latest revision as of 08:52, 28 August 2024

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.