Monday, 23 February 2015

Creating a network bridge for KVM virtualization

While setting up network for KVM virtualization, it is necessary to setup a network bridge. The virtual machines, must be connected to the network bridge created on the host machine. By doing so, the guest machines will share the physical network of host machine. The network bridge makes the VMs to behave as standalone servers.

Steps to create a bridge network is explained below:

Step 1: Install "bridge-utils" packages via yum as below:
yum install bridge-utils

Step 2: Create a new file for bridge network as below:
[root@rhel-test2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-br0

Now, make sure no ipaddress,gateway,netmask is mentioned to the physical interface of the server. Let us assume physical interface is "eth0".

Now, restart the network using "/etc/init.d/network restart".

This will bring up bridge network "br0".

Step 3: Map the physical network to the bridge network, by editing the "ifcfg-eth0" file as below:

The "ifcfg-eth0" file will look as below:

[root@rhel-test2 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

During the virtual machine creation process using the virt-manager tool, the network configuration screen will list now Host device eth0 (Bridge ‘br0’) under the Advanced options section of the final page of the new virtual machine creation wizard:

When this option is selected for a virtual machine it will have access to the external network using the same eth0 device used by the host.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.