By sending Query messages to hosts and receiving Report messages and Done messages from hosts, a multicast router can identify multicast groups that contain receivers on a network segment. A multicast router forwards multicast data to a network segment only if the network segment has receivers. Hosts can determine whether to join or leave a multicast group.
As shown in Figure 1, MLD-enabled Device A functions as the querier to periodically send Multicast Listener Query messages. All hosts (Host A, Host B, and Host C) on the same network segment of Device A can receive these Multicast Listener Query messages.
When a host (for example, Host A) receives a Multicast Listener Query message of group G, the processing flow is as follows:
If Host A is already a member of group G, Host A replies with a Multicast Listener Report message of group G at a random time point within the response period specified by Device A.
After receiving the Multicast Listener Report message, Device A records information about group G and forwards the multicast data to the network segment of the host interface that is directly connected to Device A. Meanwhile, Device A starts a timer for group G or resets the timer if it has been started. If no members of group G respond to Device A within the interval specified by the timer, Device A stops forwarding the multicast data of group G.
If Host A is not a member of any multicast group, Host A does not respond to the Multicast Listener Query message from Device A.
When a host (for example, Host A) joins a multicast group G, the processing flow is as follows:
Host A sends a Multicast Listener Report message of group G to Device A, instructing Device A to update its multicast group information. Subsequent Multicast Listener Report messages of group G are triggered by Multicast Listener Query messages sent by Device A.
When a host (for example, Host A) leaves a multicast group G, the processing flow is as follows:
Host A sends a Multicast Listener Done message of group G to Device A. After receiving the Multicast Listener Done message, Device A triggers a query on group G to check whether group G has other receivers. If Device A does not receive Multicast Listener Report messages of group G within the period specified by the query message, Device A deletes the information about group G, and stops forwarding the multicast traffic of group G.
MLDv1 messages sent by hosts contain only information about multicast groups. After a host sends a Multicast Listener Report message of a multicast group to a router, the router informs the multicast forwarding module of the event. Then, the multicast forwarding module can correctly forward the multicast data to the host when receiving the multicast data of the group.
MLDv1 is capable of suppressing report messages to reduce repetitive report messages. This function works as follows:
After a host (for example, Host A) joins a multicast group G, Host A receives a Multicast Listener Query message from a router and then randomly selects a value from 0 to Maximum Response Delay (specified in the Multicast Listener Query message) as the timer value. When the timer expires, Host A sends a Multicast Listener Report message of group G to the router. If Host A receives a Multicast Listener Report message of group G from another host in group G before the timer expires, Host A does not send the Multicast Listener Report message of group G to the router.
When a host leaves group G, the host sends a Multicast Listener Done message of group G to a router. Because of the Report message suppression mechanism in MLDv1, the router cannot determine whether another host exists in group G. Therefore, the router triggers a query on group G. If another host exists in group G, the host sends a Multicast Listener Report message of group G to the router.
If a router sends the query on group G for a specified number of times, but does not receive a Multicast Listener Report message for group G, the router deletes information about group G and stops forwarding multicast data of group G.
Both MLD queriers and non-queriers can process Multicast Listener Report messages, while only queriers are responsible for forwarding Multicast Listener Query messages. MLD non-queriers cannot process Multicast Listener Done messages of MLDv1.
An MLDv1 message contains only the information about multicast groups, but does not contain information about multicast sources. Therefore, an MLDv1 host can select a multicast group, but not a multicast source/group. MLDv2 has resolved the problem. The MLDv2 message from a host can contain multiple records of multicast groups, with each multicast group record containing multiple multicast sources.
MLDv2 does not have the Report message suppression mechanism. Therefore, all hosts joining a multicast group must reply with Multicast Listener Report messages when receiving Multicast Listener Query messages. In MLDv2, multicast sources can be selected. Therefore, besides the common query and group-specific query, an MLDv2 router adds the source-specific multicast group query, enabling the router to find whether receivers require data from a specified multicast source.
MLDv2 messages sent by hosts are classified into the following types:
MODE_IS_INCLUDE: indicates that the corresponding mode between a group and its source list is Include. That is, hosts receive the data sent by a source in the source-specific list to the group.
MODE_IS_EXCLUDE: indicates that the corresponding mode between a group and its source list is Exclude. That is, hosts receive the data sent by a source that is not in the source-specific list to the group.
CHANGE_TO_INCLUDE_MODE: indicates that the corresponding mode between a group and its source list changes from Exclude to Include. If the source-specific list is empty, the hosts leave the group.
CHANGE_TO_EXCLUDE_MODE: indicates that the corresponding mode between a group and its source list changes from Include to Exclude.
ALLOW_NEW_SOURCES: indicates that a host still wants to receive data from certain multicast sources. If the current relationship is Include, certain sources are added to the current source list. If the current relationship is Exclude, certain sources are deleted from the current source list.
BLOCK_OLD_SOURCES: indicates that a host does not want to receive data from certain multicast sources any longer. If the current relationship is Include, certain sources are deleted from the current source list. If the current relationship is Exclude, certain sources are added to the current source list.
On the router side, the querier sends Multicast Listener Query messages and receives Multicast Listener Report. In this manner, the router can identify which multicast group on the network segment contains receivers, and then forwards the multicast data to the network segment accordingly. In MLDv2, records of multicast groups can be filtered in either Include mode or Exclude mode.
In Include mode:
The multicast source in the activated state requires the router to forward its data.
The multicast source in the deactivated state is deleted by the router and data forwarding for the multicast source is ceased.
In Exclude mode:
The multicast source in the activated state is in the collision domain. That is, no matter whether hosts on the same network segment of the router interface require the data of the multicast source, the data is forwarded.
The multicast source in the deactivated state requires no data forwarding.
Data of the multicast source that is not recorded in the multicast group should be forwarded.
In MLD group compatibility mode, MLDv2 multicast devices are compatible with MLDv1 hosts. An MLDv2 multicast device can process Multicast Listener Report messages of MLDv1 hosts. When an MLDv2 multicast device that supports MLD group compatibility receives Multicast Listener Report messages from an MLDv1 host, the MLDv2 multicast device automatically changes its MLD version to MLDv1 and operates in MLDv1. Then, the MLDv2 multicast device ignores MLDv2 BLOCK messages and the multicast source list in the MLDv2 TO_EX messages. The multicast source-selecting function of MLDv2 messages is therefore suppressed.
If you manually change the MLDv1 version of a multicast device to the MLDv2 version, the multicast device still operates in the MLDv1 version if MLDv1 group members exist. The multicast device upgrades to the MLDv2 version only after all MLDv1 group members leave.
An MLD multicast device can be either a querier or a non-querier:
Querier
A querier is responsible for sending Multicast Listener Query messages to hosts and receiving Multicast Listener Report and Multicast Listener Done messages from hosts. A querier can then learn which multicast group has receivers on a specified network segment.
Non-querier
A non-querier only receives Multicast Listener Report messages from hosts to learn which multicast group has receivers. Then, based on the querier's action, the non-querier identifies which receivers leave multicast groups.
Generally, a network segment has only one querier. Multicast devices follow the same principle to select a querier. The process is as follows (using DeviceA, DeviceB, and DeviceC as examples):
After MLD is enabled on DeviceA, DeviceA considers itself a querier in the startup process by default and sends Multicast Listener Query messages on the network segment. If DeviceA receives a Multicast Listener Query message from DeviceB that has a lower link-local address, DeviceA changes from a querier to a non-querier. DeviceA starts the another-querier-existing timer and records DeviceB as the querier of the network segment.
If DeviceA is a non-querier and receives a Multicast Listener Query message from DeviceB in the querier state, DeviceA updates another-querier-existing timer; if the received Multicast Listener Query message is sent from DeviceC whose link-local address is lower than that of DeviceB in the querier state, DeviceA records DeviceC as the querier of the network segment and updates the another-querier-existing timer.
If DeviceA is a non-querier and the another-querier-existing timer expires, DeviceA changes to a querier.
In this document version, querier election can be implemented only among multicast devices that run the same MLD version on a network segment.