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:
bridge-utils package using the yum package manager:sudo yum install bridge-utils
/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.
/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.
sudo systemctl restart network
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.
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.