I have an Ubuntu Server machine which is acting as a VM host for KVM guests made with vmbuilder. I want to expose the VM's to the network. Currently, the VM guest can get out to the network, and I can get in to the VM from the host, but I can not access the VM from the outside.
On the host, I have set up a bridge br0 which includes the physical interface. br0 has an ip 192.168.0.200, and with the guest VM running, the vnet0 is attached to it:
host:$ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.08606e6ea460 no p4p1
vnet0
virbr0 8000.000000000000 yes
On the guest, eth0 has the ip 192.168.0.107 from the DHCP server, andif I run nmap on the host to check what is open on the VM, I can see services:
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
I can run links on the host to open a web page hosted on the guest, but if I try and access it from another physical machine, I can't open the web page or connect over ssh.
On the guest, I can make it out to the internet:
vm:$ traceroute google.com
traceroute to google.com (74.125.239.8), 30 hops max, 60 byte packets
1 192.168.0.1 (192.168.0.1) 0.484 ms 0.565 ms 0.700 ms
2 cpe-76-168-136-1.socal.res.rr.com (76.168.136.1) 25.444 ms 25.495 ms 35.765 ms
...
The xml file for the network in /etc/libvirt/qemu/networks contains:
<network>
<name>physbridge</name>
<bridge name="br0" />
<forward mode="bridge" />
</network>
The xml for the guest vm contains:
<interface type='bridge'>
<mac address='52:54:00:c6:00:51'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</interface>
So, what does it take to be able to get to the web server in the VM from another machine on my network? It's nearly working, so I'm guessing there isn't that much left to do, but all the low hanging obvious stuff in the documentation is already in place, so I'm not sure what it is... The other questions I've found on the topic generally were for doing this sort of thing with VMWare or Virtualbox, which I have done before. But this is the first time I have tried to do this sort of thing with libvirt and kvm.