Netplan says "interface is not defined" when bridge uses "routes" instead of "gateway4"
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
netplan.io (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
In netplan, gateway4 and gateway6 have been deprecated, and you're supposed to use "routes" instead. But this fails with a bridge interface.
===== Working configuration =====
network:
bridges:
br0:
- 100.64.0.250/22
- ens3
- 100.64.0.1
ethernets:
ens3: {}
version: 2
===== Broken configuration =====
network:
bridges:
br0:
- 100.64.0.250/22
- ens3
- 100.64.0.1
routes:
- to: 0/0
ethernets:
ens3: {}
version: 2
The only difference is "gateway4" changed to "routes". With the second configuration, Netplan gives the following error:
root@noc:
/etc/netplan/
- ens3
^
root@noc:
As a result, the interface is not configured.
WORKAROUND: retain the deprecated gateway4: setting, as well as any additional routes you require. For example, the following is accepted (albeit with noisy deprecation warning):
routes:
- to: 128.0.0.0/1
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: netplan.io 0.105-0ubuntu2~
ProcVersionSign
Uname: Linux 5.15.0-56-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.3
Architecture: amd64
CasperMD5CheckR
Date: Thu Dec 22 15:50:59 2022
ProcEnviron:
TERM=vt220
PATH=(custom, no user)
LANG=C.UTF-8
SHELL=/bin/bash
SourcePackage: netplan.io
UpgradeStatus: No upgrade log present (probably fresh install)
Thanks for your bug report.
Using 'to: 0/0' is not really supported by Netplan (although the documentation says it is). It was removed from the docs recently [1] but it wasn't updated yet.
Can you try using 'to: default' or 'to: 0.0.0.0/0' instead? It works for me.
Now, reporting that the ethernet interface is missing because of an invalid value in a non-related field is certainly not the desired behavior. I will look at it.
[1] https:/ /github. com/canonical/ netplan/ commit/ 53e33fc716be104 98f2fe789114e93 39a38b281d