User:Axper/sandbox/qemu network

From ArchWiki


Note: The -net family of options is deprecated and replaced by -netdev family of options in newer QEMU versions. You may still encounter -net in older documentation.

User mode

Note: The ping command will not work in user mode networking from inside guest machines. TCP or UDP utilities will have to be used instead to test network connectivity, for example:
$ wget

QEMU will enable user mode networking by default if no -net or -netdev arguments are passed. These 3 lines are equivalent:

$ qemu-system-i386 ...
$ qemu-system-i386 -net user -net nic ...
$ qemu-system-i386 -netdev user,id=network0 -device e1000,netdev=network0 ...

With user mode networking:

  • Internal DHCP and DNS servers will start. The DHCP server can allocate IP addresses when guests run their DHCP clients.
  • Guests will have access to the Internet.
  • No root privileges are needed.
  • If the smb= option is specified, a Samba file server will start for sharing host's files to Windows guests.
  • If the tftp= option is specified, a TFTP server will start.

The default characteristics of user mode networking are:

Service IP address
Host's address
DHCP server
DNS server
TFTP server (if specified)
SMB server (if specified)
Addresses allocated by DHCP and above
Note: The DHCP, DNS and SMB servers will be visible only to QEMU guests and will not be visible from anywhere else, including the host.

There is no "real" connection between the guest and the rest of the world. Instead QEMU will pass intercepted TCP and UDP packets to guests. QEMU will also act as a firewall and will block all incoming connections. Because of this:

  • Guests will not be able to receive external requests. This means guests are not directly accessible from the host, from other guests and from the external network. To work around this, the -redir option can be used.
  • Only TCP and UDP protocols are supported, so other protocols like ICMP (including the ping command) will not work.
  • User mode networking is slower than the other options, since there is a lot of overhead.


Tap bridge



Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: redir, tftp, smb (Discuss in User talk:Axper/sandbox/qemu network)