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.

10 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.

  4. thomas

    Funny thing:

    This definition seems to work correctl in the gnome-boxes user-session:

    as this one doesn’t not:

    because the “default” network is defined in the libvirt system session.
    the default network from the system session does actually do define the virbr0 bridge device used in above config.

    very strange and confusing.

  5. thomas

    hurra for eating xml in comments…

    works:
    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

    doesn’t work:
    interface type=’network’
    source network=’default’/
    model type=’virtio’/
    /interface

  6. BestJunko

    I see you don’t monetize zoned.net, don’t waste your traffic, you
    can earn additional cash every month with new
    monetization method. This is the best adsense alternative
    for any type of website (they approve all sites), for more details simply search in gooogle: murgrabia’s tools

  7. Fadi R

    This is 7 years after the fact and maybe not so useful to you now but – just as an FYI – you can simply bypass your virt-manager problem by replacing the /var/lib/libvirt/images folder with a symbolic link that points to a more convenient partition:

    sudo mv /var/lib/libvirt/images /new/path/images
    sudo ln -s /new/path/images /var/lib/libvirt/images

    That being said: thanks so much for this awesome tutorial! There is next to no info about gnome-boxes and how to customize it even 2019.

  8. Fadi R

    I assume virtio the name of your physical network device (to be replaced with the name of mine on my machine)? Is the mac address that’s inputed that of virbr0 or of “virtio”?

    I have a problem with this, where

    keeps getting replaced by the default after I start the virtual machine

    Any ideas?

  9. Benjamin Kahn Post author

    Hey Fadi,

    Your comment got chopped off by WordPress, so I can’t answer. Do you want to post again?

  10. Fadi

    Hi Ben, I ended up disabling the bridge because it was causing some crashes in gnome-boxes. Anyway, I don’t think I followed your instructions correctly, I thought virtio was the name of your wifi or eth device, so I put my wifi device instead of virtio and it kept getting replaced by rtl8139 (the default virtual device). I might try again some other time.

Leave a Reply

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