Route My World!

A CCNA/CCNP/CCIE Blog

IP Multicast to MAC Address Mapping

Posted by Aragoen Celtdra on March 4th, 2009

Map Multicast MAC address to IP Multicast Addresses

In the course of reading through the BSCI authorize self-study guide, I’ve come across a multicast example where the author talks about the concepts behind the multicast IP to MAC address mapping.

  • In order to achieve the translation between a Layer 3 IP multicast address and Layer 2 multicast MAC address, the low-order 23 bits of the IP address (Layer 3) is mapped into the low-order 23 bits of the MAC address (Layer 2).
  • The high order 4 bits of the Layer 3 IP address is fixed to 1110 to indicate the Class D address space between 224.0.0.0 through 239.255.255.255
    • Ethernet MAC addresses start with 01:00:5E, allowing for a range from 01:00:5E:00:00:00 through 01:00:5E:7F:FF:FF.
  • With 32 total bits present in an IP address and 4 high order bits of it set at 1110, we are left with 28 bits of unique IP addresses we can use (32 - 4 = 28).
  • But remember, 23 low-order bits out of the 28 available bits are mapped to the MAC address, giving us 5 remaining bits of overlap.
  • With the 5 bits of extra overlap, there are  32 (25 = 32) IP multicast address that map to one MAC multicast address.

The problem is, the book does not explain or show how it solved the mapping. So I went about researching how it was done. If you happened to be studying for BSCI, I am referring to the section of the BSCI: Authorized Self-Study Guide, by Teare and Paquet, that starts on page 598 – 600.

The following is an example of how we arrive with those 32 IP addresses that map to a single MAC address:

For reference, use the following conversion chart for converting hex to binary and vice versa
hexconverttable

Let’s start by using the example MAC address given in the book :

01:00:5e:0a:00:01

  1. Convert the hexadecimal MAC address 01:00:5e:0a:00:01 to binary
    • 0000 0001 : 0000 0000 : 0101 1110 : 0000 1010 : 0000 0000 : 0000 001
    • Here’s a breakdown of the conversion bit by bit:
      hex-bin
  2. Isolate the 23 low-order binary bits from the converted MAC address:
    • 0000 0001 : 0000 0000 : 0101 1110 : 0000 1010 : 0000 0000 : 0000 0001
  3. Take the low order 23 bits from step 2 and plug it into the low-order 23 bits of the IP address (do this in binary):
    • 1110 xxxx : x000 1010 : 0000 0000 : 0000 0000
      • 1110 -  First 4 high-order bits of the IP address for the multicast address space (224.x.x.x).
      • xxxx x - 5 remaining bits after the 23bits of the IP address is mapped to the MAC address plus the 4 high order bits 1110. This is equal to 32 total IP addresses.
  4. Convert the binary equivalent of the IP addresses to decimal, replacing the x variables with all the values to get all 32 possible IP addresses:
    • 11100000 : 0000 1010 : 0000 0000 : 0000 0001= 224.10.0.1
    • 11100001 : 0000 1010 : 0000 0000 : 0000 0001= 225.10.0.1
    • 11100010 : 0000 1010 : 0000 0000 : 0000 0001= 226.10.0.1
    • 11100011 : 0000 1010 : 0000 0000 : 0000 0001= 227.10.0.1
    • 11100100 : 0000 1010 : 0000 0000 : 0000 0001= 228.10.0.1
    • 11100101 : 0000 1010 : 0000 0000 : 0000 0001= 229.10.0.1
    • 11100110 : 0000 1010 : 0000 0000 : 0000 0001= 230.10.0.1
    • 1110 0111 : 0000 1010 : 0000 0000 : 0000 0001= 231.10.0.1
    • 11101000 : 0000 1010 : 0000 0000 : 0000 0001= 232.10.0.1
    • 11101001 : 0000 1010 : 0000 0000 : 0000 0001= 233.10.0.1
    • 11101010 : 0000 1010 : 0000 0000 : 0000 0001= 234.10.0.1
    • 11101011 : 0000 1010 : 0000 0000 : 0000 0001= 235.10.0.1
    • 11101100 : 0000 1010 : 0000 0000 : 0000 0001= 236.10.0.1
    • 11101101 : 0000 1010 : 0000 0000 : 0000 0001= 237.10.0.1
    • 11101110 : 0000 1010 : 0000 0000 : 0000 0001= 238.10.0.1
    • 11101111 : 0000 1010 : 0000 0000 : 0000 0001= 239.10.0.1
    • 11100000 : 1000 1010 : 0000 0000 : 0000 0001= 224.138.0.1
    • 11100001 : 1000 1010 : 0000 0000 : 0000 0001= 225.138.0.1
    • 11100010 : 1000 1010 : 0000 0000 : 0000 0001= 226.138.0.1
    • 11100011 : 1000 1010 : 0000 0000 : 0000 0001= 227.138.0.1
    • 11100100 : 1000 1010 : 0000 0000 : 0000 0001= 228.138.0.1
    • 11100101 : 1000 1010 : 0000 0000 : 0000 0001= 229.138.0.1
    • 11100110 : 1000 1010 : 0000 0000 : 0000 0001= 230.138.0.1
    • 11100111 : 1000 1010 : 0000 0000 : 0000 0001= 231.138.0.1
    • 11101000 : 1000 1010 : 0000 0000 : 0000 0001= 232.138.0.1
    • 11101001 : 1000 1010 : 0000 0000 : 0000 0001= 233.138.0.1
    • 11101010 : 1000 1010 : 0000 0000 : 0000 0001= 234.138.0.1
    • 11101011 : 1000 1010 : 0000 0000 : 0000 0001= 235.138.0.1
    • 11101100 : 1000 1010 : 0000 0000 : 0000 0001= 236.138.0.1
    • 11101101 : 1000 1010 : 0000 0000 : 0000 0001= 237.138.0.1
    • 11101110 : 1000 1010 : 0000 0000 : 0000 0001= 238.138.0.1
    • 11101111 : 1000 1010 : 0000 0000 : 0000 0001= 239.138.0.1
  5. All the 32 IP addresses on step 4 map to MAC address 01:00:5e:0a:00:01

Convert IP Multicast Address to Multicast MAC Address

Conversely, a multicast IP address can be converted to its equivalent MAC address. Once you’ve figured out how to convert from Layer 2 MAC to Layer 3 IP, doing the reverse is easy.

To start, we can pick any address from the 32 IP addresses we converted above. Let’s pick a random one like 227.138.0.1

  1. First convert the address 227.138.0.1 to binary:
    • 11100011 : 10001010 : 00000000 : 00000001
    • We’re only concerned with the red colored portion which represents the low-order 23bits of the IP address.
    • Notice that we are dropping the high order bit of the second octet.
  2. Convert those 23 bits to hexadecimal:
    • 0A:00:01
  3. We already know that the first 3-bytes (24 bits) of the MAC address is 01:00:5E. This was established earlier in the article. Simply append the result on step 2 to the first 3-bytes and you have your MAC address:
    • 01:00:5E:0A:00:01
    • *You can pick any of the 32 Ip addresses we have on the list above and you will always get 01:00:5E:0A:00:01 as your MAC address following the steps just mentioned.

To summarize:

  • 1st octet – Notice that the first octet is left alone.
  • 2nd octet – You only need to convert the last 7 bits to hex. The second octet in decimal is 138. But if you drop the highest order bit, it becomes a decimal 10 or hex 0A.
  • 3rd octet – Convert it directly to hex.
  • 4th octet – Convert it directly to hex.

28 Responses to “IP Multicast to MAC Address Mapping”

  1. KhawarNo Gravatar Says:

    Love you man…. It dissolved my frustration. Many Thanks. Have a BSCI test scheduled tommorrow.

  2. BorderNo Gravatar Says:

    How to solve more multicast ip mapping to one MAC Address?

  3. donaghNo Gravatar Says:

    great explanation. was doing my head in. searched many different websites and they ended up confusing me even more. thanks….

  4. HoyerNo Gravatar Says:

    Thank you, this is an premium list I’m fresh to all this but want to frame-up my first web log shortly so I think on publishing this out and adding it to my boxfile.

  5. hwNo Gravatar Says:

    THANK YOU!!!!  This was a huge help.  Finally, I’m able to fully understand this subject with your clear explanation.  I hate how the book just leaves the reader hangin.

  6. ByramNo Gravatar Says:

    I dont usually reply to posts but in this case. WoW!!

  7. LaxmanNo Gravatar Says:

    hi Aragoen Celtdra,
    Thank you very much for this article. this is really easy to understand, I had great confusion with this topic but now I am clear about it.

    thanks again

  8. AdnanNo Gravatar Says:

    Great post, thanks heaps.
    Could you please also clarify why is the “25th” bit (from left to right) in mulicast MAC address always zero?
    Thanks

  9. MARIA Says:

    Hello there I like your blog

  10. MikeNo Gravatar Says:

    Thanks alot, Finally a clear explanation.

  11. JatinNo Gravatar Says:

    Thank you. Crisp,clear,precise information i required.

  12. gregor@switchNo Gravatar Says:

    Does my mac adresse change if I upgrade my computer with some other hardware? For example change the graphic card?

  13. skiNo Gravatar Says:

    Hi dude!

    Thank you for your explanation, now its clear how multicast MAC-to-IP conversion works. There will be no problem on the BSCI exam :))

    Ciao!

  14. MarkNo Gravatar Says:

    A clear and easily understood example. Thanks for the assistance. Now to pass BSCI before 31st July 2010!

  15. RodNo Gravatar Says:

    Hello,

    Nice explanation but a couple of things:

    1) This is wrong (you made a typo)
    1110 0000 : 1000 1010 : 0000 0000 : 0000 0001 = 224.10.0.1

    It should be
    1110 0000 : 1000 1010 : 0000 0000 : 0000 0001 = 224.138.0.1

    2) (To the readers), the book assumes you went over the CCNA and assumes you know how to do (bin/dec/hex) to (bin/dec/hex) conversions plus you know the meaning of *high order* and *low order* bits. My advice, if you can’t explain these two assumptions to a non tech guy go learn them until you can. There will be more cases when you need to understand these concepts very well (IPv6 comes to mind).

    With that assumption the book explanation/example should be sufficient to allow you to draw a similar recipe as Aragoen did. It might force you to take sometime to think about it but that’s exactly the goal of the book in this case.

    3) Now why do we reduce a perfectly normal 24 bits space, for the MAC conversion it would make a perfect map to the last 3 IP octets, to a 23bits space and replace the 24th bit with a 0? Doesn’t seem to make much sense does it?

    By replacing that 24th bit to 0 we are splitting the 2nd octet into one of two possibilities. Either will be a constant difference from 0 or 128, so it’s easy to do a quick conversion:

    e.g.
    if the 2nd octet is 18 the “higher twin” octet, that will be mapped to the same MAC, will be 128+18=146
    if the 2nd octet is 178 the “lower twin” octet, that will be mapped to the same MAC, will be 178-128=50

    4) The “lost” 1st octet makes sense since after applying the OUI in the construction of the MAC address we only have 24bits left, but it’s interesting as the last 4 bits of the OUI map to the first 4 bits of the Multicast IP address (1110) :)

    Hex 53 = 0101 (1110)
    IP 224 = (1110) 0000

  16. vaibhavNo Gravatar Says:

    Beautifully explained …..
    :)

  17. adnaneNo Gravatar Says:

    thanks for sharing ,, nice staff … god bless

  18. corseNo Gravatar Says:

    thank you, this is really helpful!

  19. SaiNo Gravatar Says:

    Thanks..Its crystal clear!!

  20. Brendan ChoiNo Gravatar Says:

    Great article! As mentioned above, this should be corrected

    11100000 : 1000 1010 : 0000 0000 : 0000 0001= 224.138.0.1

     

  21. sidneyNo Gravatar Says:

    Thanks man. This article cleared a lot of doubts. Wish cisco was more granular in their documentation. Good job.

  22. CCIE 350-001 Written IGMP and PIM | ciscoguyne Says:

    [...] Answer: C,E Explanation: Do the math. http://routemyworld.com/2009/03/04/ip-multicast-to-mac-address-mapping/ [...]

  23. JideNo Gravatar Says:

    Still the best explanation ever and am CCIE certified for over then years and I got it for the first time.  Awesome.

    Got anything on IPV6 to share?

  24. DhivyaNo Gravatar Says:

    Awesome… You are so brainy… :)

  25. hasanNo Gravatar Says:

    wow cant thank u enuf 

  26. GonzalexNo Gravatar Says:

    This explanation is great. However, you may find the one below, complementary!
    http://blogbt.net/index.php/2013/05/mapping-multicast-l3-to-l2-addresses/

  27. sapana Says:

    http://blogbt.net/index.php/2013/05/mapping-multicast-l3-to-l2-addresses/
    it”s much better and explain problem of duplicating tha MAC address.

  28. Andreas' Blog » Blog Archive » Multicast IP/MAC-Address Mapping Says:

    […] Microsoft TechNet: Mapping IP Multicast to MAC-Layer Multicast Map Multicast MAC address to IP Multicast Addresses […]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>