MAC Address Mapping
A traditional Ethernet switch (Layer 2 device) works with Ethernet frames, and a traditional router (Layer 3 device) looks at packets to make decisions on how messages will be handled. As discussed in Chapter 1, when a device sends a broadcast frame, the destination address is all ones, and a unicast message is the destination MAC address. What happens when it is a multicast message? To optimize network resources, an Ethernet switch also needs to understand multicast. This is where the magic happens. The sending device must convert the destination IP multicast address into a special MAC address as follows:
The high-order 25 bits is the official reserved multicast MAC address range from 0100.5E00.0000 to 0100.5E7F.FFFF (request for Comment 1112). These bits are part of the organizational unit identifiers (OUI).
The lower-order 23 bits of the destination IP multicast address are mapped to the lower-order 23 bits of the MAC address.
The high-order 4 bits for the destination IP multicast address are set to 1110 binary (0b1110). This represents the Class D address range from 22.214.171.124 (0b11100000) to 126.96.36.199 (0b11101111).
Of the 48 bits used to represent the multicast MAC address, the high-order 25 bits are reserved as part of the OUI, and the last 23 bits of the multicast IP address are used as the low-order bits, as shown in Figure 2-4.
Figure 2-4 Layer 2 Multicast Address Format
A switch can use this calculated multicast MAC address to distinguish a frame as a multicast and make efficient forwarding decisions. End hosts can listen for frames with a specific multicast MAC, allowing them to process only those multicast streams to which they have subscribed. There’s a small wrinkle in this process, however.
Did you notice a slight challenge with the number of IP addresses and MAC addresses? Five bits of the IP address are overwritten by the OUI MAC address. This causes a 32-to-1 IP multicast address-to-multicast MAC address ambiguity (25 = 32).
This means that a host subscribing to a multicast stream could potentially receive multiple multicast streams that it did not subscribe to, and the host will have to discard the unwanted information. A host subscribing to the multicast stream of 188.8.131.52 would map to MAC address of 0x0100.5E40.0707, and so would 184.108.40.206 and 220.127.116.11. It all boils down to 1s and 0s. Figure 2-5 shows the ambiguity. The “X” in the binary row represents the bits that are overwritten and shows how 32 multicast IP addresses map to a single multicast MAC address.
Figure 2-5 Layer 2 Multicast MAC Address Overlap