So, for the VM we set a bridge. To do that we need to have bridge-utils package installed (yum install bridge-utils) and set-up the br0 bridge. There’s no need to set an IP address on the bridge as we only need to set a static route on it.
/etc/sysconfig/network-scripts/ifcfg-br0
would look like this:
DEVICE=br0
TYPE=Bridge
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=no
DELAY=0
Then we create the file /etc/sysconfig/network-scripts/route-br0
with the contents:
VM_IP dev br0
To start the bridge we just need to type in the shell:
ifup br0
To check the static route is well set we type:
ip route show dev br0
Then we edit /etc/sysctl.conf
and take care that net.ipv4.ip_forward
is set to 1, and add a line:
net.ipv4.conf.br0.proxy_arp = 1
Then we make these settings active by running in shell the command:
sysctl -p
The next step is to prepare the virtual network for libvirt. We create a file called net-br0.xml
with the following contents:
<network connections='1'>
<name>br0</name>
<forward mode='bridge'/>
<bridge name='br0' />
</network>
Then we import this file and make the virtual network active and available on start up by running these shell commands:
virsh net-define net-br0.xml
virsh net-start br0
virsh net-autostart br0
1454198100