Question

I am creating an application which uses semi-random numbers to roll on a table. The random numbers are generated from wireless network MAC Addressess, so they should be consistent across multiple devices (i.e. if I go to a wireless network with 2 different devices, I should generate the same random number).

My question is if there are any patterns that wireless network MACs are predisposed towards, that will affect my number generation, or if they are entirely random. It's important because it will affect the probabilities I assign to table values.

This is the image i pulled from Wikipedia that I am having some trouble understanding.

MAC Address composition from wikipedia

So based on this diagram, does this mean that the first 3 bytes of a MAC Address will be unique across router brands? If I run into two D-Link routers will that be the same? Or if it's two D-Link routers of the same model will it be the same?

And then are the last 3 bytes just randomly generated numbers? Thanks to anyone who takes the time to help me figure this out.

Was it helpful?

Solution

An OUI part with the 0x020000 bit cleared ("globally unique") is an assigned number from a registry. Every manufacturer of a wireless device applies for at least one of them, and uses it in the products they build. There is no requirement that a manufacturer have only one, or that they use different ones depending on who the end-producer of the equipment is. Thus, for example, many Dell laptops have MAC addresses that begin with Intel OUIs, because the laptops are built with Intel wireless chips.

For these MAC addresses, the NIC part has no specified value, but is usually assigned in monotonically-increasing values from pre-divided blocks during manufacture. Thus two Intel wireless chips rolling off the same assembly line will likely have numbers separated by 1.

An OUI part with the 0x020000 bit set ("locally administered") can have any other bits set, depending entirely on what the system it is attached to sets the address to.

OTHER TIPS

Yes, the first 3 bytes of MAC addresses are usually not random at all, they are assigned to a particular corporation. (Some companies have more than 1 assignment). The last 3 bytes are also not "random" because sometimes they are assigned sequentially. Unless it was a really popular router, the high bits could be constant.

Also, a MAC address can be changed on most cards. And there are different types of MAC addresses, such as "link local" and "multicast".

If you want randomness, use /dev/random or whatever your OS supplies.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top