How Multicast Works
The sender (data source) sends packets to a multicast address (which doesn't identify the recipient, but a group), the source address is its normal unicast address. On routers, the packet is then sent in all directions where there is a recipient (packet duplication is performed). Between routers, multicast packets are transmitted using a multicast routing protocol (most commonly) PIM. This creates a distribution tree through the network and forwards packets. Recipients (stations) must register to a multicast group using the IGMP protocol. The packet flow is determined by the recipients, details depend on the routing protocol used (or the PIM protocol variant).
Multicast on Network Card
At the 2nd layer of the OSI model (L2), special multicast MAC addresses are used (which are created from multicast IP addresses). Just as a network card at the lowest layer checks incoming frames and sends only traffic intended for it (with its destination MAC address or broadcast traffic) to higher layers, it has support for multicast and, according to settings from higher layers, filters multicast and only forwards frames that are intended for the group that interests the client.
Multicast Within a Single Subnet - Switch
Within a regular switch, multicast behaves like broadcast, meaning all ports are flooded with it. Broadcast is actually a special case of multicast (recipients are all on the same subnet). For example, in IPv6, broadcast no longer exists, but link local multicast is used. Multicast is indeed sent everywhere within the broadcast domain. But thanks to the use of a destination IP address, the client can filter whether it wants to receive the packet based on it. Unlike broadcast, where the client has to look at the data content.
The reason why multicast behaves like broadcast in a given subnet, even when we want to deliver only to certain clients, is as follows. On a switch within L2 (ethernet frames), we can't determine which client (on which port) wants to receive the sent frame. For unicast, the destination MAC of the frame is the client's address and the switch knows it (has it in the CAM table), but this doesn't apply to multicast, where the destination MAC address is the group's address. For the switch to make better decisions, it must analyze all multicast traffic and compile a table of where to direct multicast based on join
and leave
messages. Cisco has a method called CGMP (Cisco Group Management Protocol), but today IGMP Snooping is mainly used.
Multicast Between Subnets - Router
On a router, more tasks are solved. The router must determine to which directly connected networks it should send multicast. Thus, it handles client registration to multicast groups. The IGMP protocol is used for this. The router periodically sends a query to the connected networks to the multicast address 224.0.0.1
, and stations respond (with various delays to avoid congestion) with information about which multicast group they want to receive (one message is sent for each group), to the group address (which they want to receive). After receiving the query, the host waits, and if it detects a response from another client for the same group it wants to receive within a given time, it doesn't send a response itself (this means they are on the same subnet, so that multicast traffic will reach it anyway). The SW on the stations must also support IGMP just like the router.
The second task of routers is optimal routing of multicast to remote networks. A minimal tree of connections is created, which is dynamically updated. Today, the PIM protocol is primarily used. When we imagine the situation, communication proceeds as follows: the server starts broadcasting some multicast traffic and it reaches the local router. On the other side (maybe even in another country via the internet) we have a client who wants to receive that traffic. It negotiates with its local router that it's a member of the given multicast group. And now the complex situation must be resolved to get the traffic from one router to another. Most often, one of two variants of the PIM protocol is used. Dense mode is based on the idea that almost everyone wants to receive the traffic, so it sends it in all directions (to all routers except the one it came from). If some neighboring router doesn't want the traffic, it must announce it. On the other hand, Sparse mode doesn't send traffic to any router that doesn't request it.
To prevent loops in multicast, a method called Reverse Path Forwarding (RPF) is used, the router receives multicast traffic only from directions from which there is a return path to the source of the broadcast (its IP address is in each packet).
Multicast Properties
- IP multicast - communication from one to several, efficient use of infrastructure
- based on multicast group addresses, multicast distribution tree, and client-driven tree creation
- sender uses the group address as the destination address, recipients use this address to inform the network that they want to receive this communication
- some content is associated with group 239.1.1.1, the sender sends data to this address, recipients join this group using the IGMP protocol
- if a group gets any members, a distribution tree is created for it, most often using the PIM protocol, which ensures that packets get from the sender to all recipients in the group
- the sender doesn't need to know about recipients, tree creation is initiated by active elements close to recipients or directly by recipients, the network arranges delivery to recipients
- multicast routers must know about all distribution trees that pass through them, but know nothing about others, they create a record for each tree, but only for the duration of the transmission, aggregation is not used
Multicast IP Addresses
Multicast address ranges:
- 224.0.0.0 to 224.0.0.255 - designated for network protocols within LAN, have TTL = 1, so they don't pass through a router
- 224.0.1.0 to 238.255.255.255 - are global multicast addresses used between organizations and over the internet
- 239.0.0.0 to 239.255.255.255 - is a limited range of addresses for use within an organization (LAN)
Some special addresses:
- 224.0.0.1 - all systems
- 224.0.0.2 - all local (on the same subnet) routers
- 224.0.0.5 - OSPF all routers
- 224.0.0.6 - OSPF DR and BDR routers
- 224.0.0.10 - EIGRP routers
IGMP - Internet Group Management Protocol
- used between client and active element (routers, switches)
- IGMP is used to register individual hosts to multicast groups
- multicast router sends membership query message (host query message) to discover which multicast groups have members on the connected network, this is sent to all using IP
224.0.0.1
with TTL = 1 - hosts respond with IGMP report message, which indicates they want to receive multicast packets for the given group
- designated router (designated querier) is used for multiaccess, for a subnet it's the only one who sends host query message, for IGMP version 1 it's chosen by multicast routing protocol, for version 2 and 3 it's the multicast router with the highest IP address, Point-to-point links don't display information about DR
- IGMP version 3 allows source filtering, so that a host can tell the router which sources it wants to receive
- IGMP leave messages are IP datagrams with destination address
224.0.0.2
, TTL 1
IGMP snooping
This is a protective/optimization mechanism for L2 switches. By default, multicast on a switch spreads like broadcast, i.e., to all ports except the incoming one. IGMP snooping ensures examination of multicast traffic and detection of join
and leave
messages. Based on this, it learns which port has a router and where clients are, and compiles a table according to which it forwards multicast only to those ports where the client requests this traffic. It also sends client responses only to the router and not to other clients. It dynamically configures ports for multicast reception.
Multicast MAC address
Multicast MAC always starts with 01.00.5e
- reserved part indicating multicast. Then we take the last 23 bits of the IP address, put 0
in front of it and convert to hex, this is the second part of the MAC. Example IP 228.10.10.7
and 229.138.10.7
can be represented by MAC 0100.5e0a.0a07
.
PIM - Protocol Independent Multicast
- used between local and remote multicast router for routing multicast from server to a number of clients
- it's a group of routing protocols that arrange one-to-many or many-to-many distribution over the internet
- uses classic routing protocols for routing
Rendezvous Point (RP) - meeting place for sources and recipients of multicast traffic (generally known place for both sides), it's a common root for shared trees, multicast sources send traffic to this point and it forwards it through shared trees to all group members, thanks to RP network resources are better utilized, but it doesn't guarantee optimal path
Sparse Mode - PIM-SM
Based on the idea that clients who want to receive multicast are very sparsely located in the network. So Sparse mode only sends traffic to routers that request it.
Uses unidirectional shared trees rooted at RP and can create shortest path trees for sources, requires Rendezvous Point (RP) on the network. Sources send multicast to directly connected routers (DR), DR (router with highest IP) encapsulates them and sends as unicast to RP, which sends them to multicast group members. RP announces sources and creates a path from source to group members, only then sends multicast datagrams.
Extended routing protocol for multicast. We use if other routers are different. Scales well. Router must join the group to receive traffic.
Dense Mode - PIM-DM
Dense mode is based on the idea that almost everyone wants to receive the traffic, so it sends it in all directions (to all routers except the one it came from). If some neighboring router doesn't want the traffic, it must announce it.
Creates shortest path tree, uses flood and prune method (first floods the domain with multicast and then prunes branches where there are no recipients). Interfaces are added to the multicast routing table on the router. Scales poorly, ideal for LANs where members are densely located in the network.
Sparse-Dense Mode - PIM-SDM
If we have a Rendezvous Point (RP), it works as PIM-SM, if not, it works as PIM-DM.
Bidirectional Mode - PIM-BM
Creates bidirectional shared trees, but never a shortest path tree, so it may have longer end-to-end distance, but scales well.
Source Specific Multicast - PIM-SSM
Creates trees that have roots only in one source. The sender's address is known and recipients register directly to the broadcast source.
Multicast Configuration in Cisco IOS
ROUTER(config)#ip multicast-routing // enables multicast on the router ROUTER(config)#ip pim sparse-mode // sets PIM mode ROUTER(config)#ip pim rp-address 10.10.10.1 // defines Rendezvous Point (RP) SWITCH(config)#ip igmp snooping // enables IGMP snooping for switch SWITCH(config)#ip igmp snooping vlan 100 // enables IGMP snooping for VLAN 100 ROUTER#show ip pim interface SWITCH#show ip igmp snooping SWITCH#show mac-address-table multicast ROUTER#clear ip mroute * // clears IP multicast routing table
Seznam multicast IP adres www.networksorcery.com/enp/protocol/ip/multicast.htm
respond to [1]Samuraj:
proč neodkázat rovnou dokument ze kterého byla tabulka vygenerována?
http://www.iana.org/assignments/multicast-addresses/
Jak je to s routováním multicastu v IPv6 oproti IPv4?? Obzvláště mě zajímá inter-domain routing, využívá se tam taky PIM protokol nebo je funkčnost nahrazena embedded Rendezvous Pointem v IPv6 multicast adrese?
Díky za článek. Velmi výstižný k pochopení!
Řeším teď jednu záhadu ohledně IPTV.
V původním zapojení CISCO ASR903--> trunkem do CISCO 3750 --> trunkem do OLT (GPON) mi data i IPTV funguje. Vše po 1Gbit.
Jakmile propojím CISCO ASR903(10Gbit kartu)--> trunkem OLT (GPON). Tak mi jdou poze DATA, ale IPTV nikoli.
netuším na co se zaměřit.
V podstatě jsem jen nahradil gigabit propoj za 10gbit a vynechal switch (3750).
Nenapadá mě, na co se zaměřit.....