Recently, after I ran apt-get upgrade, my Pi 3 running Raspbian Jessie started using a random MAC address on eth0 after every reboot. I'm pretty sure this has something to do with the upgrade since I haven't messed with my network config in a long time.

My current /etc/network/interfaces file is as follows:

auto lo
iface lo inet loopback

iface eth0 inet auto

I tried appending the following line to it but to no avail:

    hwaddress ether xx:xx:xx:xx:xx:xx

As some people suggested in this thread I checked the serial no. in /proc/cpuinfo and it matches the static MAC address the Pi previously used.

Is there any way I could go back to having a static MAC address on my Pi?

  • What does uname -a output? Commented Jun 15, 2017 at 17:10
  • I recently loaded Rasbian 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux and since I wanted to setup VNC connection I probably loaded other packages unknowingly. As suggested in the replies, I removed Network-Manager packages and the dynamic wlan0 MAC address is no longer an issue. Thanks for solving this thorny headache for my internet router was going crazy assigning a new IP to the Raspberry after every boot. El Zorro, Bordeaux, France
    – El Zorro
    Commented Jun 20, 2019 at 21:58
  • For anyone who wants a fixed MAC on wlan0 as opposed to eth0, see here.
    – cyqsimon
    Commented Jun 4, 2021 at 17:48

3 Answers 3


Open a Terminal window and run:

sudo nano /boot/cmdline.txt

If in the file you see any mention of a MAC address remove it from the file. Then exit the file with saving.

To set a fixed MAC address run:

sudo nano /boot/config.txt

Add the following line if it does not already exist:


Again, exit the file with saving. B8:AA:BC:DE:F0:12 is the MAC address.

  • It worked, thanks! Any guesses as to what might have caused this behaviour?
    – mohak
    Commented Jun 15, 2017 at 19:00
  • 1
    I'm not sure to be honest with you, this isn't behavior I was aware of before today. Obviously something in the update process broke something. Having looked at the topic in other Pi forums it does seem to be an issue that has cropped up multiple times in the past and on various OS's as well.
    – Darth Vader
    Commented Jun 15, 2017 at 19:03
  • 1
    I haven't seen this myself, but have run across discussions on Ubuntu. The random MAC is a new standard to prevent tracking (on WiFi) when scannng for networks, but AFAIK should not affect DHCP request. Apple has been using this on iOS for a few years.
    – Milliways
    Commented Jun 16, 2017 at 0:07
  • On the raspberry fora (raspberrypi.org/forums/viewtopic.php?t=33252), it's suggested to place this in cmdline.txt rather that in config.txt. Is there a difference between the two?
    – Mr. White
    Commented Sep 8, 2018 at 22:36
  • For me, these actions didn't set the mac-address, but after the actions, the mac-address started to remain the same after rebooting.
    – arsdever
    Commented Jan 4, 2020 at 21:21

Seems like it's a feature of network-manager...

I installed networkmanager and random mac shows up, so I uninstalled it and problems solved:

sudo apt-get remove network-manager
  • 1
    thank you.. i confirm, network-manager is the cause for this behaviour.
    – ashishsony
    Commented Oct 13, 2019 at 8:04
  • I can also confirm this solved the problem for me Commented Nov 8, 2019 at 17:09
  • 1
    Worked for me, but fortunately I didn't need the package. For those who do, you can configure it to stop this by querying the interw3b with keywords like "network-manager disable MAC address randomization". Commented Feb 26, 2020 at 6:51
  • 12
    Couldn't add an answer, so to USE Network Manager without MAC randomization: create the file /etc/NetworkManager/conf.d/100-disable-wifi-mac-randomization.conf, then add this content on separate lines (without the slashes - those represent the line breaks): [connection]\wifi.mac-address-randomization=1\[device]\wifi.scan-rand-mac-address=no -- Save and reboot... This worked for me.
    – leanne
    Commented Jul 4, 2020 at 20:45
  • @leanne Seems like you may have enough reputation to add your brilliant answer now...
    – n1000
    Commented Jan 14, 2021 at 22:16

As @leanne said in the comments, you can use this command to keep network-manager (needed for some features) but disable MAC Address Randomization:

printf "[connection]\nwifi.mac-address-randomization=1\n\n[device]\nwifi.scan-rand-mac-address=no\n" | sudo tee /etc/NetworkManager/conf.d/100-disable-wifi-mac-randomization.conf
  • This worked for me. Commented Nov 21, 2021 at 15:34

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