I want to make an SD card image (Raspberry Pi) that is set up to connect to a certain WiFi network using network-manager (such that it automatically reconnects). However, each different device has a different MAC address. This causes the profile I made with nmcli to not be used.

How can I make a network-manager profile that works with any MAC address?

# nmcli connection edit id XXXX
nmcli> describe 802-11-wireless.mac-address
=== [mac-address] ===
[NM property description]
If specified, this connection will only apply to the Wi-Fi device whose permanent MAC address matches. This property does not change the MAC address of the device (i.e. MAC spoofing).

This can also be found in nm-settings(5).

So, just don't specify it by removing it. Which can be scripted simply with:

# nmcli connection modify id XXXX 802-11-wireless.mac-address ''

as explained in nmcli(1):

modify [--temporary] [id | uuid | path] ID { option value | [+|-]setting. property value}...

Add, modify or remove properties in the connection profile.

To set the property just specify the property name followed by the value. An empty value ("") removes the property value.

Be sure you still have other properties (eg connection.interface-name) to identify unambiguously the correct device. And be careful if reconfiguring the settings with a graphical tool, it might reapply some unwanted default values.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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