Virtual Networking in KVM breaking internet access

6,671

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
Share:
6,671
hypersonics
Author by

hypersonics

Updated on September 18, 2022

Comments

  • hypersonics
    hypersonics almost 2 years

    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
    
  • hypersonics
    hypersonics almost 5 years
    Thanks @Michael Hampton. I created the files manually with the vivbr0 as the name of the bridge. Let me change and see if that makes any difference.
  • hypersonics
    hypersonics almost 5 years
    Tried removing all instances of virbr0 and renamed to just br0, however, the problem persists. After reboot the default state is inactive on the host and as soon as the bridge is made active, the host looses internet connectivity.
  • hypersonics
    hypersonics almost 5 years
    my host is physically connected using the ifcfg-enp1s0 and then the script is modified as stated above, that is, it is bridged to br0
  • Michael Hampton
    Michael Hampton almost 5 years
    @hypersonics How do you have internet connectivity before the bridge is up, then?
  • hypersonics
    hypersonics almost 5 years
    Before the bridge, it was DHCP and these were the values TYPE="Ethernet" PROXY_METHOD="none" BROWSER_ONLY="no" BOOTPROTO="dhcp" DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT="yes" IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_FAILURE_FATAL="no" IPV6_ADDR_GEN_MODE="stable-privacy" NAME="enp1s0" UUID="f7fb856b-1879-411d-b8a4-0ef8c93303dc" DEVICE="enp1s0" ONBOOT="yes"
  • Michael Hampton
    Michael Hampton almost 5 years
    @hypersonics OK, then why do you have a static IP address in the bridge configuration, instead of the DHCP you're supposed to have?