How to choose a multicast address for the application’s use


How should I choose an IPv4 multicast address for my application's use? I may need more than one (a whole range perhaps ultimately) but just want to avoid conflicts with other applications.

  • Packets will be entirely contained within an administrative domain, probably a LAN
  • If several independent instances of my application are in use on the same network, they could each use their own multicast address – but if they don't, they will be able to coexist anyway, they'll just have a small amount of overhead ignoring each others' packets.
  • My packets already contain a "magic number" to avoid problems
  • I will be checking the originator address (which I know can be spoofed of course), TTL and other things to try to prevent unexpected packets mucking things up.

Ideas please 🙂

Currently I've just allocated an arbitrary one from the "local use" space,

Best Solution

It seems you've already found, so you've done the right thing by picking an address from the 239.255/16 range.

As those ranges are entirely for site-local use it's no ones else's business which particular address you pick, but you may need to coordinate with the network manager (assuming that's not you) to pick an alternate address pool.

As others have suggested, just make sure there's an easy way to change the address just in case it does conflict with another address on the local LAN.

If the multiple applications issue becomes a problem, provide a (locally) well-known multicast address which the applications can talk to which will issue unique local-scope IP addresses for clients' use.

Related Question