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/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/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"
    

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
  1. Add user(s) to libvirt group to manage VMs

    sudo gpasswd libvirt -a USERNAME
    
  2. 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
    

REFERENCES