What is Multicast?
In an IPv4 network, there are three types of packets:
- Unicast One-to-One host communication.
- Broadcast A broadcast message is sent from one hoste to all hosts in the current subnet. Routers will, by definition, not forward broadcast messages
- Multicast Here is where things get interesting. Multicast traffic is sent from one host to a specific group of receivers. (Cheap) Switches will forward multicast on all ports. Routers will not forward multicast packets by default.
In order to keep everything simple, the IPv6 specification excludes any type of
broadcast in favor of an
all ipv6 devices well known multicast group.
The main usecase for multicast is the distribution of the same data to many clients. This applies to: Streaming services, VoIP or LAN Chat apps.
In order to receive multicast packets, a host must first join a multicast group. This can either be done statically or dynamically. Most of the time, traffic is sent from the server to a group of clients (Rare cases exist where the client sends back a multicast packet).
While Multicast works out of the box in most networks, the challenge is shaping the traffic, so that _only hosts in the multicast group receive the data.
Multicast IPv4 addresses are a Class D network. There are serveral well known multicast ranges:
22.214.171.124: Reserved for routing and other network protocols such as OSPF, RIP, HSRP, etc
126.96.36.199: Reserved for “public use. Can be used publicly on the Internet. Many addresses in this range have been reserved for specific applications
188.8.131.52.: Reserved for “private” use. Will not be routed on the internet
The most important IPv4 Multicast addresses are
||All hosts on this subnet|
||All routers on this subnet|
Old Format: | 8 Bits | 4 Bits | 4 Bits | 112 Bits | | ------ | ------ | ------ | -------- | | prefix | flags | scope | group id | New Format: | 8 Bits | 4 Bits | 4 Bits | 4 Bits | 4 Bits | 8 Bits | 64 Bits | 32 Bits | |--------|--------|--------|--------|----------|--------|----------------|----------| | prefix | ff1 | scope | ff2 | reserved | plen | network prefix | group ID |
The most important IPv6 Multicast addresses are
||All link-local devices|
||All link-local routers|
To convert a Multicast IP Address to a MAC address, we use the
To complete the MAC, the last 23 bits of the MC address are used.
Decimal: 224 . 65 . 130 . 195 Binary: 11100000.01000001.10000010.11000011 Hex: 0100.5e Binary: 0000000100000000.01011110.0 Combined: 0000000100000000.0101111001000001.1000001011000011 Hex: 0100.5e41.82c3
Because only the last 23 bits are used, every Multicast MAC can match 32 Multicast IP Addresses.
Multicast routing has to be explicitly enabled
Switch(config)# ip multicast-routing
Multicast routing protocols make sure that only the correct clients receive the data.
There are several multicast routing protocols available:
- Protocol Independend Multicast (PIM)
- Multicast OSPF (MOSPF)
- Distance Vector Multicast Routing Protocol (DVMRP)
- Core-Based Trees (CBT)
|---| |+++| Multicast Server |---| | | <- Upstream | _ / \ | | Router \_/ | | <- Downstream | | |---| |+++| Client |---|
Reverse Path Forwarding
To guarantee a loop free multicast environment, switches perform an RPF check on incoming multicast traffic. Whenever a multicast packet arrives, the router looks up the source address in its unicast routing table. If the incoming interface matches the outgoing interface of the routing table, the traffic is forwarded.
When the RPF Check succeds the router still has to know where to send the traffic to. This is where Multicast Forwarding Trees come into play. They controll the flow of multicast traffic inside the network and exist on a per-group basis.
Source trees are the most basic forwarding trees. Their root is the multicast source and they branch to reach every client. Because they use the shortest path, they are also called shortest path tree (SPT).
Shared trees utilize a so called Rendezvous Point (RP). Multicast traffic is always sent toward the RP using a source tree. The RP then builds a seperate source tree towards the receivers. At first glance, this just sounds like extra overhead so why even use Shared Trees?
In a network with many sources and destination, every router has to build their own tree when using source trees. This is very processor heavy and might be too much for small access layer devices. With shared trees, only the route to the rendezvous point has to be stored. The RP is usually a strong device, capable of handling the entire multicas traffic of the network.
Protocol indepenedt Multicast is a so called Multicast routing protocol. Although the name suggests tht is indepenedt of any other protocol, PIM strongly depends on the unicast routing table. PIM is also responsible for creating the multicast tree, and “pruning” the tree so that no traffic is sent unnecessarily down a link.
PIM can operate in multiple modes:
- Dense Mode (
- Sparse Mode (
- Sparse-Dense Mode (Cisco proprietary,
Dense mode relies on flooding the network with multicast traffic. All downstream routers recieve the multicast packet until it times out. To minimize traffic, routers send a pruning message upstream when:
- The RPF Check fails
- A leaf router (has clients directly attached to it) has no receivers
- A non leaf router recieves a prune message from all its neighbours
Dense mode is most usefull when:
- Senders and receivers are in close proximity to another
- Few senders - many receivers
- Much multicast traffic
- Constant stream of traffic
Dense mode is not the method of choice for enterprise and service providers because of its scalability and flooding properties.
Spares mode is based on the assumptions that the multicast group members are sparsely distributed throughout the network and that bandwith is limited
Sparse mode multicast traffic is first directed to a RP. After traffic starts flowing, the routers in the path optimize it to remove unnecessary hops.
Following methods are available to automate the distribution of the RP:
- Bootstrap router (BSR)
Auto-RP utilizes a seperate Router called the RP Mapping agent. All candidate RPs announce their availability every minute to 184.108.40.206 (Cisco-RP-announce). The mapping agent then sends out the Group-to-RP mappings to 220.127.116.11 (Cisco-RP-discovery) and will continue to do so every 60 seconds.
BSR is only available in PIMv2. The BSR sends out special BSR Packets with a TTL of 1. This packet is flooded by all receivers. If there are multiple BSR candidates available, the BSR with the higher priority wins. Downstream routers advertise their group ranges to the BSR which then continuously floods the new information through the domain