What is Multicast
Networks allow a host to send a packet to a single receiver (unicast) or all receivers (broadcast). On the other hand, multicast is a computer network routing scheme where data is sent from the sender in a single transmission and delivered to an entire group of receivers. The application layer or the network handles the simultaneous delivery.
The main goal of multicast is to conserve network bandwidth. It is widely used today in enterprises, commercial stock exchanges, and multimedia content delivery networks. The most common use of IP multicast is IPTV applications for television distribution and conference calls over the network.
Let's look at the following example to see the differences between different network routing schemas. We have a network server that streams video to multiple hosts. Two hosts, (H1 and H2) are in the local network. The other two hosts (H3 and H4) are in the remote network, connected through two routers.
First, we have unicast routing, where the server has a separate stream for each of the four hosts, so it uses four times the bandwidth of a single stream to the local router. Two separate streams are sent to the two remote hosts using two times the bandwidth of a single stream. Unicast routing struggles to scale to large numbers of hosts, because each host needs its own, individual stream.
Next, we have broadcast routing. In broadcast routing, the server has only one stream, which the network forwards to all local hosts without waiting for them to request the stream. Broadcast traffic is not forwarded by the routers to other networks.
Broadcast routing reduces the bandwidth load on the server and network, but makes unnecessary traffic in the local network and cannot be forwarded to other networks.
Lastly, we have multicast routing. In multicast routing, the server has only one stream which the network forwards to hosts which have requested it. Multicast routing is efficient and reduces the load on the server and network in general. However, the network must be configured to support it and its underlying protocols.
Ethernet Multicast
In ethernet multicast, IPv4 multicast packets are encapsulated into Ethernet frames where the first octet of the destination MAC address is 01
or, more specifically, the least-significant bit of the first octet is equal to 1
. These Ethernet frames are sent to all devices on the local network.
This mechanism is used to achieve one-to-many transmission for IP multicast at the data link layer on the Ethernet networks. This also sends frames to devices that are not a part of the multicast group, however, the network cards of the destination devices filter the incoming packets and only fully receive the packet if the transmission is in the table of multicast destination addresses. This reduces the load on computer resources used for packet processing.
After the first octet with the value 01
follows the octet with the value of 00
and another octet with the value 5E
. Those three octets provide the prefix for multicast over Ethernet. the lower 23 bits of the 28-bit multicast IP address are mapped into the lower 23 bits of the three remaining octets available in the MAC address and so we get the following multicast Ethernet MAC address range 01:00:5E:00:00:00 through 01:00:5E:7F:FF:FF.
Because only the lower 23 bits of the multicast IP address are mapped to the multicast MAC address, there is ambiguity in delivering packets when two hosts in the same subnetwork subscribe to different multicast groups that differ in the first 5 bits of the multicast IP address (for example the following two multicast IP addresses 224.1.1.1 and 225.1.1.1 map to the same multicast MAC address 01:00:5e:01:01:01). In this case packets from both multicast groups will be delivered to both host, requiring the hosts to discard the unrequired packets.
IPv6 multicast addresses use the logical OR operation to map the four lowest octets to the MAC address 33:33:00:00:00:00. If the local network switch supports multicast addresses, it sends packets to the designated multicast group.
Switches that support multicast addresses use the Internet Group Management Protocol (IGMP) to determine where to send traffic. Through IGMP snooping, the switch listens to IGMP traffic and maintains a state table. The state table describes which hosts are subscribed to a given multicast group. Based on this information, the switch can forward traffic only to the hosts subscribed to the appropriate multicast group.
When the network switch doesn’t support multicast addresses, it sends the packets to all of the hosts in the local network, and the hosts discard packets directed to multicast groups that they are not subscribed to. So even though the hosts receive the packet, they don’t use it.
IP Multicast
Internet Protocol (IP) multicast enables multicast routing on the network layer. It requires a source to send a packet only once, even if that packet needs to be delivered to many receivers, which reduces the load on network infrastructure. The source does not require prior knowledge of what or how many receivers there are because network nodes replicate the packet to reach multiple receivers only when necessary.
Destination nodes use IGMP to join or leave multicast groups that receive data from the source. Multicast groups are determined with IP addresses from a specific sub-network (224.0.0.0/4 for IPv4 or ff00::/8 for IPv6).
By default, IP multicast is available on local networks. However, IP multicast requires multicast routing, usually using the Protocol Independent Multicast (PIM), to span multiple networks. IP multicast requires such protocols to find the shortest loop-free path from a source host that sends data to multiple receivers. The network nodes close to the receivers build a multicast tree to send data, and the source doesn’t need to know anything about the tree or receivers.
PIM has the following implementations: Sparse Mode (SM), Dense Mode (DM), Source-Specific Multicast (SSM), and Bidirectional (Bidir) or Sparse-Dense Mode (SDM).
There are two main approaches to multicast distribution trees:
- A Source Tree has its root at the source, and branches through the network to the receivers.
- A Group Shared Tree has its source placed at a common root at some point in the network that multiple sources can use. Branches from that root form a spanning tree through to the network receivers.
The User Datagram Protocol (UDP) is the most commonly used protocol that uses multicast addressing. However, UDP is unreliable because it lacks packet loss detection and retransmission. More reliable multicast protocols such as Pragmatic General Multicast (PGM) offer these features.
Routing Multicast groups use several different protocols to route traffic. In order to receive data sent to a particular multicast address, a system must join the multicast group through IGMP. Adjacent routers use IGMP to communicate.
In multicast routing, the source address acts as the upstream destination of multicast traffic. Routers use the source address to determine the downstream destination for a given multicast group, then send multicast traffic there. This kind of routing, where packets are routed away from the source rather than towards a destination, is called Reverse-Path forwarding.
In general, multicast delivery on a local IPv4 network is controlled by IGMP. IPv6 networks use Multicast Listener Discovery (MLD). Inside a routing domain, PIM or Multicast Open Shortest Path First (MOSPF) are used. Between domains, the Multicast Border Gateway Protocol (MBGP) is used.
Security
Multicasts use a combination of protocols and encryption to secure packets. In multicasts, the sender can encrypt the multicast packet and send it through the network. The packet may be replicated at optimal locations in the network and delivered to all receivers. Receivers decrypt the packets to extract the data. Because the sender doesn’t know all of the potential receivers, the sender encrypts packets using a shared key that receivers can use to decrypt the packet.
The Group Domain of Interpretation (GDOI) protocol allows the sender and receiver to join a key server that encrypts policies and keys and distributes them to members of the secure multicast group. The key server authenticates senders and receivers, then authorizes them to use the shared key.
Reliability
Multicast uses many extension protocols to increase reliability, such as:
- Pragmatic General Multicast (PGM)
- NACK-Oriented Reliable Multicast (NORM)
- File Delivery over Unidirectional Transport (FLUTE)
- Scalable Reliable Multicast (SRM)
- Secure Multicast for Advanced Repeating of Television (SMART)
These protocols allow error detection and error recovery, which UDP usually lacks.
Application layer multicast
The multicast overlay services on the application layer are not based on the IP or Ethernet multicast, but instead use multiple unicast transmissions to simulate a multicast. For example, Internet Relay Chat (IRC) uses a single spanning tree across its overlay network for all conference groups.
Explicit multi-unicast (Xcast) includes all destination addresses within each packet and has a limit on the maximum number of destinations.