Documentation/Networking: Difference between revisions

From QEMU
(added big hint for alternate, probably more exhaustive descriptions)
Line 29: Line 29:
=== VDE ===
=== VDE ===


The [[Documentation/Networking/VDE|VDE]] networking backend uses the [http://vde.sourceforge.net Virtual Distribute Ethernet] infrastructure to network guests.  Unless you specifically know that you want to use VDE, it is probably not the best backend to use.
The [[Documentation/Networking/VDE|VDE]] networking backend uses the [http://vde.sourceforge.net Virtual Distributed Ethernet] infrastructure to network guests.  Unless you specifically know that you want to use VDE, it is probably not the best backend to use.


=== Socket ===
=== Socket ===

Revision as of 00:46, 24 April 2011

Setting up networking in QEMU requires configuring a networking backend and choosing a virtual network card to emulate. This section deals with configuring a networking backend. In most cases, if you don't have any specific networking requirements other than to be able to access to a web page from your guest, slirp is a good choice. However, if you are looking to run any kind of network service or have your guest participate in a network in any meaningful way, tap is usually the best choice.

First - As this page is probably very brief or even incomplete you might find these pages rather useful:

  • QEMU Networking on wikibooks.org, mainly dealing with Linux hosts
  • QEMU Networking on bsdwiki, showing used networking principles and dealing with BSD hosts

Creating a network backend

There are two ways to create a network backend. The -netdev syntax (introduced in QEMU 0.12.0) is the preferred way to create a network backend. The -net syntax also creates a network backend in additional to a QEMU VLAN.

QEMU VLANs

A QEMU VLAN is an emulated hub that forwards traffic from any device connected to it to every other device on the VLAN. It is not an 802.1q VLAN. You create VLANs with the -net syntax. If you do not specify a vlan id, vlan 0 is assumed. When creating multiple network devices using the -net syntax, you generally want to specify different vlan ids. The exception is when dealing with the socket backend.

Choosing which networking backend to use

Slirp (user networking)

The slirp networking backend implements a full TCP/IP stack within QEMU and uses that stack to implement a virtual NAT'd networked. This is the default networking backend and generally is the easiest to use. It has the following limitations:

  • there is a lot of overhead so the performance is poor
  • ICMP traffic does not work (you cannot use ping within a guest)
  • the guest is not directly accessible from the host or the external network

Tap

The tap networking backend makes use of a tap networking device in the host. It offers very good performance and can be configured to create virtually any type of network topology. Unfortunately, it requires configuration of that network topology in the host which tends to be different depending on the operating system you are using. Generally speaking, it also requires that you invoke QEMU as root.

VDE

The VDE networking backend uses the Virtual Distributed Ethernet infrastructure to network guests. Unless you specifically know that you want to use VDE, it is probably not the best backend to use.

Socket

The socket networking backend, together with QEMU VLANs, allow you to create a network of guests that can see each other. It's primarily useful in extending the network created by Documentation/Networking/Slirp to multiple virtual machines. In general, if you want to have multiple guests communicate, tap is a better choice unless you do not have root access to the host environment.

How do I...