I want to do two things with netplan
(Ubuntu 22.04 Jammy):
- Rename the Wi-Fi interface on a system to
wlan0
by matching its MAC address, and - Connect that Wi-Fi interface to a Wi-Fi network.
I can't seem to do both at the same time. My three attempts and results are below.
First, I tried putting the interface config in the ethernets
section of a netplan
config file:
network: version: 2 ethernets: wlan0: dhcp4: true optional: true match: macaddress: 00:d4:9e:a4:56:87 access-points: NETWORKNAME: password: NETWORKPASS set-name: wlan0
However, this did not work because access-points
can't be in an ethernets
interface:
$ netplan apply/etc/netplan/80-config.yaml:9:7: Error in network definition: unknown key 'access-points'
Next, I tried putting the interface config in the wifis
section of a netplan
config file:
network: version: 2 wifis: wlan0: dhcp4: true optional: true match: macaddress: 00:d4:9e:a4:56:87 access-points: NETWORKNAME: password: NETWORKPASS set-name: wlan0
But this did not work because match
apparently isn't supported for wifis
?
$ netplan applyERROR: wlan0: networkd backend does not support wifi with match:, only by interface name
Finally I tried splitting it into two netplan
config files, where the first one did the interface rename in the ethernets
section, and the second did the AP config in the wifis
section:
80-config.yaml
:
network: version: 2 ethernets: wlan0: dhcp4: true optional: true match: macaddress: 00:d4:9e:a4:56:87 set-name: wlan0
81-config.yaml
:
network: version: 2 wifis: wlan0: access-points: NETWORKNAME: password: NETWORKPASS
But this didn't work because netplan
didn't like the interface type being redefined:
$ netplan apply/etc/netplan/81-config.yaml:4:5: Error in network definition: Updated definition 'wlan0' changes device type
I also tried matching by name
instead of macaddress
but ran into the same problem with match
not being allowed in wifis
interfaces.
So I'm not really sure what to do, but it's rather frustrating:
match
is not supported inwifis
(why...)access-points
is not supported inethernets
- Interface can't be configured in
ethernets
then laterwifis
How can I both rename a Wi-Fi interface (ideally by MAC) and connect it to a network?
This seems like it should be a simple task...