1
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 10.0.2.15. The default router will be 10.0.2.2 and the DNS server will be 10.0.2.3. This networking is the only option for unprivileged users who need their VMs to have outgoing access.
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 – 2013-01-29T15:56:03.810
@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 – 2013-01-29T16:12:59.300
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 – 2013-01-29T16:26:46.677