Multicast IPv4 address to MAC address mapping
We have learned about Class D multicast IPv4 addresses in last lesson. In this lesson, we will learn about multicast IPv4 address (Class D address) to IPv4 multicast MAC address mapping. We have learned that Class D multicast IPv4 addresses ranging from 224.0.0.0 to 239.255.255.255 are reserved as IPv4 multicast addresses.
I strongly suggest you to visit and learn below lessons before reading further about multicast IPv4 address (Class D address) to IPv4 multicast MAC address mapping.
- What is Multicast, What is Broadcast
- Binary Decimal and Hexadecimal numbers and conversions
- Five layered TCP/IP model
- Network Layer (Layer 3)
- TCP/IP Data Encapsulation and Decapsulation
- Datalink Layer (Layer 2)
- Ethernet Frame Format
- What is MAC address or Layer 2 address or physical address
- IPv4 Protocol, IPv4 header and fields of IPv4 header
- IPv4 addresses, IPv4 Address Classes, IPv4 Address Classifications
- What is Subnet Mask
- What is network address
- Limited broadcast address
- Directed broadcast address
- What is limited broadcast in IPv4 and how limited broadcast works
- What is directed broadcast in IPv4 and how directed broadcast works
- Class D multicast IP addresses
- What is multicast
- What is multicast group
- Advantages and disadvantages of multicast
Why we need multicast IPv4 address to multicast MAC address mapping
When a unicast data packet is sent to the network, the layer 3 (network layer) IPv4 datagram is encapsulated within layer 2 (datalink layer) frame. Address information at IPv4 datagram is source and destination IPv4 addresses, but the address information at layer 2 frame is source and destination MAC addresses.
When an IPv4 datagram are sent as unicast, the Ethernet frame which is encapsulating the IPv4 datagram contains sender and receiver MAC addresses as the source and destination MAC addresses respectively. Usually the destination MAC address for unicast type of network traffic is the burned-in MAC address of the receiving computer’s network interface. But the multicast traffic is sent to a group of computers. So, the destination MAC address of multicast traffic cannot be the burned-in MAC address of the network interface of an individual computer. Hence, there should be some mapping between IPv4 multicast addresses and IPv4 multicast MAC addresses.
To undestand the concept of multicast IPv4 address to MAC address mapping more clearly, consider following scenario. A local server is sending multicast traffic to multicast group 239.10.10.10. Two computers with IPv4 addresses 192.168.10.100 and 192.168.10.103 are interested in receiving multicast traffic sent to multicast group 239.10.10.10. Both computer’s network interface has their own burned-in MAC addresses. But, if the server sends two packets of same data with destination MAC addresses as the MAC addresses of two computers, it is not multicast but unicast.
You can see that from below image, server is sending multicast packets with destination layer 3 multicast address as 239.10.10.10 and destination layer 2 multicast address as 01:00:5e:0a:0a:0a.
Here in multicast, the local multicast server and two clients must agree on a common destination MAC address. When the server sends the multicast traffic to a multicast group with a destination layer 3 address as Class D multicast IPv4 address, it should use destination layer 2 address as a related (mapped) multicast MAC address. Similarly, if the multicast client is interested in receiving multicast traffic from a multicast group, then it should derive the multicast MAC address mapped to that multicast group’s IPv4 address and start accepting the multicast Ethernet frames sent to the mapped multicast MAC address at layer 2.
For example; If the multicast server is sending the multicast data packets to multicast group 239.10.10.10, then the multicast server should use destination layer 3 address as Class D multicast IPv4 address 239.10.10.10 and destination layer 2 multicast MAC address as 01:00:5e:0a:0a:0a. If the multicast client is interested in receiving multicast traffic sent to multicast group 239.10.10.10, then the client computer’s network interface must accept Ethernet frames with destination MAC address as 01:00:5e:0a:0a:0a at layer 2 and pass it to upper layer (layer 3) for further processing.
In this lesson we will learn how multicast IPv4 address 239.10.10.10 is mapped to multicast MAC address 01:00:5e:0a:0a:0a. The wireshark capture screenshot of the example multicast packet described above is copied below.
How multicast IPv4 address to multicast MAC address mapping is done
Refer following image, which shows the general structure of a multicast MAC address. As you can see from below image, the right-most bit in the first octet (the least-significant bit in the most-significant octet) has been reserved as "1" for broadcast MAC address or IPv4 multicast MAC addresses. Please note that the broadcast MAC address ff:ff:ff:ff:ff:ff has also the multicast bit reserverd as "1". The broadcast MAC address ff:ff:ff:ff:ff:ff is considered as a type of multicast MAC address.
The left-most 24 bits of an IPv4 multicast MAC address are reserved as "01:00:5e". Also note that the the 25th bit is reserved as "0". Please note that I am using the term IPv4 multicast MAC address, because MAC addresses used for IPv6 multicast are different.
Please refer following image.
As we can see from the above image 25 (24+1) bits out of 48-bits of a multicast MAC address from the left are used as multicast prefix (24-bits) and 1-bit reservation.
We have 23-bits (48-25 = 23) remaining in the IPv4 multicast MAC address and those 23 bits are mapped to IPv4 multicast addresses. Please refer following image.
Examples of IPv4 multicast addresses to MAC address mapping
Example 1 - IPv4 multicast address 224.0.0.5 to MAC address mapping
Now, lets see a real example of IPv4 multicast addresses to IPv4 multicast MAC address mapping. Let us take an example of link-local multicast address 224.0.0.5.
Please refer below image. The binary equivalant of 224.0.0.5 is shown in the top row. You can see from the below image that first four bits of left-most octet of 224.0.0.5 are IPv4 class D prefix ("1110"). The information in the next five bits are lost, because those five bits are not mapped anywhere. Last 23-bits of of 224.0.0.5 are then mapped to IPv4 multicast MAC address, which is shown in bottom row.
Can you guess what will be the resulting IPv4 multicast MAC address of 224.0.0.5? The IPv4 multicast MAC address for IPv4 multicast addresses 224.0.0.5 is 01:00:5e:00:00:05.
Following image shows a capture of ICMP packet (ping command) with a destination IPv4 address as Class D multicast IPv4 addresses 224.0.0.5. The corresponding multicast MAC address in the capture shows that it is indeed 01:00:5e:00:00:05.
Example 2 - IPv4 multicast address 224.0.0.10 to MAC address mapping
Lets take another example of IPv4 multicast addresses to IPv4 multicast MAC address mapping for link-local multicast address 224.0.0.10.
Please refer below image. The binary equivalant of 224.0.0.10 is shown in the top row. You can see from the below image that first four bits of left-most octet of 224.0.0.10 are IPv4 class D prefix ("1110"). The information in the next five bits are lost, because those five bits are not mapped anywhere. Last 23-bits of of 224.0.0.10 are then mapped to IPv4 multicast MAC address, which is shown in bottom row.
What will be the mapped multicast MAC address in this case? The IPv4 multicast MAC address for IPv4 multicast addresses 224.0.0.10 is 01:00:5e:00:00:0a. Let us check whether the predicted multicast MAC address is correct or not, by capturing ICMP packets to IPv4 multicast address 224.0.0.10.
Please refer below capture screenshot image.
Example 3 - IPv4 multicast address 239.10.10.10 to MAC address mapping
Lets take another example of IPv4 multicast addresses to IPv4 multicast MAC address mapping for administratively scoped multicast address 239.10.10.10.
Please refer below image. The binary equivalant of 239.10.10.10 is shown in the top row. You can see from the below image that first four bits of left-most octet of 239.10.10.10 are IPv4 class D prefix ("1110"). The information in the next five bits are lost, because those five bits are not mapped anywhere. Last 23-bits of of 239.10.10.10 are then mapped to IPv4 multicast MAC address, which is shown in bottom row.
What will be the mapped multicast MAC address in this case? The IPv4 multicast MAC address for IPv4 multicast addresses 239.10.10.10 is 01:00:5e:0a:0a:0a. Let us check whether the predicted multicast MAC address is correct or not, by capturing ICMP packets to IPv4 multicast address 239.10.10.10.
Please refer below capture screenshot image.