-netfamily of options is deprecated and replaced by
-netdevfamily of options in newer QEMU versions. You may still encounter
-netin older documentation.
pingcommand 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
-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:
|Host's address|| |
|DHCP server|| |
|DNS server|| |
|TFTP server (if specified)|| |
|SMB server (if specified)|| |
|Addresses allocated by DHCP|| |
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
-rediroption can be used.
- Only TCP and UDP protocols are supported, so other protocols like ICMP (including the
pingcommand) will not work.
- User mode networking is slower than the other options, since there is a lot of overhead.