As of my knowledge each MAC address is unique for each device like servers, computers, firewalls, switches and routers, proxies, etc. So my question is: who is responsible for allocating these MAC addresses to the device manufacturers?
The IEEE assigns MAC address blocks to manufacturers.
The IEEE assigns the leftmost (most significant) digits. The IEEE can assign blocks of different sizes depending on the manufacturer's needs:
- MA-L (formerly called OUI): Leftmost 24 bits
- MA-M: Leftmost 28 bits
- MA-S: Leftmost 36 bits
The rest of the bits are assigned by the manufacturer.
Thanks to @jcaron for pointing this out.
As of my knowledge each MAC address is unique for each device like servers, computers, firewalls, switches and routers, proxies, etc.
That's not necessarily true. A MAC address only needs to be unique within a single Layer 2 broadcast domain. It is perfectly fine if two devices in two different broadcast domains have the same MAC address. This implies also that it is perfectly fine if devices in completely different networks have the same MAC address, e.g. an Ethernet device, a Bluetooth device, and a FireWire device.
The reason we usually say that MAC addresses are unique worldwide is that making them unique worldwide is an easy way of guaranteeing that they are unique within a broadcast domain. Otherwise, you would always have to be very careful when e.g. moving from WiFi to another WiFi, or when unplugging a device from one network and plugging it in a different one.
So my question is: who is responsible for allocating these MAC addresses to the device manufacturers?
First off, we need to distinguish between Universally Administered Addresses and Locally Administered Addresses.
The second-least-significant bit of the first octet of an Ethernet MAC address is the U/L bit:
xxxxxx0x-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx ↑ Universally Administered xxxxxx1x-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx ↑ Locally Administered
Only if this bit is 0 is the vendor responsible for making sure the Ethernet MAC address is unique. If this bit is 1, then the local network administrator is responsible for the uniqueness of the address.
The next bit also has a special meaning, it distinguishes between an Individual Address that identifies a single node and a Group Address that addresses a group of multiple nodes. It is called the I/G bit:
xxxxxxx0-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx ↑ Individual xxxxxxx1-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx-xxxxxxxx ↑ Group
So, a Universally Administered Address for an Individual node will look like this:
That means there are 46 bits left to create a unique address. These 46 bits are split into two parts: the Organizationally Unique Identifier and the Device Identifier. OUIs are managed by the IEEE. For a small fee, an organization can register an OUI with the IEEE, and then this OUI is "owned" by that organization. No other organization is allowed to generate MAC addresses with this OUI.
This means the IEEE is responsible for making sure that OUIs are unique, and each individual organization is responsible for making sure that Device IDs within the OUI are unique. In other words: uniqueness of MAC addresses is guaranteed the same way that uniqueness of telephone numbers, Internet Domain Names, Internet Mail addresses, IP addresses, etc. is guaranteed: by having a single global registry (the ITU for phone numbers, IANA for IP addresses, etc.) that splits the address space into disjoint non-overlapping segments and then delegates the responsibility for managing those segments to one organization for each segment.
The explicit goal that the IEEE has set itself is that MAC addresses should be globally and temporally unique for at least 100 years.
A OUI is 24 bits long with 22 usable bits (see above), meaning there can be up to ~4.2 million organizations. (However, a couple of OUIs are reserved for things like IEEE-internal use, Functional Addresses, etc.)
I only talked about MAC addresses until now, but technically, the IEEE only ever talks about Extended Unique Identifiers, more precisely, the IEEE talks about EUI-48 and EUI-64. These EUIs can be used for purposes other than MAC addresses, hence why the IEEE avoids using that name.
EUI-48 are 48 bits long, which means that for each of the ~4.2 million OUIs, there are ~16.7 million Device IDs. EUI-64 are 64 bits long, which means that for each OUI, there are ~70 billion Device IDs.
Ethernet, WiFi, Token Ring, Token Bus, and many other older networking protocols use EUI-48 MAC addresses. All newer protocols, e.g. FireWire, Infiniband, and the entire IEEE 802.15.4 family (ZigBee, 6LoWPAN, Thread, SNAP, etc.) use EUI-64 addresses. The Layer 2 address field in the IPv6 header also allows for 64 bits for better interoperability with such protocols. The IEEE heavily discourages use of EUI-48 MAC addresses for the development of new protocols, because they fear an address shortage similar to the one with IPv4.
And if that wasn't confusing enough, there are actually three different registries for EUI-48s, they are called
- MAC Address Large (MA-L)
- MAC Address Medium (MA-M)
- MAC Address Small (MA-S)
What I described above is actually only the MA-L registry. The MA-M registry assigns a 28 bit ID to an organization, allowing it to generate up to ~1 million Device IDs, and the MA-S registry assigns a 36 bit ID to an organization, allowing it to generate 4096 Device IDs.
Note, however, that the IDs assigned to organizations using the MA-M and MA-S are not OUIs. An OUI actually allows an organization to generate both EUI-48s as well as EUI-64s, and is also used in a couple of other places in the IEEE. Whereas an ID assigned from the MA-M or MA-S registries only allows you to generate EUI-48s from that registry.
The IEEE makes sure that the upper 24 bits of an MA-M or MA-S ID do not correspond to a valid OUI; these OUIs are reserved for internal use by the IEEE.
However, all of this is only as good as the processes and humans that execute those processes. I know of at least two cases where those processes failed.
In one case, a vendor of cheap network chips decided to reuse MAC addresses on different continents, thinking nobody would ever plug a Chinese and an African network card into the same network. As it so happened, a Chinese and an African exchange student at a German university happened to be roommates in a student dorm, and caused the network team a lot of head scratching, until they realized that their computers did have the same MAC address.
In another case, all the people who were normally in charge of assigning MAC addresses at a small manufacturer of specialized networked devices, were on parental leave, sick leave, vacation, and sabbatical, at the same time, and the person filling in for them had not been properly trained in the usage of the system. As a result, ~40 devices with the same MAC address were built. And since they were built at the same time, they sat in the warehouse in the same stack, so when a larger order came in, one customer was shipped 12 devices with identical MAC addresses, which caused them a lot of fun. The problem was quickly fixed with a firmware update that contains a table of the affected serial numbers and the new MAC addresses, and patches the MAC address at bootup.