Product SiteDocumentation Site

7.2. XML Interface Description Format

The current Relax NG definition of the XML that is produced/accepted by virInterfaceDefineXML/virInterfaceGetXMLDesc can be found in the file data/xml/interface.rng of the netcf package, available at http://git.fedorahosted.org/git/netcf.git?p=netcf.git;a=tree. Below are some examples of common interface configurations.
<interface type='ethernet' name='eth0'>
  <start mode='onboot'/>
  <mac address='aa:bb:cc:dd:ee:ff'/>
  <protocol family='ipv4'>
    <dhcp/>
  </protocol>
</interface>
Example 7.1. XML definition of an ethernet interface using DHCP

<interface type='ethernet' name='eth0'>
  <start mode='onboot'/>
  <mac address='aa:bb:cc:dd:ee:ff'/>
  <protocol family='ipv4'>
    <ip address="192.168.0.5" prefix="24"/>
    <route gateway="192.168.0.1"/>
  </protocol>
</interface>
Example 7.2. Example 7.2 XML definition of an ethernet interface with static IP

<interface type="bridge" name="br0">
  <start mode="onboot"/>
  <mtu size="1500"/>
  <protocol family="ipv4">
    <dhcp/>
  </protocol>
  <bridge stp="off" delay="0.01">
    <interface type="ethernet" name="eth0">
      <mac address="ab:bb:cc:dd:ee:ff"/>
    </interface>
    <interface type="ethernet" name="eth1"/>
  </bridge>
</interface>
Example 7.3. Example 7.3 XML definition of a bridge device with eth0 and eth1 attached

<interface type="vlan" name="eth0.42">
  <start mode="onboot"/>
  <protocol family="ipv4">
    <dhcp peerdns="no"/>
  </protocol>
  <vlan tag="42">
    <interface name="eth0"/>
  </vlan>
</interface>
Example 7.4. XML definition of a vlan interface associated with eth0