I have found multicast networking to be horrible. It sounds simple, but testing your own ad-hoc multicast applications can be mysterious. I think part of the problem can be with hidden state. The switches and routers in the network store state associated with multicast group IP addresses. This can cause tests to behave differently depending on the order they are run. Sometimes a multicast transmission will work in one direction, but not another.
Some IP address ranges in the multicast range appear to behave differently.
- This group address has usually worked for me.
- This group address is used in Python examples, mcast.py script, but it does not always work for me.
- Reserved as Site-Local Scope, but this did not work.
IP address range
Multicast IP addresses are in the range 18.104.22.168/4, or 22.214.171.124 through 126.96.36.199. All multicast IP addresses start with the bits 0b1110 (0x0E).
Many IP addresses in this range are reserved by the IANA. For example, 188.8.131.52 is reserved for OSPF, and 184.108.40.206 is reserved for DHCP. It is best to check with the IANA IPv4 Multicast Address Space Registry list before experimenting with some random multicast IP address. Other address are not official, but are used by convention by some popular packages. For example, the JBoss AutoDiscoveryAddress is 220.127.116.11 (even though the IANA has this listed as Unusable Locally, so I'm not sure why JBoss uses this address by default. Perhaps I misunderstood the IANA documentation).
For experimentation you probably want to pick addresses in the ranges 18.104.22.168 to 22.214.171.124 (Organization-Local Scope) and 126.96.36.199 to 188.8.131.52 (Site-Local Scope). Start with the Site-Local Scope. These are defined in reserved as Administratively Scoped IP multicast addresses. See RFC 2365.
You can also limit the scope of your multicast packets by setting a short TTL in the packet. A setting of 1 or 2 is good for most local network experiments. This way you limit the range your bad packets will be seen.
MAC address range
Ethernet frames can also be specified as multicast. These frames will have the destination MAC address will have a the least significant bit set in the first octet. For example, 01-80-C2-00-00-00.