Networking and GNOME Boxes

By | November 26, 2013

Note: This article applies to GNOME 3.10 in Fedora 20. You no longer need these steps in GNOME 3.14 in Fedora 21.

I’m setting up an Alfresco server and I need to test some of the tweaks and configuration I’m working with. Alfresco is big; lots of components including Java, an application server, usually a front end server, a database, etc., etc.  In addition, it is certified to work with a narrow set of other software. For example, Alfresco certifies against Red Hat Enterprise Linux 6, but my development machine is Fedora 19. Red Hat Enterprise Linux 6 comes with MySQL, but Alfresco certifies against a much more recent version.

This is the perfect use-case for an Virtual Machine.

So I started virt-manager to get started. I configured a VM, but … failed. It seems that virt-manager wants to place the image for the virtual machine under /var/lib/libvirt/images. However the /var tree on my laptop is fairly small. I don’t have the space to install a whole other OS there. My home directory, on the other hand, has plenty of space.

This is a perfect use-case for GNOME Boxes.

And, in fact, GNOME Boxes is awesome. Setting up the VM and making it run was easy, quick, and pleasent.  Until it wasn’t.

You see, GNOME Boxes uses isolated networking. The Virtual Machine can connect to external hosts, but nothing can connect into it. After 2 days of struggling, here is how to fix it on Fedora 19:

  • Shut down the virtual machine.
  • Get the name or id of your virtual machine. Run, from the command to get the name:
$ virsh -c qemu:///session list --all
  • Edit your VM’s configuration file using virsh as below: (My VM is named rhel6.4, so that’s what I used. You may need to use the ID of the VM, if available.)
$ virsh edit rhel6.4
  • Find the lines that look like this:
<interface type='user'>
 <mac address='52:54:00:bf:c5:97'/>
 <model type='rtl8139'/>
 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
  • Remove those lines and replace them with: (If you are not using Fedora, it’s possible that your network device is not named “virbr0“. You can get a list of all the interface names using ifconfig.)
<interface type='bridge'>
 <mac address='00:16:3e:1a:b3:4a'/>
 <source bridge='virbr0'/>
 <model type='virtio'/>
 <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
  • Start the VM, and you should be all set!

Easy, right?

Well, maybe you’re still having problems? Some troubleshooting tips:

  • You may not have bridging set up. Check /etc/qemu/bridge.conf to see that it contains the line:
allow virbr0
  • If you want to run or configure your Boxes VM in virt-manager, you need to connect to the user session, which isn’t possible via the user interface yet. Run:
$ virt-manager -c qemu+unix:///session

If this isn’t working for you, you can request assistance on IRC at: #boxes on GimpNet. If you do not have an IRC client, you can use this web page.

Will this get easier in the future? Absolutely. You can read the discussion and follow the progress on GNOME Bugzilla.

Edits on Nov 27, 2013: Virt Manager and Boxes do NOT need to be shut down while editing the VM details. There is a virsh command to get a list of VM names. Your network interface may not match mine if you are not running Fedora. Add link to the #boxes channel on IRC. Add in troubleshooting section for users without bridged networking configured. You do NOT need to run the VM using virt-manager after this configuration change, Boxes will handle it fine. Add in the Bugzilla link. Thanks to teuf, zeenix, and elad on IRC for the corrections.

Edit on Jan 22, 2015: Fixes and improvements to Boxes for GNOME 3.14 make this article out of date — the changes mentioned here are now the default Boxes configuration.

3 thoughts on “Networking and GNOME Boxes

  1. Gennadiy

    Hi Ben! I’m using Boxes. The host machine OS is Fedora 21; The guest OS is CentOS 7. After change VM’s configuration file, I get message ‘Failed to start’ CentOS 7. If you have any idea to correct this misstake, please help me.

  2. admin Post author

    Hi Gennadiy,
    Hmmm… I’ll check it out. I had thought that networking was fixed for Gnome Boxes in time for Fedora 21. But I just replicated what you did — installing Centos 7 inside Fedora 21, and I see that the host can connect to the VM, but nothing else.

  3. admin Post author

    Hi Gennadiy,

    This is “as-designed” right now. You should not need to make these modifications on Fedora 21; they are now the default. At the end, you get an IP address that can be accessed by the host. You can set up forwarding routes on the host if you want.

    Creating a VM in Boxes with an externally routable IP address is a different thing. Maybe I’ll post about how to do that soon. In the meantime, I’ll edit this post to mention that you no longer need to make any changes on Fedora 21.

Leave a Reply

Your email address will not be published. Required fields are marked *