W. H. Heydt
Posts: 8866
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

It *has* to happen!

Mon Feb 12, 2018 4:46 am

In a thread in the Compute Module Forum (which I suspect most people don't read), PhilE said, in part:
Just be aware of the possibility of a collision with another Pi - 16 million addresses is not that many to choose from, and they are assigned to Pis effectively randomly.
Now given that Pi sales are now over 17 million, this means that there are *certain* to be pairs of Pis out there with the same MAC address, no matter hos they were assigned.

User avatar
Gavinmc42
Posts: 2107
Joined: Wed Aug 28, 2013 3:31 am

Re: It *has* to happen!

Mon Feb 12, 2018 4:55 am

Y2K or do we call it Pi16KK?
What happens in a few years when there is 100M Pi's?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
DougieLawson
Posts: 33785
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: It *has* to happen!

Mon Feb 12, 2018 7:30 am

It only matters when you have two on the same router. MAC addresses are local only.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

2012-18: 1B*5, 2B*2, B+, A+, Z, ZW, 3Bs*3, 3B+

Any DMs sent on Twitter will be answered next month.

mikerr
Posts: 2718
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: It *has* to happen!

Mon Feb 12, 2018 7:40 am

They'd have to be on the same network segment (same switch/router) for it to be a problem.

Depending on the switch, you lose connectivity to one or both. Hellish to troubleshoot!
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
Imperf3kt
Posts: 1303
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: It *has* to happen!

Mon Feb 12, 2018 10:02 am

I do wonder what happens at 03:14:07 UTC on Tuesday, 19 January 2038 though.
Or (though it won't really apply to me, or even to a Pi) the year 10000 problem.
User experiencing technical difficulties.

Heater
Posts: 9823
Joined: Tue Jul 17, 2012 3:02 pm

Re: It *has* to happen!

Mon Feb 12, 2018 12:06 pm

Imperf3kt,
I do wonder what happens at 03:14:07 UTC on Tuesday, 19 January 2038 though.
Or (though it won't really apply to me, or even to a Pi) the year 10000 problem.
Nothing much.

As far as I can tell most software in the Unix/Linux world is already fixed to handle the Unix Epoch rollover in 2038.

For example, a few years back I was creating security certificates with openssl. Worked fine on my 64 bit PC. Performing the same procedure on a 32 bit machine produced certs that did not work. Eventually I discovered that I was specifying expiration dates form my certificates that were after 2038, openssl was using 32 bits to do the time calculations on 32 bit machines and rolling over. This bug has subsequently been fixed.

During the Y2K panic a lot of software engineers were dragged out of retirement and paid big bucks to fix the problem in the allegedly billions of lines of COBOL that banks and the like use. I wonder if they took the time to fix the code for the 2038 problem as well whilst they were at it.

Why not try setting the date on you Pi past 2038 or set it slightly before and watch it roll over and see what breaks? If it's anything you need you could file a bug report.

W. H. Heydt
Posts: 8866
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: It *has* to happen!

Mon Feb 12, 2018 3:37 pm

Imperf3kt wrote:
Mon Feb 12, 2018 10:02 am
I do wonder what happens at 03:14:07 UTC on Tuesday, 19 January 2038 though.
Or (though it won't really apply to me, or even to a Pi) the year 10000 problem.
I have a plastic badge that says...

COBOL Programmer
The Y10K Project

I had it made shortly after Y2K.

W. H. Heydt
Posts: 8866
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: It *has* to happen!

Mon Feb 12, 2018 3:40 pm

DougieLawson wrote:
Mon Feb 12, 2018 7:30 am
It only matters when you have two on the same router. MAC addresses are local only.
It really depends on how big a LAN segment you have (10.0.0.0/8, anyone?) and how many Pis are there. Of course, I didn't say that any one person or project was sure to have collisions, just that by now, there *must* be pairs of Pis out there with the same MAC address.

mikerr
Posts: 2718
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: It *has* to happen!

Mon Feb 12, 2018 3:57 pm

Well it is only likely to happen with large numbers on the same site, so the question is who has a large number of pi's (1000s) on one network ?

How many do the various pi colocation / hosting service have in racks ?


https://www.mythic-beasts.com/order/rpi
https://raspberry-hosting.com/en
https://www.endoffice.com/picolo.html
https://www.mininodes.com/hosted-arm-servers/
Android app - Raspi Card Imager - download and image SD cards - No PC required !

hippy
Posts: 3762
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: It *has* to happen!

Mon Feb 12, 2018 4:13 pm

Does anyone know what the actual process of assigning addresses is and have the mathematical skills to work out the likelihood of encountering two which are the same ?

Some may already have a pair but will never realise that if they have never checked, never used them both at the same time.

User avatar
RaTTuS
Posts: 10081
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: It *has* to happen!

Mon Feb 12, 2018 4:27 pm

my maths is not up to it
but it is like the birthday problem https://en.wikipedia.org/wiki/Birthday_problem
as the PI has 24bit [16777216) possible vaules

then the chances of having 2 pi's with the the same IP when that >50% is ... well I leave that to someone who knows what they are calculating ;)
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
davidcoton
Posts: 3160
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: It *has* to happen!

Mon Feb 12, 2018 6:42 pm

4096 if my memory of the theory is right (and I wouldn't like to caculate the chances of that).

(sqare root of 2^12=2^6=4096)

And while we are about it, the Y2K project I was involved with trawled our code for ANY date dependency. I found one for 2024. As it happens a few days after my (then) scheduled retirement date. The bug was documented but not fixed at that time.
I've since left that company, but I wonder whether the code will still be in use when the bug strikes. And if anyone remembered to read the documentation about the bug.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

jahboater
Posts: 2911
Joined: Wed Feb 04, 2015 6:38 pm

Re: It *has* to happen!

Mon Feb 12, 2018 6:48 pm

2^6 is 64

drgeoff
Posts: 8487
Joined: Wed Jan 25, 2012 6:39 pm

Re: It *has* to happen!

Mon Feb 12, 2018 9:37 pm

RaTTuS wrote:
Mon Feb 12, 2018 4:27 pm
my maths is not up to it
but it is like the birthday problem https://en.wikipedia.org/wiki/Birthday_problem
as the PI has 24bit [16777216) possible vaules

then the chances of having 2 pi's with the the same IP when that >50% is ... well I leave that to someone who knows what they are calculating ;)
if you have 2 RPis the chance of both having the same MAC is 1 in 16777216.

hippy
Posts: 3762
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: It *has* to happen!

Mon Feb 12, 2018 10:41 pm

drgeoff wrote:
Mon Feb 12, 2018 9:37 pm
if you have 2 RPis the chance of both having the same MAC is 1 in 16777216.
I'm not sure that's correct because my understanding is that addresses are chosen at random, that not all 16777216 combinations will have been used before some of those are reused.

Like a 16777216 sided dice rolled every time a new Pi comes off the line.

drgeoff
Posts: 8487
Joined: Wed Jan 25, 2012 6:39 pm

Re: It *has* to happen!

Mon Feb 12, 2018 10:49 pm

hippy wrote:
Mon Feb 12, 2018 10:41 pm
drgeoff wrote:
Mon Feb 12, 2018 9:37 pm
if you have 2 RPis the chance of both having the same MAC is 1 in 16777216.
I'm not sure that's correct because my understanding is that addresses are chosen at random, that not all 16777216 combinations will have been used before some of those are reused.

Like a 16777216 sided dice rolled every time a new Pi comes off the line.
If you have a 6 sided dice the chance of any two rolls (no matter how many other rolls between them) being the same is 1 in 6. Same probability theory applies to your 2"24 sided dice in the RPi factory.

User avatar
davidcoton
Posts: 3160
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: It *has* to happen!

Mon Feb 12, 2018 11:51 pm

davidcoton wrote:
Mon Feb 12, 2018 6:42 pm
4096 if my memory of the theory is right (and I wouldn't like to caculate the chances of that).

(sqare root of 2^12=2^6=4096)

And while we are about it, the Y2K project I was involved with trawled our code for ANY date dependency. I found one for 2024. As it happens a few days after my (then) scheduled retirement date. The bug was documented but not fixed at that time.
I've since left that company, but I wonder whether the code will still be in use when the bug strikes. And if anyone remembered to read the documentation about the bug.
jahboater wrote:2^6 is 64
:oops: I must stop posting on Mondays. And probably any other time...
Not only did I miscalculate 2^6, but the answer is not the square root of the number of possible MACs.And the number of possible MACs is not 2^12.
Refer to the birthday problem article on Wikipedia linked above. I can't copy the typography of the maths here!
Enough to say that with 2^24 possible MACs you need a pool of 4823 (or possibly 4824) Pis to have a greater than 50% chance of two MACs being identical. (If my maths is right this time :roll: )
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

slugh
Posts: 2
Joined: Mon Nov 05, 2012 1:03 pm

Re: It *has* to happen!

Tue Feb 13, 2018 2:24 am

Actually, it doesn't have to happen at all. The MAC address is made up of two parts, the OUI and the serial number. The OUI is assigned by IEEE and the serial number is assigned by the manufacturer. There are 16 million serial numbers per OUI; however, there is nothing that prevents an organization from owning more than one OUI. Manufacturers are supposed to use nearly all of their address space before requesting a new OUI and they are not supposed to use the new OUI until all of their addresses on the old one are used. Re-using serial numbers is discouraged but it seems there are allegations that it has been done by various organizations either by accident or on purpose. If Raspberry Pi's do leave the factory with duplicate MAC addresses then it could have happened sooner than the 16 millionth device. Pi's with a wireless interface will require at least two MAC addresses...

User avatar
RaTTuS
Posts: 10081
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: It *has* to happen!

Tue Feb 13, 2018 8:39 am

I think it is 4824 before you have > 50% chance of having 2 with the same address
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

drgeoff
Posts: 8487
Joined: Wed Jan 25, 2012 6:39 pm

Re: It *has* to happen!

Tue Feb 13, 2018 10:57 am

RaTTuS wrote:
Tue Feb 13, 2018 8:39 am
I think it is 4824 before you have > 50% chance of having 2 with the same address
if you have n RPis the number of possible pairs is n(n-1)/2.

Each pair has a probability of 1 in 2^24 of having the same MAC.

So for a 50% probability of one pair with both MACs the same you need (2^24)/2 pairs

Putting n(n-1)/2 = (2^24)/2

The 2s cancel leaving

n(n-1) = 2^24

and we see where the square root approximation comes from when n is large (ie n is almost the same as n-1)

Rearranging to the standard quadratic form n^2 - n - 2^24 = 0

Solving exactly gives n = (-(-1) +/- ((-1)^2 - (4 * 1 * -(2^24)))^0.5)/(2 * 1)

For the positive n = (1 + (1 + 2^26)^0.5)/2

= 4096.50003052

(The square root approximation 4096 is quite accurate in this case.)

User avatar
Imperf3kt
Posts: 1303
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia

Re: It *has* to happen!

Tue Feb 13, 2018 11:12 am

So if you buy 5000 Pi0s, you have a greater than 50% chance that at least two of them have the same MAC address?
User experiencing technical difficulties.

User avatar
RaTTuS
Posts: 10081
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: It *has* to happen!

Tue Feb 13, 2018 11:21 am

Imperf3kt wrote:
Tue Feb 13, 2018 11:12 am
So if you buy 5000 Pi0s, you have a greater than 50% chance that at least two of them have the same MAC address?
yes ;-p
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

drgeoff
Posts: 8487
Joined: Wed Jan 25, 2012 6:39 pm

Re: It *has* to happen!

Tue Feb 13, 2018 11:55 am

Imperf3kt wrote:
Tue Feb 13, 2018 11:12 am
So if you buy 5000 Pi0s, you have a greater than 50% chance that at least two of them have the same MAC address?
Yes, that is what probability theory says if the MAC addresses are assigned randomly from the entire pool of 2^24 possibles, ie with no regard for ones that have already been used.

2^24 is in the same ballpark as the number of MAC addresses on RPis manufactured to date. If the MACs were assigned systematically in sequence and then rolled over to start again when all 2^24 had been used, you could have purchased all 16 million approx of the first lot and have 0% chance of two being the same. However if you then also purchased any number, even only another 1, after that you would have 100% chance of two the same.

When things are not random, but have some "order" in an unknown or impossible to model way, probability theory becomes less useful or even no use at all.

mikerr
Posts: 2718
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: It *has* to happen!

Tue Feb 13, 2018 12:44 pm

Mythic-beasts who have racks of pi for hosting, just replied to me saying all their Pi are on individual VLANs :
Every Pi3 has it's own network segment - one Pi3, one VLAN. So we're not worried about MAC collisions.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
davidcoton
Posts: 3160
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: It *has* to happen!

Tue Feb 13, 2018 10:17 pm

drgeoff wrote:
Tue Feb 13, 2018 10:57 am
RaTTuS wrote:
Tue Feb 13, 2018 8:39 am
I think it is 4824 before you have > 50% chance of having 2 with the same address
if you have n RPis the number of possible pairs is n(n-1)/2.

Each pair has a probability of 1 in 2^24 of having the same MAC.

So for a 50% probability of one pair with both MACs the same you need (2^24)/2 pairs

Putting n(n-1)/2 = (2^24)/2

The 2s cancel leaving

n(n-1) = 2^24

and we see where the square root approximation comes from when n is large (ie n is almost the same as n-1)

Rearranging to the standard quadratic form n^2 - n - 2^24 = 0

Solving exactly gives n = (-(-1) +/- ((-1)^2 - (4 * 1 * -(2^24)))^0.5)/(2 * 1)

For the positive n = (1 + (1 + 2^26)^0.5)/2

= 4096.50003052

(The square root approximation 4096 is quite accurate in this case.)
@drgeoff, that is I think where my original (miscalculated) square root approximation came from. But did you look at the maths in https://en.wikipedia.org/wiki/Birthday_problem?
The problem is that the probabilities are not independent, and modelling them differently gives a different result. I can no longer visualise such problems well enough to work out which approach is right and which is wrong, and why (if I ever could :roll:). But I think the difference is that there is a certain probability of having more than one pair in a set, which increases the possibility of no matches and therefore reduces the probability of having one or more. The effect is that the pool size has to be noticably larger than the square root of the number of possible MACs.
"Thanks for saving my life." See https://www.raspberrypi.org/forums/viewtopic.php?p=1327656#p1327656
“Raspberry Pi is a trademark of the Raspberry Pi Foundation”

Return to “Off topic discussion”

Who is online

Users browsing this forum: No registered users and 3 guests