Tip

Creating a bridged network interface on a KVM host

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

    Requires Free Membership to View

networking, but KVM infrastructures often don't include one of those types: the bridged network.

Read more on virtual networking

Hyper-V virtual network configurations

Evaluating virtual network software

How to integrate physical and virtual networks

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-br0 and 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.

This was first published in July 2013

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.