Now that CentOS 7 is installed and has a static IP address, I'll go ahead and install KVM. First you'll want to check if your processor/motherboard has the necessary extensions:

egrep -i 'vmx|svm' --color=always /proc/cpuinfo | sort | uniq

Output:

flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs hw_pstate npt lbrv svm_lock

Now let's install the tools - note that I also include the ifconfig package and the bind-utils (for the dig command)

yum -y install qemu-kvm libvirt virt-install bridge-utils ifconfig bind-utils

Start the libvirtd service:

systemctl start libvirtd

Set it to start automatically on every boot:

systemctl enable libvirtd

Note: My router is 192.168.2.1 The KVM host is: 192.168.2.100 You'll notice that you also have a virbr0 device which already has an IP - you can ignore this one as we're adding a different interface (bridge0)

ifconfig virbr0
virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether d2:55:3d:b6:5b:d5  txqueuelen 0  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Now configure networking - in my case this is the configuration of my original device /etc/sysconfig/network-scripts/ifcfg-eth0-backup

cat /etc/sysconfig/network-scripts/ifcfg-enp0s7
DEVICE="enp0s7"
ONBOOT="yes"
NM_CONTROLLED="no"
TYPE=Ethernet
BOOTPROTO=static
IPADDR=192.168.2.100
NETMASK=255.255.255.0
GATEWAY=192.168.2.1

I commented out the networking configuration parts and added the BRIDGE. The configuration parts will be moved to the bridge interface - the end result looks like this:

cat /etc/sysconfig/network-scripts/ifcfg-enp0s7
DEVICE="enp0s7"
ONBOOT="yes"
NM_CONTROLLED="no"
#TYPE=Ethernet
BRIDGE=bridge0
BOOTPROTO=static
#IPADDR=192.168.2.100
#NETMASK=255.255.255.0
#GATEWAY=192.168.2.1

And this is the bridge file I added:

cat /etc/sysconfig/network-scripts/ifcfg-bridge0
DEVICE="bridge0"
ONBOOT="yes"
TYPE=Bridge
BOOTPROTO=static
IPADDR=192.168.2.100
NETMASK=255.255.255.0

Note that the GATEWAY line is gone from both enp0s7 AND bridge0 - this should go into /etc/sysconfig/network

cat /etc/sysconfig/network
# Created by anaconda
GATEWAY=192.168.2.1

Now issue a service network restart:

service network restart
Restarting network (via systemctl):                        [  OK  ]

The result should look like this - the enp0s7 interface:

ifconfig enp0s7
enp0s7: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::21e:90ff:fe77:865c  prefixlen 64  scopeid 0x20<link>
        ether 00:1e:90:77:86:5c  txqueuelen 1000  (Ethernet)
        RX packets 804  bytes 103470 (101.0 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 475  bytes 61930 (60.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The bridge0 interface:

ifconfig bridge0
bridge0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.2.100  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::21e:90ff:fe77:865c  prefixlen 64  scopeid 0x20<link>
        ether 00:1e:90:77:86:5c  txqueuelen 0  (Ethernet)
        RX packets 398  bytes 27098 (26.4 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 250  bytes 32824 (32.0 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The router should be pingable:

ping -c 1 192.168.2.1
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=3.73 ms

--- 192.168.2.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 3.732/3.732/3.732/0.000 ms

DNS should be resolving - couple of quick tests:

dig www.google.com +short
173.194.33.84
173.194.33.80
173.194.33.82
173.194.33.83
173.194.33.81
dig www.weirdbricks.com +short
lampros.chaidas.com.
69.172.229.155

LINKS/REFERENCES: