3

I posted this on StackOverflow and was told it might be more appropriate here.

I'm having trouble understanding how multicast addresses work.

First off, is it true that if I have N clients or peers working on separate networks, they all subscribe to the same multicast group, and this group allows any source to send messages, these peers/hosts can all communicate to each other through this group? (sounds like black magic!)

Second, I've heard hints that the IANA controls/regulates the multicast addresses. So do you have to request / ask IANA for a specific multicast address for your project / company? How does this work? Am I mistaken? Can you clarify multicast networking for me?

Thanks much!

Josh G
  • 133
  • 3

2 Answers2

5

Yes, your understanding is true to some extent. In theory it works like this: your application binds to a multicast address, the operating system gets this and subscribes the computer in the multicast group. When other computers send packets to that address, they arrive at your computer until all applications unbind from that address and the operating system removes the computer from the multicast group.

The magic is a combination of IGMP and PIM. IGMP is used between the OS and the nearest router, it allows the OS to tell the router that it is entering or leaving a multicast group, and that it is interested in receiving packets for that address. PIM is used between routers to discover and exchange multicast group data, and to find and reach all subscribers of multicast groups when packets addressed to that group are transmitted.

IANA regulates multicast address (as well as almost everything else in the Internet). If you want to use multicast on the Internet, you need a multicast address allocation just like you do with unicast addresses:

If you want to use multicast in your local network, without routing to the outside Internet, you have administratively scoped ranges for private use defined in RFC 2365. The address range is 239.192.0.0/14.

Juliano
  • 5,402
  • 27
  • 28
3

Multicast works like you think, except that the switches along the network all have to "understand" what the clients want. This means it's only useful for private networks, and you don't need to involve IANA. This also means you need to setup your switches for multicast to work correctly; if you only have one switch, or one switch stack, this is usually fairly easy. If you have multiple stacks, and especially if you have different brands, this can become quite complicated.

Chris S
  • 77,337
  • 11
  • 120
  • 212
  • So multicast does not "just work" like unicast routing does? Each hop along the way has to be configured to handle it? – Josh G Apr 11 '11 at 13:06
  • How does this apply to audio/video streaming that is becoming a popular multicasting application? Don't they multicast to the public internet/network? – Josh G Apr 11 '11 at 13:07
  • Most streaming sites do not use multicast in any way, it's all unicast. Most use multiple sites and connect you to the closest logical site. Some provider networks do make use of multicast, but it's pretty limited. It's a chicken & egg problem, the hardware doesn't support it very well because it isn't widely used, it's not widely used because you can't even come close to relying on hardware support. – Chris S Apr 11 '11 at 13:19
  • Yes, I've heard some of this before. Isn't this all going to change with IPv6? From my understanding, multicast support will be required and broadcasts will be a specific subset of multicasts (the local link address). – Josh G Apr 11 '11 at 13:21
  • IPv6 requires mutlicast support just as much as IPv4 did; switches and routers that don't support multicast group protocols (typically IGMP and PIM, though there are others) still wont work right. IPv6 doesn't have a broadcast concept, but Ethernet still does. The problem is that Ethernet never had a multicast concept (and still doesn't) so it needs to be grafted in (ala the above group protocols); but still isn't required. Ethernet only has directed (unicast in IP terms) and undirected (broadcast) concepts. IP has unicast, multicast and broadcast(IPv4 only); plus anycast and geocast with BGP. – Chris S Apr 11 '11 at 13:26
  • In the answer, I suggest you to replace "switches" with "routers". There IS multicast in the link-layer level, even Ethernet has support for multicast (bit 0 of the first octet of the destination MAC address denotes multicast) although most switches equates multicast to broadcast. Josh certainly is asking for network-layer level multicast, thus switches are irrelevant, the routers play the important role here. – Juliano Apr 11 '11 at 14:32
  • 1
    @Juliano, In my experience most cheap SOHO switches don't support multicast in any way, shape, or form. I'm sure some exist where they support multicast as broadcast; but the only place I've seen switches work correctly is where they support IGMP directly or through snooping. Most higher end switches blur the distinction between switch and router... – Chris S Apr 11 '11 at 15:14
  • @Chris, even the cheapest SOHO switches have to support link-layer multicast, even if by degrading it to broadcast. This is mandatory, and very simple to implement, it is a prerequisite to broadcast implementation, actually. If you have a switch that implements broadcast but doesn't support multicast in any form, you have a utterly broken device. In fact, such a switch would break mDNS (Bounjour/Zeroconf/Avahi), which is used on Mac OS X and Linux. – Juliano Apr 11 '11 at 16:29
  • @Juliano so what about expensive cisco switches? Will they associate multicast-ips with multicast macs and behave accordingly, or will they just broadcast? – Nils Nov 09 '11 at 20:28
  • @Nils, I don't know all Cisco switches to make a reliable statement, but most certainly the answer is No. Multicast IPs and Multicast MACs are separate things, it is the operating system job in hosts and routers to create and assign Multicast MACs to alleviate the load in the link-layer when Multicast IP is being used. – Juliano Nov 10 '11 at 16:54
  • So coming back to "replace switches with routers" - this is true as long we talk about mutlicast IP. So on the other hand - if I use a multicast IP on a switched environment I could give it a try and associate the multicast IP with a multicast MAC on the server side... – Nils Nov 10 '11 at 21:29