Linux – Lost connection to main interface after brctl addif

kvm-virtualizationlinuxnetworkingopennebulaUbuntu

I was setting up a server recently, and I was supposed to assign one of the public IP available for the server to a KVM guest. The server have the following setup:

eno1 – main internet connection of the host, assigned with a public ip
lo – loopback
virbr0 – bridge to virtual nic created by KVM

using Open Nebula I assigned virbr0 to the virtual network assigned to the guest machine and setup the specific config to the guest machine:

guest machine – /etc/network/interfaces

auto ens3
iface ens3 inet static
    address y.y.y.y
    netmask 255.255.255.255
    pointopoint <provided by host provider>
    gateway <provided by host provider>

finishing the guest configuration, I run the following on the host:

 brctl addif virbr0 eno1

After running this I was able to access the guest machine through the newly assigned IP. However, I can no longer access the host through SSH or Open Nebula.

Why does this happen? Is there also a way to setup virbr0 configuration on /etc/network/interfaces so it would stay persistent even when the host crashes?

Best Answer

You need to put the ip address on the bridge device "virbr0:

ip addr add y.y.y.y/32 dev virbr0

Look at the @stefaan-ghysels answer for details to configure at boot time.