I've a laptop running Linux connected to a LAN using wifi. I've used virt-manager to create a KVM/QEMU VM and installed Ubuntu on that. As expected, it can connect to the Internet to download updates, etc.

I'd like to run Apache on the guest to do web development, and browse to the sites on it from the host machine. The guest will run several websites and I don't want to have to specify a port number when browsing, so I'd like the guest to have it's own IP address that's visible to the host so I can just modify the host's /etc/host file to point to the guest.

I don't care how the guest accesses the Internet. It will need to be able to, but only needs to be visible to the host, not any other computers. Therefore if the guest accesses the Internet via one virtual NIC and the host via another that's fine.

I've read that the fact that the host uses wifi is significant because I can't bridge to wlan0.

What's the simplest way to achieve this, bearing in mind I'm no networking/iptables guru?

Update: I forgot to mention, the guest machine was set-up as a non-root user, i.e. using qemu:///session. I don't know if that has any bearing, but it does seem to mean that I can't see the 'default' virtual network that libvirtd configures for qemu:///system VMs.

Update 2: I've just found information in the libvirt documentation which says that Userspace SLIRP is the only option available for unprivileged users. Does this mean that what I'd like to do isn't possible without starting the VM as root?

Userspace SLIRP stack

Provides a virtual LAN with NAT to the outside world. The virtual network has DHCP & DNS services and will give the guest VM addresses starting from The default router will be and the DNS server will be This networking is the only option for unprivileged users who need their VMs to have outgoing access.

migrated from serverfault.com Jan 29 '13 at 19:17

This question came from our site for system and network administrators.

  • Is the "non-bridgeable wlan0" a KVM thing? Because VirtualBox does that quite nicely. A bridged network adaptor would pick up an IP from your normal DHCP server and would be accessible to all machines on your local network. – tombull89 Jan 29 '13 at 15:56
  • @tombull89 As I understand it, most wifi adapters don't have the required hardware to support a network bridge. Perhaps the stuff I've been reading is out of date though... – Richard Turner Jan 29 '13 at 16:12
  • Odd, I've used VirtualBox in my dev enviroment on three different laptops and a desktop with a USB wireless adaptor and I've never had any issues. – tombull89 Jan 29 '13 at 16:26

After more reading on the libvirt site I've come to the conclusion that the qemu:///session driver isn't appropriate for this use case, and that's why I've struggled with networking while using it.

The documentation says "The intended use case for [the qemu:///session] driver is desktop virtualization, with virtual machines storing their disk images in the user's home directory and being managed from the local desktop login session." (my emphasis).

Having migrated my VM to use the qemu:///system driver instead I'm able to access the 'default' network bridge, so both the VM and the host have private IP addresses and can talk to one another. So the answer was simply to use qemu:///system instead of qemu:///session.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.