0

I want to use match in my netplan config, but if I attach a vlan to an interface I can no longer match by the mac address of that interface alone. See netplan - match physical ifs only

Proposed solution is to match the driver as well as the macaddress.

From the netplan docs,

match (mapping)
This selects a subset of available physical devices by various hardware
properties. The following configuration will then apply to all matching
devices, as soon as they appear. All specified properties must match.

name (scalar)
...
macaddress (scalar)
...
driver (scalar or sequence of scalars) – sequence since 0.104
Kernel driver name, corresponding to the DRIVER udev property.
A sequence of globs is supported, any of which must match.
Matching on driver is only supported with networkd.

so I need to know the DRIVER udev property. But where can I find that?

I found udev_device_get_driver but I've never worked with C headers like this and I'm not sure what I would give it as an input (struct udev_device *udev_device)

1 Answer 1

1

Look at your interfaces with ip a and you find the one you want to match in netplan.

The name of this interface shall be $NAME.

udevadm info -a /sys/class/net/$NAME

In the output of this there should be:

looking at device /devices/.../foo/net/$NAME

which has DRIVER defined as an empty string.

and then looking at parent device /devices/.../foo

which has DRIVER defined. This is what you can refer to in your netplan config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.