4

First of all, I would like to apologize for my bad English.

I usually find an answer after a few hours, days or even weeks of research, but today, I feel quite lost and would appreciate some help.

Goal:

My goal is to setup a bridge interface with Netplan. This bridge interface will provide an IP address through DHCP to my guest OS (KVM).

Problem:

My guest OS can't establish a connection through the bridge interface. The problem might come from Netplan's configuration or the parameters used to install guest OS.

Context:

My server runs Ubuntu Bionic 18.04 LTS and it is a cloud server hosted by an external provider. The guest OS I want to install is also a Ubuntu Bionic 18.04 LTS distribution. My server supports hardware virtualization and is capable of running hardware accelerated KVM virtual machines.

Initial network state of the Host OS:

The output of ifconfig -a is:

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 10.52.16.185  netmask 255.255.255.0  broadcast 10.52.16.255
    inet6 fe80::f816:3eff:fe82:c5fe  prefixlen 64  scopeid 0x20<link>
    inet6 2001:1600:4:8:f816:3eff:fe82:c5fe  prefixlen 64  scopeid 0x0<global>
    ether fa:16:3e:82:c5:fe  txqueuelen 1000  (Ethernet)
    RX packets 255880  bytes 22882442 (22.8 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 582  bytes 49337 (49.3 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 138  bytes 10546 (10.5 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 138  bytes 10546 (10.5 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The output of ip route is:

default via 10.52.16.1 dev ens3 proto dhcp metric 100 
10.52.11.0/24 dev ens3 proto dhcp scope link metric 100 
10.52.16.0/24 dev ens3 proto kernel scope link src 10.52.16.185 
10.52.20.0/24 dev ens3 proto dhcp scope link metric 100 
10.52.24.0/24 dev ens3 proto dhcp scope link metric 100 
169.254.169.254 via 10.52.16.1 dev ens3 proto dhcp metric 100

The output of lspci is:

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon

$ networkctl -a status

● 1: lo
   Link File: /lib/systemd/network/99-default.link
Network File: n/a
        Type: loopback
       State: carrier (unmanaged)
     Address: 127.0.0.1
              ::1

● 2: ens3
   Link File: /lib/systemd/network/99-default.link
Network File: /run/systemd/network/10-netplan-ens3.network
        Type: ether
       State: routable (configured)
        Path: pci-0000:00:03.0
      Driver: virtio_net
      Vendor: Red Hat, Inc.
       Model: Virtio network device
  HW Address: fa:16:3e:82:c5:fe
     Address: 10.52.16.185
              2001:1600:4:8:f816:3eff:fe82:c5fe
              fe80::f816:3eff:fe82:c5fe
     Gateway: 10.52.16.1
              fe80::f816:3eff:fee7:1ea5
         DNS: XX.XX.XX.XX
              YY.YY.YY.YY
Search Domains: myprovider.ext

What I've done so far:

First step, would be to create a bridge interface br0. Since I run Ubuntu 18, I should use Netplan for this.

The initial configuration of Netplan in /etc/netplan/50-cloud-init.yaml is:

network:
version: 2
ethernets:
    ens3:
        dhcp4: true
        match:
            macaddress: fa:16:3e:82:c5:fe
        mtu: 8950
        set-name: ens3

I did a lot of tests with this configuration but my bridge interface (br0) wouldn't get an IP. I ended up using the NetworkManager as a renderer and the following /etc/netplan/50-cloud-init.yaml configuration worked:

network:
version: 2
renderer: NetworkManager
ethernets:
    ens3:
        dhcp4: false
        dhcp6: false
        match:
            macaddress: fa:16:3e:82:c5:fe
        set-name: ens3
        mtu: 8950
bridges:
    br0:
        interfaces: [ens3]
        dhcp4: true
        dhcp6: false
        mtu: 8950
        parameters:
            stp: true
            forward-delay: 4

The output of ifconfig -a using Netplan's is:

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 8950
    inet 10.52.16.185  netmask 255.255.255.0  broadcast 10.52.16.255
    inet6 fe80::f816:3eff:fe82:c5fe  prefixlen 64  scopeid 0x20<link>
    inet6 2001:1600:4:8:f816:3eff:fe82:c5fe  prefixlen 64  scopeid 0x0<global>
    ether fa:16:3e:82:c5:fe  txqueuelen 1000  (Ethernet)
    RX packets 6364  bytes 468754 (468.7 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 75  bytes 11528 (11.5 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 8950
    ether fa:16:3e:82:c5:fe  txqueuelen 1000  (Ethernet)
    RX packets 8132  bytes 713045 (713.0 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 114  bytes 13490 (13.4 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 176  bytes 11840 (11.8 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 176  bytes 11840 (11.8 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

The output of ip route using Netplan is:

10.52.11.0/24 dev br0 proto dhcp scope link metric 425 
10.52.16.0/24 dev br0 proto kernel scope link src 10.52.16.185 metric 425 
10.52.20.0/24 dev br0 proto dhcp scope link metric 425 
10.52.24.0/24 dev br0 proto dhcp scope link metric 425 
169.254.169.254 via 10.52.16.1 dev br0 proto dhcp metric 425

The output of lspci using Netplan is:

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc Virtio network device
00:04.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc Virtio memory balloon

The output of networkctl -a status using Netplan is:

● 1: lo
   Link File: /lib/systemd/network/99-default.link
Network File: n/a
        Type: loopback
       State: carrier (unmanaged)
     Address: 127.0.0.1
              ::1

● 2: ens3
   Link File: /run/systemd/network/10-netplan-ens3.link
Network File: n/a
        Type: ether
       State: carrier (unmanaged)
        Path: pci-0000:00:03.0
      Driver: virtio_net
      Vendor: Red Hat, Inc.
       Model: Virtio network device
  HW Address: fa:16:3e:82:c5:fe

● 3: br0
   Link File: /lib/systemd/network/99-default.link
Network File: n/a
        Type: ether
       State: routable (unmanaged)
      Driver: bridge
  HW Address: fa:16:3e:82:c5:fe
     Address: 10.52.16.185
              2001:1600:4:8:f816:3eff:fe82:c5fe
              fe80::f816:3eff:fe82:c5fe
     Gateway: 10.52.16.1
              fe80::f816:3eff:fee7:1ea5

Guest OS installation:

Now that my bridge interface looked good, I installed the required packages for virtualization (qemu qemu-kvm libvirt-bin bridge-utils virt-manager) and started the libvirtd service.

Then, I tried to install my first guest OS using virt-install with the following command :

$ sudo virt-install \
--name projectname \
--ram 1024 \
--vcpus 1 \
--network bridge:br0 \
--disk path=/srv/data/projectname,size=2 \
--os-type Linux \
--os-variant=ubuntu18.04 \
--location 'http://archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/' \
--graphics none \
--extra-args 'console=ttyS0' \
--console pty,target_type=serial

Unfortunately, the installer could not configure the network using DHCP as I get:

Network autoconfiguration failed

Network state after failed guest OS installation attempt:

The output of ifconfig -a is:

br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 8950
    inet 10.52.16.185  netmask 255.255.255.0  broadcast 10.52.16.255
    inet6 fe80::f816:3eff:fe82:c5fe  prefixlen 64  scopeid 0x20<link>
    inet6 2001:1600:4:8:f816:3eff:fe82:c5fe  prefixlen 64  scopeid 0x0<global>
    ether fa:16:3e:82:c5:fe  txqueuelen 1000  (Ethernet)
    RX packets 289453  bytes 301978563 (301.9 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 70249  bytes 7101505 (7.1 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 8950
    ether fa:16:3e:82:c5:fe  txqueuelen 1000  (Ethernet)
    RX packets 294080  bytes 306373898 (306.3 MB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 71779  bytes 7183441 (7.1 MB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 332  bytes 27936 (27.9 KB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 332  bytes 27936 (27.9 KB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
    ether 52:54:00:06:10:e5  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0-nic: flags=4098<BROADCAST,MULTICAST>  mtu 1500
    ether 52:54:00:06:10:e5  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

vnet0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 8950
    inet6 fe80::fc54:ff:fe8e:6a11  prefixlen 64  scopeid 0x20<link>
    ether fe:54:00:8e:6a:11  txqueuelen 1000  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 1  bytes 90 (90.0 B)
    TX errors 0  dropped 108892 overruns 0  carrier 0  collisions 0

The output of ip route is:

default via 10.52.16.1 dev br0 proto dhcp metric 425 
10.52.11.0/24 dev br0 proto dhcp scope link metric 425 
10.52.16.0/24 dev br0 proto kernel scope link src 10.52.16.185 metric 425 
10.52.20.0/24 dev br0 proto dhcp scope link metric 425 
10.52.24.0/24 dev br0 proto dhcp scope link metric 425 
169.254.169.254 via 10.52.16.1 dev br0 proto dhcp metric 425 
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

The output of lspci is:

00:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev 02)
00:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
00:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
00:01.2 USB controller: Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II] (rev 01)
00:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 03)
00:02.0 VGA compatible controller: Cirrus Logic GD 5446
00:03.0 Ethernet controller: Red Hat, Inc. Virtio network device
00:04.0 SCSI storage controller: Red Hat, Inc. Virtio block device
00:05.0 SCSI storage controller: Red Hat, Inc. Virtio block device
00:06.0 Unclassified device [00ff]: Red Hat, Inc. Virtio memory balloon

The output of networkctl -a status is:

● 1: lo
   Link File: n/a
Network File: n/a
        Type: loopback
       State: carrier (unmanaged)
     Address: 127.0.0.1
              ::1

● 2: ens3
   Link File: n/a
Network File: n/a
        Type: ether
       State: carrier (unmanaged)
        Path: pci-0000:00:03.0
      Vendor: Red Hat, Inc.
       Model: Virtio network device
  HW Address: fa:16:3e:82:c5:fe

● 3: br0
   Link File: n/a
Network File: n/a
        Type: ether
       State: routable (unmanaged)
      Driver: bridge
  HW Address: fa:16:3e:82:c5:fe
     Address: 10.52.16.185
              2001:1600:4:8:f816:3eff:fe82:c5fe
              fe80::f816:3eff:fe82:c5fe
     Gateway: 10.52.16.1
              fe80::f816:3eff:fee7:1ea5

● 4: virbr0
   Link File: /lib/systemd/network/99-default.link
Network File: n/a
        Type: ether
       State: no-carrier (unmanaged)
      Driver: bridge
  HW Address: 52:54:00:06:10:e5
     Address: 192.168.122.1

● 5: virbr0-nic
   Link File: /lib/systemd/network/99-default.link
Network File: n/a
        Type: ether
       State: off (unmanaged)
      Driver: tun
  HW Address: 52:54:00:06:10:e5

● 7: vnet0
   Link File: /lib/systemd/network/99-default.link
Network File: n/a
        Type: ether
       State: degraded (unmanaged)
      Driver: tun
  HW Address: fe:54:00:8e:6a:11
     Address: fe80::fc54:ff:fe8e:6a11

I tried the same command above but replacing br0 with virbr0. Installation succeeded but this looks wrong (based on all the tutorials I've seen so far...).

Questions

  • Should I use Netplan or remove it completely ?
  • Should a use the default networkd renderer or is it good to use NetworkManager ?
  • Is my Netplan configuration correct ?
  • Are the virt-install parameters correct ?
  • ...What am I doing wrong ?
Fabby
  • 5,836
  • 2
  • 22
  • 38
Alexander
  • 41
  • 1
  • 2
  • Good man. Thanks for accepting my critique and shuffling your question to the right place. – tink Sep 06 '19 at 21:20
  • 1
    @tink Thank YOU for investing time in helping people you do not know. I admire what you and the other members are doing for this community unconditionally. – Alexander Sep 06 '19 at 21:38
  • Sorry for the edits, I do this just to ensure I read all the details, but I don't have enough VM knowledge to help you... `ifconfig-a` contains the same information as `ip a`... **;-)** – Fabby Sep 06 '19 at 22:06
  • 1
    @Fabby Thanks for the edit ! I took knowledge of the changes for later :) – Alexander Sep 06 '19 at 22:19
  • I have the same use case with `virsh` and the exact same problem. Although I use the `networkd` renderer for `Netplan`. Have you tried it with 20.04 LTS yet? – user643011 May 05 '20 at 03:06

0 Answers0