Virtual Networking in KVM breaking internet access

kvm-virtualizationvirtual-networkvirtualization

I have set up a virtual networking on my CentOS 7 Workstation and the primary physical network interface is bridged as per this RHEL article.

libvirtd is running successfully, however after reboot this is what happens

virsh net-list --all
Name                 State      Autostart     Persistent
----------------------------------------------------------
default              inactive   yes           yes

If I try to start the default bridge. This is what I get

virsh net-start default 
error: Failed to start network default
error: internal error: Network is already in use by interface virbr0

So put the virtual bridge (virbr0) down and deleted the default bridge.

ifconfig virbr0 down
virsh net-start default 
Network default started

virsh net-list --all
Name                 State      Autostart     Persistent
----------------------------------------------------------
default              active     yes           yes

Once the virtual bridge (default) is active, I completely loose internet connectivity on my KVM host. Cannot ping www.google.com

Any idea why might be happening or any miss configuration that has occurred? I have the following interface scripts

Primary physical interface: ifcfg-enp1s0

TYPE="Ethernet"
NAME="enp1s0"
HWADDR=2c:27:d7:ef:fd:1e
UUID="f7fb856b-1879-411d-b8a4-0ef8c93303dc"
DEVICE="enp1s0"
ONBOOT="yes"
BOOTPROTO=dhcp
BRIDGE=virbr0
NM_CONTROLLED=no

Virtual Bridge interface: ifcfg-virbr0

DEVICE=virbr0
ONBOOT=yes
TYPE=Bridge
BOOTPROTO=none
IPADDR=192.168.3.52
NETMASK=255.255.255.0
GATEWAY=192.168.3.1
STP=on
DELAY=0
NM_CONTROLLED=no

Best Answer

Remove the autostart from the network definition. It is being started by the network manager. The two configurations may be conflicting. virsh may report the interace as inactive even if it is up. Whatever you define your bridge as, it neeeds to be declared to libvirt. You will need to ensure the network configuration is complete.

Alternatively, you can delete the external bridge definition, but that may cause issues for applications running on the host.

I prefer to define the bridge using the host tools. This ensures things aren't changed there and allows me to manage the networking with one set of tools.

I generally test the networking in stages.

  • Access to the host
  • Access to the lan the host is connected to
  • Access to the network/internet