User:Axper/sandbox/qemu network

From ArchWiki
Jump to: navigation, search

Networking

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 google.com

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
Netmask 255.255.255.0
Host's address 10.0.2.2
DHCP server 10.0.2.2
DNS server 10.0.2.3
TFTP server (if specified) 10.0.2.2
SMB server (if specified) 10.0.2.4
Addresses allocated by DHCP 10.0.2.15 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

Tap bridge

VDE

Socket

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#)