Fix MAC address of maln0

When using imx6ull and no AP is connected, the mlan0 MAC address appears to be randomized.
For some reason, once successfully connected to an access point, it is fixed to a specific MAC address (even if connected to a different AP), but what process is running?
I would like to have a fixed MAC address both when connected and when not connected.

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Wi-Fi MAC Address Management on Colibri iMX6ULL

The Colibri iMX6ULL features on-board Wi-Fi functionality with the mlan0 interface (1). The behavior you’re observing with MAC address randomization when no AP is connected, followed by a fixed MAC address after successful connection, is related to how the Wi-Fi driver and connection management handle MAC address assignment.

Understanding the mlan0 Interface

On Toradex Reference Images, the mlan0 interface represents the regular station Wi-Fi interface used to connect to Wi-Fi networks (1). When working with the Colibri iMX6ULL, you should specifically connect to the mlan0 Wi-Fi interface, which can be distinguished based on MAC addresses (1).

Connection Management Process

The connection management is handled by the connman package on Reference Images for Yocto Project (1). When you use connmanctl to manage Wi-Fi connections, the process involves:

  1. Enabling Wi-Fi technology layer:
connmanctl enable wifi

(1)

  1. Scanning for networks:
connmanctl scan wifi

(1)

  1. Connecting to a network:
connmanctl connect wifi_<HASH>_managed_psk

(1)

Setting a Fixed MAC Address

To ensure a consistent MAC address for the mlan0 interface both when connected and disconnected, you can configure the MAC address manually using standard Linux networking tools.

You can set a fixed MAC address by:

  1. Bringing down the interface:
ip link set dev mlan0 down

(2)

  1. Setting the desired MAC address:
ip link set dev mlan0 address XX:XX:XX:XX:XX:XX
  1. Bringing the interface back up:
ip link set dev mlan0 up

Persistent Configuration

To make the MAC address setting persistent across reboots, you can create a systemd service or add the configuration to your network management setup. This ensures the MAC address is set before the Wi-Fi connection process begins.

The Colibri iMX6ULL is specifically designed as a power-efficient, cost-effective platform with pre-certified Wi-Fi and Bluetooth capabilities (3), making it ideal for IoT and embedded applications where consistent network identification is important.

Best regards, Toradex AI Assistant.

I would like to use the MAC address that Toradex originally uses for Wi-Fi communication using Azurewave AW-CM276NF, but is there no such thing?

Hey, @67592,

What you are seeing is normal behavior, MAC address randomization is a security feature: the MAC address is randomized until the device connects to a network to avoid undesired tracking. This is a feature provided by the Linux Kernel itself to improve the system security. Why exactly do you wish to have a fixed MAC address during scanning?

Best regards,

I’m not entirely convinced, but it’s a requirement of the system I’m connecting to.
Sorry.

For security reasons, it is better not to do this if it is not necessary, but I have disabled the function as follows.

/etc/NetworkManager/conf.d/wifi_rand_mac.conf

[device]
wifi.scan-rand-mac-address=no

1 Like