IGMPv2 is an evolution of IGMPv1, providing backwards compatibility with IGMPv1 and new features to improve IGMP functionality.IGMPv2 New Features
- Leave Group message – hosts can now notify routers that they no longer wish to receive traffic for a specific multicast group.
- Group-Specific Query message – the router can query in the context of a specific group instead of all groups. When IGMPv2 routers receive a Leave Group message, they will put a Group-Specific Query message on the wire, asking if there are any group members left. If there’s no response, the router can quickly stop forwarding multicast traffic for that group onto that segment.
- Maximum Response Time field – a new query message field the router uses to specify the MRT. Used when you want to tweak the response time for the Host Membership Report, which can be helpful when there’s a large number of multicast groups active on a segment. MRT can be tweaked to reduce floods of responses.
- Querier election process – routers will elect a preferred router to send query messages when multiple multicast routers are attached to the same segment. Note that queries are sent every 125 seconds by the elected querier by default. In IGMPv1, the querier would send every 60 seconds.
IGMPv2 Message Format
- As with IGMPv1, 8 octets, 64 bits in total length.
- Type field, 4 bits. One of the following 4 messages:
- Membership query, type code 0x11. Used in 2 ways:
- When the router gets a leave message from a host. The router then uses a membership query to ask “Is there anyone left on this segment participating in this group?”, in which case the Group Address field (discussed below) will have the multicast group address in it.
- When the router is making a general query on the segment, just like in IGMPv1, in which case the Group Address field is 0.0.0.0.
- Version 1 membership report, type code 0x12. Used by IGMPv2 hosts to be backward compatible with IGMPv1.
- Version 2 membership report, type code 0x16. Used by a group member to tell the router that there is a host on the segment participating in the multicast group.
- Leave Group, type code 0x17. A group member sends this, theoretically only if he was the last member to send a membership report, to let the router know that he’s leaving the group. In practice, most vendors ignore RFC 2236 and implement this such that a host always sends a leave group message whether he was the last one to send a membership report or not.
- Membership query, type code 0x11. Used in 2 ways:
- Maximum Response Time field, 8 bits. This is included in Query messages only. This number is measured in tenths of a second, 10 second MRT being the default. Ranges to 0 – 255 (ergo, 25.5 seconds maximum).
- Checksum, 16 bit. This is the checksum of the entire IP payload calculated by the sender.
- Group Address, 32 bits. General queries populate this with 0.0.0.0. Membership reports and Leave Group messages have the address of the multicast group here.
IGMPv2 Leave Group and Group-Specific Query Messages – this is a review of message exchanges when an IGMPv2 host wishes to leave a group.
- The host sends an IGMPv2 Leave Group message to 188.8.131.52 (all multicast routers), stating that he no longer wishes to receive traffic for the specified multicast group.
- The router does not track specific group members, so he therefore puts a Group-Specific Query on the wire to see if there are any remaining members of the groups the host above just left.
- One of two things can happen now:
- Any remaining host will send a Membership report for that multicast group, in accordance with the Report Suppression algorithm. In that case, the router will continue forwarding multicast traffic for that group onto that segment.
- Alternately, there will be no remaining members of that multicast group, and therefore, the router will not receive any membership reports. In that case, the router will stop forwarding multicast traffic for that group onto that segment. You might be wondering – how long does the router wait for a response for deciding there are no remaining multicast members?
- The router uses a “Last Member Query Interval” (defaults to an MRT of 10 – 1 second) as the time in between Group-Specific query messages and a “Last Member Query Count” (default of 2), which increments for every Group-Specific query that is sent without a response.
- Using this logic and the default values, the router will send a group-specific query, and wait 1 second. If there’s no response, he’ll send a second group-specific query and wait one second. If there’s still no response, he’s done waiting, meaning he’ll typically quit forwarding traffic for that multicast group onto the segment somewhere under 3 seconds.
- When an IGMPv2 router sees a General Query message on the wire, they compare they source IP of that message to their own. The IGMPv2 router on the segment with he lowest segment IP address will be the IGMP querier.
- The election losers will cease sending query messages, but watch the wire. When they see that the elected querier doesn’t send a query for 2 Query Intervals plus one-half of a Query Response Interval, they assume the elected querier is dead. Then a new election begins.
- RFC 2236 defines this is the “Other Querier Present Interval”, 255 seconds by default – 125×2 (250), plus 10/2 (5).