Creating a bridged network interface on a KVM host

A bridged network interface is often absent from KVM hosts, but a few simple commands will help you create one in your RHEL infrastructure.

An older version of KVM running on your Linux host won't offer you an easy way to create a bridged network interface. Fortunately, you can manually perform this procedure in Red Hat Enteprise Linux (RHEL) 6.3.

Networking with KVM infrastructures

Most virtual infrastructures use four kinds of networking, but KVM infrastructures often don't include one of those types: the bridged network.

The first type of networking, Network Address Translation, is used to install the virtual machine (VM) behind NAT. This is helpful if the VM has to access the Internet but no external machine has to access the VM. It is not an ideal option if you want to offer public services on the VM.

Use another type, routed networking, to install the VM on its own dedicated network. Traffic will be routed between the host network and the virtual network on which you install the VM. The third type, host-only networking, allows you to test functionality in a safe and isolated environment.

Finally, the benefit of bridged networking is that it allows a VM to access the same physical network as that on which the host machine is installed.

How to make a bridged networking interface

To create a bridged network interface, you first need to prepare the host. The preparation steps vary between Linux distributions, but the procedure below has been verified on RHEL 6.3:

  1. On the host computer, stop NetworkManager by using the service NetworkManager stop command, followed by the chkconfig NetworkManager off command.
  2. Modify the network configuration on the host computer. You need to create a virtual bridge network interface by creating the file /etc/sysconfig/network-scripts/ifcfg-br0and giving this file the following contents (be sure to change the IP addresses in the example to match your network environment):

    DEVICE="br0"
    TYPE=Bridge
    DELAY=0
    ONBOOT=YES
    BOOTPROTO=static
    IPADDR=10.0.0.10
    NETMASK=255.255.255.0
    NETWORK=10.0.0.0
    GATEWAY=10.0.0.1
    NM_CONTROLLED=no
    DNS1=10.0.0.1
    PEERDNS=yes

3. Modify the contents of the file that controls your physical network card. Typically this is /etc/sysconfig/network-scripts/ifcfg-eth0, but the file name may differ depending on your configuration. If you're not sure, type ip link show to find out which network interfaces your host computer is using. The physical network card becomes a subordinate of the bridged network interface, so the configuration file will only have the following contents:

DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BRIDGE=br0


Type service network restart to restart the network.

At this point, the ip link show command should now show the virtual bridge. You can also use the brctl show command to display the bridging topology on the host computer. The topology will show that the normal physical network card is now a part of the bridge configuration. You can then install VMs on the host, and they will automatically bind to the bridged network card you created.

Read more on virtual networking

This was first published in July 2013

Dig deeper on Network virtualization

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchVMware

SearchWindowsServer

SearchCloudComputing

SearchVirtualDesktop

SearchDataCenter

Close