概述
MLD(multicast listener discovery) 對應于IPv4中的IGMP2,MLD2 對應于IPv4中的IGMP3。
什麼是IGMP?參考我之前的文章:
https://blog.csdn.net/qq_31567335/article/details/78577979
IPv6多點傳播位址的字首是ff00::/8,并且可以有不同的範圍。
主機對于多點傳播的支援
發送多點傳播包
- 确定目的多點傳播位址
- 将多點傳播包放到網絡媒體中
接收多點傳播包
- 通知IPv6接收某個多點傳播多點傳播位址對應的流量
- 用網絡擴充卡注冊多點傳播mac位址。由IPv6多點傳播位址得到mac位址的方法在第三章。不太清楚網絡擴充卡的概念,不太明白用網絡擴充卡注冊多點傳播mac位址是個啥操作。
- 通知本地路由器
路由器對于多點傳播的支援
-
接收所有多點傳播流量
網絡擴充卡一般使用的是單點傳播偵聽模式,聽會監聽網卡對應的mac位址和mac廣播位址(全1)。為了接收所有的多點傳播流量,必須調整為多點傳播混雜偵聽模式。所有目标mac位址的I/G位為1的封包都會傳輸給上層協定進行進一步處理。多點傳播混雜模式不同于混雜模式,在混雜模式中,所有的封包都會交給上層協定進行處理。
- 轉發多點傳播流量
- 接收和處理多點傳播偵聽報告群組播偵聽已完成消息
- 發送多點傳播偵聽查詢消息
- 與其他多點傳播路由器交流組成員身份(這點非常重要,在tcpip詳解這本書中并沒有提到這一點)
MLD資料包結構
不同于IGMPv2,MLD使用了ICMPv6作為資料結構而不是單獨再定義一種結構。

有三種類型的MLD消息:
1. Multicast Listener Query (ICMPv6 Type 130)
1)General query
周期性的查詢網絡中的多點傳播組,目的位址為ff02::1。網絡中的主機會報告所有自己屬于的多點傳播組,除了link-local scope, all-nodes multicast address (FF02::1), and all multicast addresses with a scope of 0 (reserved) or 1 (interface-local)
2)Multicast-address-specifc query
在Multicast Listener Query的IPv6頭部中包含以下資訊:
hop limit被設為1(限定傳輸的範圍)
general query的目的位址為ff02::1,Multicast-address-specifc query的目的位址為對應的多點傳播位址
源位址為發送接口的鍊路本地位址
結構如下:
2. Multicast Listener Report (ICMPv6 Type 131)
用來主動報告加入某個多點傳播組或者響應Multicast Listener Query。
其IPv6頭部中包含如下資訊:
hoplimit被設為1
源位址為發送接口的鍊路本地位址, 不太了解後面這一段:If the Multicast Listener Report message is for a solicited-node multicast address corresponding to a unicast address for which duplicate address detection is not yet complete,the source address is set to the unspecifed address (::)
目的位址為對應的多點傳播位址
結構如下:
3. Multicast Listener Done (ICMPv6 Type 132)
用來通知本地路由器網絡中可能沒有對應多點傳播位址的成員。路由器收到之後會發送對應多點傳播位址對應的Multicast Listener Query進行查詢。 當上一次響應了某個多點傳播位址對應的Multicast Listener Query消息的主機離開此多點傳播組時發送Multicast Listener Done消息。個人了解,這樣設計的原因是減少不必要的MLB消息:如果某個主機不是某個網絡中最後離開某個多點傳播組的,離開時就發送一個Multicast Listener Done消息,這會觸發路由器進行查詢,其他主機又會進行響應。而如果上次查詢某個主機進行了應答,那麼此主機可能是對應多點傳播組中的最後一個主機。
在對應IPv6頭部中可以看到以下消息:
hoplimit被設定為1
源位址是發送接口的鍊路本地位址
目的位址是鍊路範圍所有的路由器對應的多點傳播位址(FF02::2)
結構如下:
MLDv2 Messages
There are two types of MLDv2 messages:
1. A modifed version of the Multicast Listener Query message (ICMPv6 Type 130)
2. A version 2 Multicast Listener Report message (ICMPv6 Type 143)
the Modifed Multicast Listener Query
增加了一種類型:
3. Multicast-address-and-source-specifc query
The multicast-address-and-source-specifc query is used to query all hosts on a subnet that are members of a specifc multicast group and are listening for traffc from a specifed list of multicast sources
MLDv2 Multicast Listener report
修改點:
The Destination Address feld is set to FF02::16, reserved by the Internet Assigned Numbers Authority as the All MLDv2-capable Routers address。
有一個疑問,如何區分MLD和MLD2?
答:
1.Multicast Listener Query的ICMPv6的Type編号一樣。但是可以通過内容進行區分(多點傳播資料包的源位址)
2.MLDv2 Multicast Listener report的ICMPv6編号不一樣。