A layer 3 address is configured by an administrator and uses a class D address. Some common examples of multicast addresses are as follows:
All systems on this subnetwork
All routers on this subnetwork
DHCP server/relay agent
All PIM routers
Router-to-switch like RGMP
The 220.127.116.11 to 18.104.22.168 address range is reserved for protocol use on a local network segment. None of these should ever be forwarded by a router and are sent out with a TTL of 1.
The 22.214.171.124 through 126.96.36.199 is the Globally Scoped Address range. This range is reserved for the multicasting of data between organizations on the internet. Some of these addresses are reserved, such as 188.8.131.52 for NTP (network time protocol) and 2184.108.40.206 and 220.127.116.11 for Auto-RP, which is a PIM sparse-mode mechanism.
The 18.104.22.168 through 22.214.171.124 range is known as the Limited (or Administratively) Scope Address range. These should be limited to use within an organization and should be filtered out by boundary routers.
The 126.96.36.199/8 range is reserved for GLOP addressing, which is a static reserved address based on AS number. The second and third octets are reserved for the AS number, while the fourth octet is for the actual multicast address. For instance, AS 32,574 is expressed in hex as 7F3E. Thus, their GLOP address would be 233.7f.3e.x, or 233.127.62.x.
A layer 2 address is automatically created based on the layer three address. To calculate this address, do the following:
The first 3 bytes of the multicast MAC are always set to 0x01:00:5e, or 00000001:00000000:01011110 in binary. The remaining 3 bytes are derived from the final 23 bits of the IP address, with a 0 cushioning the two sections. For instance, a multicast address of 188.8.131.52 would be represented as follows in binary:
The final 23 bits of this are:
The first half is always 00000001:00000000:01011110, so just prepend this, with a 0 to separate the two. The red is the standard identifier of a multicast MAC, the yellow is the pad, and the blue is the last 23 bits of the ip address.
Now simply convert that into hexadecimal. The easy way to do this, of course, is to break it up into 4 bit increments. The result is:
This is the layer 2 multicast mac address of 184.108.40.206, which itself is a layer 3 multicast IP address.
IGMP (Internet Group Messaging Protocol) is used by hosts to join and leave multicast groups. IGMP version 1 only supported the joining of groups, while IGMP version 2 supports leave messages as well. Routers use IGMP messages to keep track of which ports to forward multicast traffic to.
In IGMP version 1, the IGMP message contains 5 fields (for a total of 8 bytes). The first 4 bits are the version number, which is obviously 1. The next 4 bits are the message type, which is either a 'host membership query' or 'host membership report'. The following 8 bits are unused. Next we have 16 bits that make up the checksum field, which are used for error checking. Finally, the last 16 bits are for the multicast group address.
When a host wishes to join a multicast group, it sends out an IGMP message with the Message Type set to 2 (host membership report) with the multicast group it wants to join in the IP Multicast Group Address field. The MAC address that the packet is sent to is the mac address of the multicast group (as covered above). A router on the segment then receives the report and notes which port it came in on. From then on, any multicast packets with the requested group address are forwarded out that router interface.
The router periodically sends IGMP packest with the message type set to 1 (host membership query). Any hosts still interested in receiving multicast packets then starts a random timer with a top range of 10 seconds and responds with a type 2 packet for every multicast group it wishes to remain a part of. Only one host per segment responds for any single multicast gorup. The host membership query can be set from 0 to 65,535 seconds, with a default setting of 60 seconds. If a query is sent regarding a multicast group and no responses are received by the router, that multicast group is no longer forwarded out of that interface.
Only one router per segment sends out the type 1 message. In IGMP version 1, the designated router for the multicast routing protocol sends the query. If IGMP version 2 is being used, it's the router with the lowest IP address. The query targets the "all multicast hosts" address, which is 220.127.116.11 with a mac of 01:00:5e:00:00:01 and a group addrss of 0.0.0.0.
IGMP version 2 is very similar. There is no IGMP version number, but the IGMP type field has expanded to fill an entire byte. There are four types defined in the RFC. These are membership query, which is similar to host membership query from version 1. However, in version 2 this message has the capability to target a specific group, rather than all multicast groups. There is the version 2 membership report, which is similar to host membership report from version 1. There is also a leave group message (0x17) and a Version 1 Membership Report for backwards compatability.
The 0x11 membership query has 2 main uses. As in version 1, it can be used to query all hosts as to which multicast groups they wish to remain subscribed to. However, it can also query a specific multicast group, eliciting responses for only that group. All other multicast group members ignore the packet. This feature only works on a lan segment running exclusively on IGMPv2.
The 0x17 leave group message is entirely new to IGMP. Any time a host wishes to remove itself from a multicast group, it sends this type of message to the router. If a host sends a leave message, the router then sends a group-specific membership query onto the segment. If no hosts respond to that query, the router stops sending multicast packets from that group onto the segment.
In the case of a version mismatch between host and router IGMP versions, version 1 is always used. In a multi-router segment, if a router has only version 1 support and another has version 2, the version 2 router must be adminstratively configured to use version 1 due to the varying schemes of selecting a query router.
IGMP version 3 is currently being developed and allows the use of 'source filtering'. This allows a host to tell a router not only which multicast addresses it wishes to receive, but also the source of the multicast stream. That way, if there were multiple, competing broadcasts on a LAN/WAN using the same multicast address, the host could specify which multicast server it's interested in speaking with. This is done with either the INCLUDE mode or the EXCLUDE mode. In INCLUDE mode, the host specifies the ip address of the source. In EXCLUDE mode, the host specifies which source ip it does not want. To receive multicast broadcasts from all sources, the host specifies EXCLUDE mode with an empty EXCLUDE list.