CentOS / Redhat: KVM Bridged Network Configuration

CentOS / Redhat: KVM Bridged Network Configuration

To configure a bridged network for KVM virtual machines on a CentOS or Red Hat Linux system, you will need to create a bridge interface and configure the virtual machines to use the bridge as their network interface.

Here are the steps to configure a bridged network for KVM on a CentOS or Red Hat Linux system:

  1. Install the bridge-utils package using the yum package manager:
refer to‮:‬lautturi.com
sudo yum install bridge-utils
  1. Edit the /etc/sysconfig/network-scripts/ifcfg-eth0 file and add the following lines to define the bridge interface:
BRIDGE=br0
ONBOOT=yes

This will configure the eth0 interface to be a part of the br0 bridge on boot.

  1. Create the /etc/sysconfig/network-scripts/ifcfg-br0 file with the following content to define the bridge interface:
DEVICE=br0
TYPE=Bridge
BOOTPROTO=static
IPADDR=192.168.1.10
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT=yes

This will configure the br0 bridge with a static IP address, netmask, and gateway.

  1. Restart the network service to apply the changes:
sudo systemctl restart network
  1. To configure a virtual machine to use the br0 bridge as its network interface, edit the virtual machine's configuration file and add the following line to the <interface> element:
<source bridge='br0'/>

For example, the <interface> element in the virtual machine's configuration file might look like this:

<interface type='bridge'>
  <source bridge='br0'/>
  <model type='virtio'/>
</interface>

This will configure the virtual machine to use the br0 bridge as its network interface.

  1. Start the virtual machine to apply the changes:
virsh start vm1

This will start the virtual machine and connect it to the br0 bridge.

It's always a good idea to carefully review the documentation and use the appropriate commands to configure a bridged network for KVM on your system. This will help ensure that you have a stable and reliable network connection for your virtual machines.

Created Time:2017-10-27 14:56:37  Author:lautturi