Here are the steps needed to get KVM up and running.

EL7

  1. Install dependencies

    sudo yum install -y kvm virt-manager libvirt virt-install qemu-kvm libvirt-client virt-viewer bridge-utils
    
  2. Enable IPv4 forwarding

    echo "net.ipv4.ip_forward = 1"|sudo tee /etc/sysctl.d/99-ipforward.conf net.ipv4.ip_forward = 1
    sudo sysctl -p /etc/sysctl.d/99-ipforward.conf net.ipv4.ip_forward = 1
    
  3. Fix netowrk script for your ethernet device. This example will presume eno1 is your network device. Edit /etc/sysconfig/network-scripts/ifcfg-eno1 and remove anything that doesn't fit this example (we do not need any IPv4/IPv6 data here, just the HWADDR (MAC address) and the basic on-boot information.

    DEVICE="eno1"
    ONBOOT=yes
    HWADDR="00:0c:29:32:d0:4c"
    BRIDGE=br0
    
  4. Create bridge device. This is a new file we will create at /etc/sysconfig/network-scripts/ifcfg-br0. Edit the IPADDR, NETMASK, GATEWAY, and DNS lines to use a separate subnet to what you are using:

    DEVICE="br0"
    TYPE=BRIDGE
    ONBOOT=yes
    BOOTPROTO=static
    IPADDR="192.168.202.111"
    NETMASK="255.255.255.0"
    GATEWAY="192.168.202.2"
    DNS1="192.168.202.2"
    
  5. For dynamic IPs in your guests, setup KVM to use bridged networking or setup your bridge as follows:

    DEVICE=br0
    TYPE=Bridge
    BOOTPROTO=dhcp
    ONBOOT=yes
    DELAY=0
    
  6. Add user(s) to libvirt group to manage VMs

    sudo gpasswd libvirt -a USERNAME
    
  7. Reboot to enable changes.

    sudo systemctl reboot
    

FEDORA

  1. Install dependencies

    sudo dnf groupinstall "Virtualization"
    sudo dnf install qemu-img  libvirt libvirt-python libvirt-client
    
  2. Add user(s) to libvirt group to manage VMs

    sudo gpasswd libvirt -a USERNAME
    
  3. Reboot to enable changes

    sudo systemctl reboot
    

UBUNTU

  1. Install dependencies

    sudo apt install -y qemu-kvm libvirt0 libvirt-bin virt-manager bridge-utils
    
  2. Enable service

    sudo systemctl enable libvirtd
    
  3. Enable bridge (presuming ethernet adapter is eno1, change as needed)

    cat <<EOF | sudo tee /etc/network/interfaces
    auto lo
    iface lo inet loopback
    auto br0
    iface br0 inet dhcp
          bridge_ports eno1
          bridge_stp off
          bridge_maxwait 0
    EOF
    
  4. Reboot to have settings take effect

    sudo reboot
    

USE NETWORK MANAGER CLI (nmcli)

  1. I personally move/vape the existing /etc/sysconfig/network-scripts/ifcfg-* and use nmcli to start fresh, just in case something isnt overwritten correctly. But to each their own.

  2. Install needed packages

  3. CREATE BRIDGE

    nmcli con add type bridge con-name br0 ifname br0 autoconnect yes
    
  4. ADD $ADAPTER TO BRIDGE

    nmcli con add type ethernet con-name $ADAPTER ifname $ADAPTER master br0 autoconnect yes
    nmcli con mod br0 bridge.stp no
    
  5. USE STATIC IP ON BRIDGE

    nmcli con mod br0 ipv4.addresses 192.168.1.2/16 ipv4.method manual ipv4.gateway 192.168.1.1 ipv4.dns  8.8.8.8
    
  6. USE DHCP ON BRIDGE

    nmcli con mod br0 ipv4.method auto
    

REFERENCES