Quantcast
Channel: Active questions tagged 22.04 - Ask Ubuntu
Viewing all articles
Browse latest Browse all 4439

How to rename a Wi-Fi interface and connect it to a network using netplan?

$
0
0

I want to do two things with netplan (Ubuntu 22.04 Jammy):

  1. Rename the Wi-Fi interface on a system to wlan0 by matching its MAC address, and
  2. 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 in wifis (why...)
  • access-points is not supported in ethernets
  • Interface can't be configured in ethernets then later wifis

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...


Viewing all articles
Browse latest Browse all 4439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>