KVM public bridge network on Centos7

Apr 11, 2018
  • Host is the host machine in our local network and has access to the Internet.
  • Guest is the virtual machine created with kvm.

Now we need to assign IP to Guest and make it accessible from other boxes in our local network(include the Host). Also we want to Guest can access the internet.

# On Host
# change eth0 to your physical card name
$ vim /etc/sysconfig/network-scripts/ifcfg-eth0
# comment out BOOTPROTO
# add BRIDGE=br0
# On Host
# Create /etc/sysconfig/network-scripts/ifcfg-br0
$ cat /etc/sysconfig/network-scripts/ifcfg-br0
DEVICE=br0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Bridge
# On Host
$ systemctl restart network

Now bridge br0 should get the IP address while the physical eth0 is left without an IP address.

Next we should change Guest network to br0(either GUI/CLI), and it should be work.