Multicast Routing For Efficient Multi-Media Streaming
Celebrity Childbirths and MulticastLinuxPlanet Classics: Multicast routing is very useful for streaming media, so let's follow Charlie Schluting on a tour of this excellent protocol as we continue the wonderful Networking 101 series.
Multicast is more efficient than broadcast, because broadcast packets have to be received by everyone on the local link. Each OS takes an interrupt, and passes the packet on for inspection, which normally involves some data copies. In multicast, the network card doesn't listen to these multicast packets unless it has been told to do so.
By default, with multicast-enabled network cards, the NIC will listen to only 22.214.171.124 at boot. This is the address assigned to "all systems on this subnet." Yes, that's very similar to broadcast. In fact, many people say that broadcast is a special case of multicast.
Multicast is selective in who it sends to, simply by nature of how network cards can ignore uninteresting things. This is how the local link works, but how about the Internet? If someone wants to stream the birth of a celebrity's baby in Africa via multicast, we don't want every router on the Internet consume the bandwidth required to deliver it to each computer. Aside from the NIC being able to make decisions locally, there are multicast routing mechanisms that serve to "prune" certain subnets. If nobody wants to see it within your network, there's no reason to let it travel into the network.People who are interested in seeing such a spectacle will run a special program, which in turn tells the NIC to join a multicast group. The NIC uses the Internet Group Management Protocol (IGMP) to alert local multicast routers that it'd like to join a specific group. This only works one-way, though. If someone wants to send and receive multicast, the IP layer will need to be fancier. For sending, IP will map an IP address to an Ethernet address, and tell the NIC driver so that it can configure the card with another MAC address.
IGMP itself is very simple. It's very similar to ICMP, because it uses the IP layer, only with a different protocol number. The header consists of only four things: a version; a type; a checksum; and the group, i.e. multicast address, to be joined. When that packet is sent, a multicast router now knows that at least one host in interested in receiving packets for a specific multicast address. Now that router must somehow do multicast routing with other routers to get the data.
Here it gets interesting. There are a few multicast routing mechanisms that we'll talk about today: DVMRP and PIM. Pausing for just a moment, it's important to realize that even today multicast isn't widely supported. Back in the day there was a mbone, or multicast backbone, that people connected to via IPIP (IP encapsulated in IP) tunnels. The Unix application mrouted understood DVMRP and IGMP when the Internet routers did not. Most people who wish to use multicast nowadays still find themselves asking their ISPs why certain protocols aren't working.