Bridges without an address fail to come online with netplan+networkd
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
netplan |
Triaged
|
Undecided
|
Unassigned |
Bug Description
I configured a container as follows, using some bridges (virbr0 and virbr1, my NAT network and test network, respectively) that I had previously configured in libvirt:
lxc init ubuntu-daily:b bionic-maas2 -p '' -s default
lxc network attach virbr0 bionic-maas2 eth0 eth0
lxc network attach virbr1 bionic-maas2 eth1 eth1
lxc config set bionic-maas2 user.network-config "version: 2
ethernets:
eth0:
match:
name: eth0
dhcp4: true
eth1:
match:
name: eth1
bridges:
br0:
interfaces: [eth1]
"
lxc start bionic-maas2
lxc exec bionic-maas2 bash
After executing the shell, I noticed that the bridge interface I specified had been created, but not brought online:
# ip link
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: br0: <BROADCAST,
link/ether c6:0d:b9:b9:68:44 brd ff:ff:ff:ff:ff:ff
32: eth0@if33: <BROADCAST,
link/ether 00:16:3e:2d:b9:df brd ff:ff:ff:ff:ff:ff link-netnsid 0
34: eth1@if35: <BROADCAST,
link/ether 00:16:3e:ef:4a:5b brd ff:ff:ff:ff:ff:ff link-netnsid 0
# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 br0 ether off unmanaged
32 eth0 ether routable configured
34 eth1 ether carrier configured
To work around the issue, I had to manually set the link up:
# ip link set dev br0 up
# networkctl
IDX LINK TYPE OPERATIONAL SETUP
1 lo loopback carrier unmanaged
2 br0 ether degraded unmanaged
32 eth0 ether routable configured
34 eth1 ether carrier configured
4 links listed.
It doesn't really seem useful for netplan to configure a 'bridge interface but not set it to come online.
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: cloud-init 17.2-30-
ProcVersionSign
Uname: Linux 4.13.0-32-generic x86_64
ApportVersion: 2.20.8-0ubuntu8
Architecture: amd64
Date: Fri Feb 9 01:29:50 2018
PackageArchitec
ProcEnviron:
TERM=xterm-
PATH=(custom, no user)
LANG=C.UTF-8
SourcePackage: cloud-init
UpgradeStatus: No upgrade log present (probably fresh install)
user_data.txt:
#cloud-config
{}
no longer affects: | cloud-init (Ubuntu) |
summary: |
- Bridges fail to come online when configured via LXD, netplan, and cloud- - init + Bridges without an address fail to come online with netplan+networkd |
I suspect that since you provided no network configuration to the bridge, then it is considered unconfigured. networkctl seems to confirm.
Now, it looks like we could use:
BindCarrier=
A link name or a list of link names. When set, controls the behavior of the current link. When all links in the list are in an operational down state, the current link is brought down. When at least one link has carrier, the current interface is brought up.
I tested this, and it appears to work:
# cat /run/systemd/ network/ 10-netplan- br0.network
[Match]
Name=br0
[Network] network/ 10-netplan- br0.network 6dff:fe12: fec5
BindCarrier=eth1
root@b1:~# networkctl status br0
● 2: br0
Link File: n/a
Network File: /run/systemd/
Type: ether
State: degraded (configured)
HW Address: ee:17:6d:12:fe:c5
Address: fe80::ec17:
Carrier Bound To: eth1
root@b1:~# ip link show br0 MULTICAST, UP,LOWER_ UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
2: br0: <BROADCAST,
link/ether ee:17:6d:12:fe:c5 brd ff:ff:ff:ff:ff:ff
root@b1:~# ip link show eth1 MULTICAST, UP,LOWER_ UP> mtu 1500 qdisc noqueue master br0 state UP mode DEFAULT group default qlen 1000
94: eth1@if95: <BROADCAST,
link/ether 00:16:3e:02:88:ea brd ff:ff:ff:ff:ff:ff link-netnsid 0
However, it's not clear to me that we want to bring down br0 if one or more of the interfaces were to go down, so this may be something that needs a better upstream fix.
This issue seemed to match: /github. com/systemd/ systemd/ issues/ 425
https:/
And some users seem to be working around by emitting units which are effectively a network-online hook, but that doesn't look very clean IMO.