2

I have unkown issue with creating network bridge for KVM. What I did: My OS: Ubuntu 18.04

  1. I installed bridge-utils
sudo apt-get install bridge-utils
  1. I modified file /etc/netplan/50-cloud-init.yaml. This is content:
network:
    version: 2
    ethernets:
        eno1:
            addresses: []
            dhcp4: true
        eno2:
            addresses: [192.168.0.101/24]
            gateway4: 192.168.0.1
            dhcp4: false
        enp4s0f0:
            addresses: []
            dhcp4: true
            optional: true
        enp4s0f1:
            addresses: []
            dhcp4: true
            optional: true
        enp5s0f0:
            addresses: []
            dhcp4: true
            optional: true
        enp5s0f1:
            addresses: []
            dhcp4: true
            optional: true

    bridges:
        br0:
            interfaces: [eno2]
            dhcp4: false
            addresses: [192.168.0.100/24]
            gateway4: 192.168.0.1
            nameservers:
                addresses: [192.168.0.1]
            parameters:
                stp: true
                forward-delay: 4
  1. I ran netplan apply. All went perfectly. Now I can see:
3: eno2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default qlen 1000
    link/ether 78:2b:cb:33:29:3d brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.101/24 brd 192.168.0.255 scope global eno2
       valid_lft forever preferred_lft forever

8: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 52:54:00:43:8d:69 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever

  1. I added definition of network: host-bridge
virsh # net-dumpxml host-bridge
<network connections='1'>
  <name>host-bridge</name>
  <uuid>1823e6a7-3a86-4d7f-b612-27c003066faa</uuid>
  <forward mode='bridge'/>
  <bridge name='br0'/>
</network>
  1. Then I install new vm with:
virt-install --name=debian-tutorial4 \
    --vcpus=4 \
    --memory=8192 \
    --cdrom=/vm-images/debian-10.0.0-amd64-netinst.iso \
    --disk size=10,format=raw \
    --os-variant=debian9 \
    --network network=default \
    --network network=host-bridge
  1. When I run virsh dumpxml debian-tutorial4, I can see:
<interface type='network'>
    <mac address='52:54:00:48:0d:a2'/>
    <source network='default' bridge='virbr0'/>
    <target dev='vnet3'/>
    <model type='virtio'/>
    <alias name='net0'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<interface type='bridge'>
    <mac address='52:54:00:ca:51:97'/>
    <source network='host-bridge' bridge='br0'/>
    <target dev='vnet4'/>
    <model type='virtio'/>
    <alias name='net1'/>
    <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</interface>

When I login to the VM and run ip a, i Can see:

daniel@debian4:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:48:0d:a2 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.173/24 brd 192.168.122.255 scope global dynamic ens3
       valid_lft 3534sec preferred_lft 3534sec
    inet6 fe80::5054:ff:fe48:da2/64 scope link 
       valid_lft forever preferred_lft forever
3: ens4: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 52:54:00:ca:51:97 brd ff:ff:ff:ff:ff:ff

What I need to do connect my VM to the bridge network?


Thank you for your response.

The interface on the host is up.

root@smaug:/home/daniel# ip a show br0 up
94: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 82:43:74:4e:8d:c4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.100/24 brd 192.168.0.255 scope global br0
       valid_lft forever preferred_lft forever
    inet6 fe80::8043:74ff:fe4e:8dc4/64 scope link 
       valid_lft forever preferred_lft forever

Removed IP from eno2

        eno2:
            addresses: []
            dhcp4: false

But I still cannot see IP on my interface on the VM.

3
  • Hi, you should not post the solution as part of the question, but as an answer below. People will think it is part of the problem if it is here in the question. Aug 7, 2019 at 17:01
  • Hey Yesterday I added one more post but you removed it, marked answer as unuseful :( So i decided to do it. Aug 7, 2019 at 21:47
  • That is because you posted part of your question as an answer. Answers should be posted as answers, and questions should be posted as questions. Aug 8, 2019 at 0:15

3 Answers 3

1

On the host system check state of the br0 interface. It should be up.

In your case you should configure the ens4 interface in the guest system. This interface corresponds to your bridging network.

Also, you shouldn't assign any ip address on the eno2 interface, because it's a bridge port interface (slave of the br0 interface).

Other things seem like correctly configured.

0
0

You attach both the default and host-bridge networks to the domain. Don't do that. Using the netplan-defined bridge you'd replace

--network network=default \
--network network=host-bridge

with

--network=host-bridge

That should fix your problem as the guest will attempt to configure the first interface with DHCP.

I'd also disable STP on the bridge.

After you start your VM brctl show br0 should look like:

bridge name     bridge id               STP enabled     interfaces
br0             8000.4ccc6a27d838       no              eth0
                                                        vnet0
0

Finally I solved my issue:

Solution:

On the host site everything was ok. This is some issue with Debian I installed.

I logged there via virt-viewer, then I modified /etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens3
iface ens3 inet dhcp

iface ens4 inet static
    address 192.168.0.110/24
    gateway 192.168.0.1

Then down and up interfaces and restart networking

ip link set dev ens3 down
ip link set dev ens4 down
ip link set dev ens3 up
ip link set dev ens4 up

systemctl restart networking

Then reload dhcp:

/sbin/dhclient

And finally my VM got IPs

root@debian4:/home/daniel# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:fa:76:1b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.71/24 brd 192.168.122.255 scope global dynamic ens3
       valid_lft 3277sec preferred_lft 3277sec
    inet6 fe80::5054:ff:fefa:761b/64 scope link
       valid_lft forever preferred_lft forever
3: ens4: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:71:c1:ed brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.110/24 brd 192.168.0.255 scope global ens4
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe71:c1ed/64 scope link
       valid_lft forever preferred_lft forever

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .