4

Every time I restart my raspberry pi the MAC address changes. Due to this, while connecting remotely I have to hunt for its new IP.

modeset
  • 337
  • 2
  • 9
RiteshC
  • 169
  • 1
  • 4
  • 6
    I don't believe the MAC address changes as it is "hard coded" in the Raspberry Pi hardware (as all MAC addresses are). Something else is likely going on... could you edit your question, and let us knw what you're seeing exactly? – Seamus Apr 10 '19 at 23:14
  • 5
    @Seamus AFAIK it is NOT "hard coded", but is generated from the SerialNo (which is "hard coded") – Milliways Apr 10 '19 at 23:52
  • 2
    https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=237623 – Dougie Apr 11 '19 at 00:11
  • 1
    I can't argue the point effectively because I have not read every standard and specification that's been published. And even if I had, that doesn't mean that the "Pi makers" couldn't violate the standards and specs. I can only say that it's always been my understanding that a MAC address must be unique. I think that's what all of this says. Am I wrong? – Seamus Apr 11 '19 at 00:40
  • can you show two or three MAC addresses you've had – Jaromanda X Apr 11 '19 at 04:58
  • And you should learn mDNS, with multicast DNS you dont have to use IP, you use raspberrypi.local as the way to find your Raspberry Pi on the network, check https://bloggerbrothers.com/2017/01/08/name-your-pis-with-mdns-forget-the-ips-with-zeroconf/ – MatsK Apr 11 '19 at 05:00
  • You forgot to ask an actual question. Could you please edit your post to add one? – Dmitry Grigoryev Jan 19 '20 at 10:54
  • @Seamus You are wrong ;) There are widely adhered to conventions about MAC addresses but there is no protocol that requires them to be anything specific. Of course, changing it constantly in a naive way may lead to connectivity problems but point being, yes it is common enough to use random or arbitrary MAC addresses and generally it shouldn't be a problem. They are only really meaningful in local network segments where even if everyone used a random 48-bit number the chances of a collision are too small to think about. – goldilocks Jan 30 '21 at 22:31
  • @goldilocks: I assume you're commenting wrt the "MAC is unique" debate. If so, then maybe I'm wrong... it certainly wouldn't be the first time. But AFAIK, the only reference provided in this series of comments was the Wikipedia article on "Unique Identifier" in my Apr 11 comment. And when you take into account the ease with which the "apparent MAC address" may be changed in software, the argument becomes rather pointless. That said, I'll have to stick by my opinion for now - unless you've got a reference? – Seamus Jan 31 '21 at 23:33
  • That's a bit like saying you won't paint the kitchen blue until someone shows you the law in writing where it says using blue paint indoors is not illegal. This isn't impromptu stuff -- have you ever looked at an IETF RFC? If what a MAC should be were carved in stone, the tablets would be around. Generally with a protocol if something is left out or needs updating, it is. Very official like. If it isn't -- well then it isn't. – goldilocks Jan 31 '21 at 23:39
  • you can also configure mac randomization to be stable with each different AP: https://fedoramagazine.org/randomize-mac-address-nm/ – cainbantam Feb 13 '21 at 16:34

4 Answers4

10

If you decide you want to keep NetworkManager, it looks like this solution might work:

Found a post on the rpi forums. Apparently NetworkManager can randomize your mac to make it harder to people to snoop on traffic.

Here is a blog post on how to turn it off. https://blog.muench-johannes.de/networkmanager-disable-mac-randomization-314 in case it goes down:

To disable the MAC address randomization create the file

  /etc/NetworkManager/conf.d/100-disable-wifi-mac-randomization.conf

with the content:

[connection]
wifi.mac-address-randomization=1

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

Alternatively, see this other question.

modeset
  • 337
  • 2
  • 9
0

I had the same issue and realised it is because you have two different MAC addresses

  • one for the wifi
  • one for the ethernet

You can check your MAC address with

ifconfig

in the console. look for the info ether for wlan0 and eth0

0

While I agree that the MAC SHOULD not change (except during search, where most manufacturers use a random MAC) you really don't need to know the IP address. (I don't know the IP addresses of my 7 Pi or dozen or so computers on my local network.)

It is simple to connect without knowing IP and also to find the IP address. See https://raspberrypi.stackexchange.com/a/96215/8697

Milliways
  • 59,890
  • 31
  • 101
  • 209
  • 1
    This is a rather simplistic view. Imagine using DHCP reservations (based on MAC) or connecting through firewalls/routers where this simplistic scenario is simply not possible. – CrackerJack9 May 13 '21 at 01:32
0

I had the same issue. I found (I don't know how) Network Manger had been installed. Removed it. All now ok.

Pete M
  • 11