Installation guide
Chapter 10. Network Configuration
76
libvirt adds iptables rules which allow traffic to and from guests attached to the virbr0 device
in the INPUT, FORWARD, OUTPUT and POSTROUTING chains. libvirt then attempts to enable the
ip_forward parameter. Some other applications may disable ip_forward, so the best option is to
add the following to /etc/sysctl.conf.
net.ipv4.ip_forward = 1
Guest configuration
Once the host configuration is complete, a guest can be connected to the virtual network based on
its name. To connect a guest to the 'default' virtual network, the following could be used in the XML
configuration file (such as /etc/libvirtd/qemu/myguest.xml) for the guest:
<interface type='network'>
<source network='default'/>
</interface>
Note
Defining a MAC address is optional. A MAC address is automatically generated if omitted.
Manually setting the MAC address may be useful to maintain consistency or easy reference
throughout your environment, or to avoid the very small chance of a conflict.
<interface type='network'>
<source network='default'/>
<mac address='00:16:3e:1a:b3:4a'/>
</interface>
10.2. Bridged networking with libvirt
Bridged networking (also known as physical device sharing) is used for dedicating a physical device
to a virtual machine. Bridging is often used for more advanced setups and on servers with multiple
network interfaces.
Disable NetworkManager
NetworkManager does not support bridging. NetworkManager must be disabled to use networking with
the network scripts (located in the /etc/sysconfig/network-scripts/ directory).
# chkconfig NetworkManager off
# chkconfig network on
# service NetworkManager stop
# service network start
Note
Instead of turning off NetworkManager, add "NM_CONTROLLED=no" to the ifcfg-* scripts used
in the examples.