Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
What do you mean by "Access"? If it has an IP, then it can be "accessed", so first try to ping it first, if it works correctly then it means that you might have problem with your firewall – Mostafa Shahverdy Feb 25 at 3:42
I meant "access" in the sense of being able to ssh into the guest, or access a web page served by the guest. In any event, this has all randomly started working. As far as I can tell, I haven't changed anything significant since I posted the question, but I did reboot both the host and guest VM's since yesterday. Presumably I had fixed it prior to posting, but had failed to restart some service or something to actually pick up the required changes. I can now fire up new guest VM's, and get to them from the outside without any problem. Weird. – wrosecrans Feb 25 at 20:40

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.