Internet Group Management Protocol

The IGMP protocol is used by IP multicasting to manage membership to multicast groups. Consult Chapter 11 for information on how to use Winsock to join and leave multicast groups. When an application joins a multicast group, it sends an IGMP message to every router on a local network, using the special address 224.0.0.2. This address is known as the all-routers group. This IGMP message tells the routers that there is a recipient for any data destined for the given multicast address. The routers forward data for this multicast group if and only if a recipient is interested in receiving that data. Without this ability, multicast data is nothing more than a broadcast.

To make matters a bit more confusing, there are two versions of the IGMP protocol: version 1 and version 2. They are described in RFC 1112 and RFC 2236, respectively. The major difference between them is that version 1 has no method for a host to tell the router to stop forwarding data destined for a multicast group. In other words, when a host decides to drop group membership, the host does not notify the router and the router continues to forward data for that group until it sends a group query for that group and no one responds. Version 2 of the protocol adds an explicit "leave" message so hosts can notify routers immediately when they are dropping membership. Additionally, the header formats for the two versions are slightly different. Figure 13-3 illustrates the version 1 header, while Figure 13-4 shows the version 2 header. At only 8 bytes in length, both headers are simple.

click to view at full size.

Figure 13-3. IGMPv1 header format

click to view at full size.

Figure 13-4. IGMPv2 header format

Version 1 has two 4-bit fields. The first field is the IGMP version, and the second field is the IGMP message type. In version 2, a single 8-bit field replaces these two fields. Additionally, the unused field in version 1 becomes the maximum response time field. The Max Response Time field is meaningful only in Membership Query messages: it specifies the maximum time allowed before sending a responding report in units of 0.1 second. In all other messages, the sender sets this field to 0 and receivers ignore it.

For IGMPv1, the version field is always set to 1 and the type field is one of two possible values, shown in Table 13-2. Routers use the host membership query (0x1) to determine which multicast groups the host is using. In this case, the group address field is 0. The router sends the packet to the all-hosts address (224.0.0.1). If any hosts are still members of any group, each host sends a host membership report (IGMP message type 0x2) back to the all-routers address with the address to which it is joined. When a host first joins a group, a host membership report message is sent to the all-routers group as well.

As shown in Table 13-3, version 2 of IGMP adds two new message types: version 2 membership report (0x16) and leave group (0x17). Notice that the other two messages are the same as the version 1 messages (host membership query and membership report), even though their assigned values are different. However, remember that the version 2 IGMP packet condenses the version and type fields into a single field, and 0x11 is 00010001 in binary, which neatly makes itself look like an IGMP packet with version equal to 1 and type equal to 1.

Table 13-2. IGMP version 1 message types

TypeDescription
0x1Host membership query
0x2Host membership report

Table 13-3. IGMP version 2 message types

TypeDescription
0x11Membership query
0x12Version 1 membership report
0x16Version 2 membership report
0x17Leave group

The membership query (0x11) in version 2 is different from the membership query in version 1 in one minor way. Not only can it do the general query, as in version 1, it can also query for membership on a network for a specific group address. It does this by sending a membership query packet to the all-hosts group with a specific group in the group address field for which it wants to query. The version 2 membership report is new, as it allows the use of the maximum timeout field that controls the amount of time hosts have to respond to the query before it stops forwarding IP multicast traffic for the given group.



Network Programming for Microsoft Windows
Linux Server Hacks, Volume Two: Tips & Tools for Connecting, Monitoring, and Troubleshooting
ISBN: 735615799
EAN: 2147483647
Year: 1998
Pages: 159

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net