As it is the case with any network communication, you will  always have at least one sender and at least one receiver. With multicast, this is also the case – however the process of determining the actual receivers, works slightly different. The difference lies in how the Layer3 to Layer2 mapping is actually achieved.

You should already be familiar with ARP which does exactly that: maps Layer3 unicast addresses, to Layer2 MAC addresses. Now, think how would ARP work with Multicast!

As an example, let’s imagine that a multicast enabled router receives an IP packet with the destination IP address 224.1.1.1. So the router would then send a ARP request, expecting a MAC address in the reply – “Who has the IP address of 224.1.1.1?” – or not!?

Based on RFC 1812 …

rfc1812-mcast

A multicast receiver, will listen on a specific “frequency”; this “frequency” here is the actual Layer2 (MAC address). So the key question is:

Since ARP won’t work, how does the network devices determine the MAC address they would be listening to?

To solve this problem, IANA has assigned a range of MAC addresses (01-00-5E  /25) which should be used for this Layer3 to Layer2 mapping. Within this MAC address, 25 bits will be static, while the rest of 23 bits will be determined from the multicast IP address.

Let’s take a look at a few examples:



Example 1: Determining multicast MAC address from multicast IP Address 224.1.1.1


IP Addr: 224111
Explanation: The first byte has no bearing in determining the mcast MAC addressIt doesn't matter what the 1st bit is; only the last 7 bits will be used!All bits are mapped to the MAC address byteAll bits are mapped to the MAC address byte
MAC Addr: 01-00-5EHex: 01
Binary: 0000 0001
Hex: 01Hex: 01


Example 2: Determining multicast MAC address from multicast IP Address 224.129.1.1


IP Addr: 22412911
Explanation: The first byte has no bearing in determining the mcast MAC addressIt doesn't matter what the 1st bit is; only the last 7 bits will be used!All bits are mapped to the MAC address byteAll bits are mapped to the MAC address byte
MAC Addr: 01-00-5EHex: 01
Binary: 1000 0001
Hex: 01Hex: 01


Example 3: Determining multicast MAC address from multicast IP Address 239.1.1.1


Determining mcast MAC address from 239.129.1.1
IP Addr: 239111
Explanation: The first byte has no bearing in determining the mcast MAC addressIt doesn't matter what the 1st bit is; only the last 7 bits will be used!All bits are mapped to the MAC address byteAll bits are mapped to the MAC address byte
MAC Addr: 01-00-5EHex: 01
Binary: 0000 0001
Hex: 01Hex: 01


Problem solved! Or not … Did you notice that we could have more than one multicast IP mapping to the same multicast MAC?? I hope you did!

How many? In a multicast address, only 28 bits are available since the first 4 bits define the actual multicast range; on the other side, IANA only allows for the last 23 to be used for mapping – the difference is 5 bits – so, 25 addresses will result in the same MAC address!!

How do we assign the multicast IPs, making sure the resulting MAC will always be different and yet, without doing all the binary calculations?? This is easy as well! The difference between any two numbers where the 8th bit is zero (o) or one (1), is 128!! For example, binary 00100001 is decimal 33; binary 10100001 is decimal 161 (33 + 128) !! But this bit, is the one that doesn’t matter since IANA’s assigned MAC will always consider that bit as zero! So we just need to make sure we follow either one of the following two rules:

1. The difference between the 2nd byte (starting from left, to right) must not be 128
2. Make sure the 3rd and 4th bytes (starting from left, to right) are different

 Let’s finish off with few examples:

  • The following two Mcast IPs will give the same Mcast MAC address
    • IPs: 224.4.5.1 vs. 239.132.5.1 | MAC: 01-00-5E-04-05-01)
  • Making sure the Mcast MAC is different:
    • IPs: 224.4.5.1 vs. 239.4.5.2 | MAC: 01-00-5E-04-05-01 vs. 01-00-5E-04-05-02
    • IPs: 224.4.5.1 vs. 239.133.5.1 | MAC: 01-00-5E-04-05-01 vs. 01-00-5E-05-05-02

 


Thank you,
Signature
View Rafael A Couto Cabral's profile on LinkedIn



Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>