IPv6 Link Local Addresses – 64 or 48-bit MAC Addresses?

In last week’s Chit Chat Across the Pond, I asked Bart to come during his off season to explain IPv6 to us. After the show aired, Kevin Jones DM’d me on Twitter and DJ made a comment on the blog, both with the same correction. One of the rules of this episode was that Bart only had a few days to learn the background himself so it was expected there might be errors. As always though, Bart is weird in that he actually likes to be corrected. Seriously,

Anyway, they were both commenting on this statement:

In IPv6, the host part is always 64bits long. This is conveniently the length of a MAC address.

They both explained that MAC addresses as we are used to seeing them, are 48 bits, not 64 bits.

Now this is going to sound a bit like explaining the tax code but I hope you’ll bear with me because there are a couple of parts here I think are interesting. First of all, Bart wasn’t technically wrong, but DJ and Kevin are more specifically correct.

Because Bart and I are nerds, we decided to work out the answer, and actually “do the math” and see if they’re right that MAC addresses are 48 bits not 64 bits. Bart first had to explain to me what bits were. I know I should already know this and I explained to him that he’s just the next in a long line of people attempting to get it to stick in my brain, but he said he was determined to get me to understand. Spoiler, he succeeded.

He explained bit by talking through flipping of a coin. A coin has heads and tails, so two possible outcomes. Same thing with bits, they’re 1 or 0 so two possible outcomes with one bit. But what if we have 2 coins (or bits). We have 4 options: HH, HT, TH, or TT. What about 3 coins or bits? It turns out the answer is 2 to the power of however many of them you have. So 3 coins is 2 raised to the power of 3. 4 coins? 2 raised to 4. The formula is 2 raised to the x.

Now that we can calculate how many bits we have where there’s only 1s and 0s. What about this MAC address thing? As Bart explained last week, MAC addresses have 12 digits, where each digit can be 0-9 and a-f. That’s 16 possible outcomes for each digit. That means the number of possible outcomes is 16 raised to the power of 12.

Al does logsStill with me? The next part is my favorite part of the story.

To figure out how many bits are in a MAC address, the equation becomes 2 to the x = 16 to the 12. You know how you can multiply or divide both sides of an equation and it’s still true? Turns out you can take the logarithm of both sides and it’s still true.

So our equation because log 2 to the x = log 16 to the 12. Another cool thing about logarithms is you can tear that exponent inside the log, and off and shove it down in front of the log. So now we have x log 2 = 12 log 16. Dividing both sides by log 2, we get x = 12 log 16 divided by log 2. Calculator (or Excel) tells us x = 48!

Before we rejoice in Kevin and DJ being right about 48 bits, let’s for just a moment revel in the fact that I pulled logarithms out of the very dustiest parts of my brain. I have seriously not taken a single log since I graduated from engineering school 37 years ago! I’m seriously amazed that I not only knew how to do a log, but that I knew instantly that they could solve this kind of tough problem. I have been marching around all full of myself all week because of this. I ran in and told Steve, I called both Lindsay and Kyle, I even called my brother in Boston to tell him. Very proud of my little self.

Back at the beginning of this story, I said that Bart was right but that DJ and Kevin were more right. The problem lies in nomenclature. What we’re used to seeing as a MAC address, 12 digits with 16 possible values for each one, is called a MAC-48 identifier. Makes sense, since we know now that it has 48 bits. But the specs have been updated by the IEEE consortium. The old MAC-48 is now called EUI-48, but they also have EUI-64 as a way of expressing a MAC address.

This is where it starts to get really fuzzy. That logarithm stuff was the easy part. The Wikipedia article on MAC addresses explains:

To convert a MAC-48 into an EUI-64, copy the OUI, append the two octets FF-FF and then copy the organization-specified extension identifier. To convert an EUI-48 into an EUI-64, the same process is used, but the sequence inserted is FF-FE. In both cases, the process can be trivially reversed when necessary.

Oh good grief, what the heck is an OUI? That’s the Organizationally unique identifier, a 24-bit number that uniquely identifies a vendor, manufacturer, or other organization. Uh, great. That’s a big help.

By this time in the discussion, I was completely lost. Bart and I dug further and found that in addition to all that, you have to toggle two digits, but we found conflicting information on which two digits you’re supposed to toggle. DJ gave us to a link to a handy dandy tool courtesy of a Netherlands site to convert MAC addresses to IPv6 link local addresses: sput.nl/…. But get this, their explanation about what to toggle and what to prepend was different from what Wikipedia said. And to make it more entertaining, we tried checking the equivalent IPv6 link local addresses of our Ethernet cards using the command ifconfig en0, and what we got looked nothing like what the sput.nl link spit out.

I’d like to leave you with my favorite quote out everything we read:

IPv6 — one of the most prominent standards that uses a Modified EUI-64 — treats MAC-48 as EUI-48 instead (as it is chosen from the same address pool) and toggles the U/L bit (as this makes it easier to type locally assigned IPv6 addresses based on the Modified EUI-64). This results in extending MAC addresses (such as IEEE 802 MAC address) to Modified EUI-64 using only FF-FE (and never FF-FF) and with the U/L bit inverted.

I’m really glad I could clear this up for you. But aren’t you proud of me using logarithms?

1 thought on “IPv6 Link Local Addresses – 64 or 48-bit MAC Addresses?

  1. Timothy McCoy - February 20, 2017

    Yeah, thanks.

Leave a Reply

Your email address will not be published.

Scroll to top