What is IP Multicasting? -IP multicasting allows a host to send a single packet to thousands of hosts across a routed network i.e. The Internet.
It is used mainly for audio (radio) and video distribution.
In Networking a packet can be sent to:
- A single host –Unicast = (TCP and UDP)
- All hosts -Broadcast – (UDP only)
- A group of hosts – Multicast -(UDP only)
Broadcasts vs Multicasts
Multicasting is different from IP broadcasting as:
- Broadcasting uses a single IP address. Host bits set to all 1’s. There are a range of multicast addresses
- Broadcast messages are not sent through routers but multicast messages are.
- All hosts will receive broadcasts by default
- A host must be configured to receive multicast messages.
IPv4 Multicast addresses use the reserved class D address range:
184.108.40.206 through 220.127.116.11
The addresses range between 18.104.22.168 and 22.214.171.124 is reserved for use by routing and maintenance protocols inside a network.
These addresses aren’t forwarded by routers. Many of the multicast addresses are reserved see Muticast Space Registry
How Multicasting Works
On a small home or office network any host can send and receive multicast datagrams.
Note: multicast uses UDP and are sent through switches and hubs.
To receive a multicast message a host must be configured to receive on that multicast address.
All hosts that are configured to receive packets on a particular address are part of a multicast group.
A host that is configured to receive datagrams sent to a multicast address becomes part of a multicast group for that address.
A group can have 1 to an unlimited number of hosts. Neither hosts or routers maintain a list of individual group members.
A host can be part of multiple multicast groups and can send to multiple multicast addresses.
A host can send datagrams to a multicast group address even though there are no members of that group, and a host doesn’t need to be a member of a group to send multicast datagrams to that group.
Note: Multicast packets are sent through switches.
Multicast On the Internet
On the Internet multicast packets need to be forwarded by routers.
A router will determine if any of the hosts on a locally attached network are configured to receive multicast datagrams using IGMP( Internet Group Management Protocol).
Routers will listen for IGMP messages and periodically send queries on the local subnet. using the multicast group address 126.96.36.199 (Reserved All hosts address).
Multicast routers do not keep track of which hosts are part of a group, but only need to know if any hosts on that subnet are part of a group.
If a router receives a multicast datagram from another network and has no members for that group address on any of it’s subnets it drops the packet.
Viewing Multicast Packets
On a typical home network there are a variety of protocols that use multicast.
The SSDP (Simple Service Discovery Protocol) uses multicast address 188.8.131.52 on UDP port 1900.
Here is a screen shot from running tcpdump on a raspberry pi.
If you are new to tcpdump then see this tcpdump tutorial
MultiCasting and MQTT-SN
The MQTT-SN protocol uses multi casting for broker/gateway discovery.
- IP4 Addresses and address classes
- IP6 Guide
- Understanding TCP/IP ports and sockets
- TCP vs UDP -What’s The Difference?