Managing network configurations

16 September 2009

Virtualization management software needs to control, in addition to virtual machine lifecycles, pretty much any aspect of virtualized hosts. The basic open-source building block for this is libvirt — one of the features it was missing up until release 0.7.0 was managing the network setup of a host.

When we discussed adding that functionality to libvirt, two things became obvious pretty quickly:

  1. Changes to the network setup must be made using the distribution’s ‘native’ network configuration scripts — anything else leads to a crazy mess

  2. Managing network configuration is useful outside of virtualization. The core functionality should be available in a separate tool

We therefore started a separate project, netcf, and integrated its API with the libvirt API (as virInterface* functions) and virsh (the iface-* commands). The netcf API is similar in spirit to the livirt API, and netcf comes with its own command line tool, ncftool. A good overview of netcf usage can be found here.

The intent with netcf is that network configuration is expressed in a distribution-agnostic way, so that management tools do not need to worry about the exact format of the native network configuration; currently, netcf comes with a driver for Fedora/RHEL, and a driver for SuSe is in the works. To fit netcf with all the ways in which people modify their network configuration, netcf is bidirectional, i.e., it can not only write out native network configuration based on its own description format, but it can also produce that description from native configuration files, no matter how they have been generated.

Interfaces, which are more like ‘connections’ in NetworkManager parlance, describe a toplevel network interface and all its dependent interfaces, e.g., a bridge and all the interfaces enslaved to that bridge. Interfaces are described through XML files, for the same reasons for which libvirt uses XML extensively in its API. As a very simple example, a basic ethernet interface is described with

  <interface type="ethernet" name="eth0">
    <start mode="onboot"/>
    <protocol family="ipv4">

That’s not so exciting, though creating a bridge that has a normal ethernet interface and a bond enslaved certainly is:

  <interface type="bridge" name="br0">
    <start mode="onboot"/>
    <bridge stp="off">
      <interface type="ethernet" name="eth2"/>
      <interface type="bond" name="bond0">
        <bond mode="active-backup">
          <miimon freq="100" updelay="10" carrier="ioctl"/>
          <interface type="ethernet" name="eth1"/>
          <interface type="ethernet" name="eth0"/>

Since netcf and the interface functionality in libvirt are brand new in Fedora 12, one great way to find out more about them is by participating in tomorrow’s (2009-09-17) Fedora Virtualization Test Day, even if it’s only for an hour. Lots of virtualization-related features are eagerly awaiting their (ab)use, including network configuration

Creative Commons License Watzmann.Blog by David Lutterkort is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

Generated with Jekyll