How to disable MAC address randomisation on Fedora 31

When setting up a new Freeside machine, it’s imperative that the MAC address is not randomised when sending requests to the DHCP server - which is apparently the default on newer versions of Fedora. This is because the department statically allocates us IP addresses based on the MAC address.

Disabling this ‘feature’ on Fedora is a quite easy.

Step 1: Add the configuration directive

Edit (or create) /etc/dhcp/dhclient.conf, and append the following directive:

send dhcp-client-identifier = hardware;

For the lazy, do this:

echo "send dhcp-client-identifier = hardware;" | sudo tee --append /etc/dhcp/dhclient.conf

Step 2: Reboot

With the configuration directive in place, reboot the machine. It should now grab the correct reserved IP address.

Why?

This is needed because the department’s DHCP server requires that the interface for the MAC address of the network interface that the machine uses to connect be sent in the DHCP - and not a random MAC address or other identifier.

This fix forces Fedora to send the actual MAC address oft he network interface when grabbing the IP address from the DHCP server.


Old method (don’t use!)

This was a troubleshooting step we tried to fix the issue. It transpires that this is not actually needed. ONLY follow these instructions if the steps above do NOT work.

Step 1: Identify the interface

First, you need to find the name of the network interface the machine uses to connect. This needs to be the name that NetworkManager has chosen for it - which isn’t always the same as the one you see when you do ip addr.

Find it like this:

nmcli connection show

Step 2: Find the MAC address

Next, you’ll need the actual name of the interface in question from ip addr (which is usually - but not always - the same as the one NetworkManager assigns to it.

Once you’ve got it, do this:

cat /sys/class/net/INTERFACE_NAME/address

…replacing INTERFACE_NAME with the name of the interface found from ip addr.

This will give you the MAC address (you can also find it in the output of ip addr).

Step 3: Disable randomisation

Finally, we can now disable the randomisation. This is done like so:

sudo nmcli connection modify "NM_INTERFACE_NAME" 802-3-ethernet.cloned-mac-address MAC_ADDRESS

…replacing NM_INTERFACE_NAME with the NetworkManager interface name from before, and MAC_ADDRESS with the MAC address you found in step 2.

Step 4: Reboot

Lastly, reboot the machine. Alternatively, you can take the network interface down and put it up again, but it’s easier (and safer) to just reboot the machine 9 times out of 10.