15

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?

mohak
  • 273
  • 1
  • 2
  • 9

3 Answers3

15

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
甘礼良
  • 151
  • 1
  • 2
13

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.

Darth Vader
  • 4,218
  • 24
  • 47
  • 70
1

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
Dan Chaltiel
  • 215
  • 3
  • 12