netplan "match macaddress" messes up vlan IP addresses
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
New
|
Undecided
|
Unassigned |
Bug Description
Using "match: macaddress:" - which is sometimes necessary (e.g. see #1724895) - causes vlan interfaces to pick up the IP address of the parent instead of the address you have defined.
To reproduce: create /etc/netplan/
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: false
- 192.168.6.123/24
match:
mtu: 9000
vlans:
vlan5:
id: 5
link: ens3
dhcp4: false
- 192.168.5.123/24
Then "netplan generate; netplan apply" (or reboot). Result:
# ip addr list | grep 192.168
inet 192.168.6.123/24 brd 192.168.6.255 scope global ens3
inet 192.168.6.123/24 brd 192.168.6.255 scope global vlan5
Note how vlan5 has been given the same IP address as ens3, instead of the address which was defined for it in the YAML.
WORKAROUND: adding "set-name: ens3" under the "ens3" stanza seems to make it work.
...
ethernets:
ens3:
dhcp4: false
- 192.168.6.123/24
match:
mtu: 9000
...
(Aside: this is a workaround to a workaround. I wouldn't have needed to match on MAC address in the first place if applying the MTU had worked without it!)
Reproduced using https:/
- image downloaded on Jan 29 2020 - under kvm/libvirt, but originally seen on real hardware.
This is so annoying...
My workaround is to additionally add the driver module to the match list.
VLANs run under a generic module driver, so they don't match with the parent one.