7

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? – HeatfanJohn Jun 15 '17 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 Jun 20 at 21:58
10

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:

smsc95xx.macaddr=B8:AA:BC:DE:F0:12

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 Jun 15 '17 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 Jun 15 '17 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 Jun 16 '17 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 Sep 8 '18 at 22:36
7

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
  • thank you so much. – Krishna Torque Apr 6 at 18:35
  • thank you.. i confirm, network-manager is the cause for this behaviour. – ashishsony Oct 13 at 8:04
  • I can also confirm this solved the problem for me – Michael Martin Nov 8 at 17:09

protected by Community Nov 5 at 14:12

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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