Multicast 不同于通常意义上到网络一对一多点传输,它是一对多(至少一个)点基于UDP/IP点传输协议,
组播路由器通过IGMP协议了解每个接口连接的网段上是否存在组播组的接收者,也就是组成员。如果存在成员,组播路由器应将组播数据包转发到这个网段;如果没有成员则应停止转发
具体可参考
http://www.networksorcery.com/enp/protocol/igmp.htm
组播 报文的目的地址使用D类ip地址, 范围是从224.0.0.0到239.255.255.255
* 主机通过IGMP协议向组播路由器报告自己想加入的组 * 路由器通过IGMP协议查询网段上是否还有特定组的成员
对于概念网上很多,本文主要是从一个主机的角度细节上讲述一下协议。
到目前为止总共有过4个版本,0版本基本不再被人们使用,具体介绍第一版本,后2,3个版本在1上加了少许些功能而已
当前IGMP3个版本: RFC1112—IGMP版本1 RFC2236—IGMP版本2 RFC3376—IGMP版本3
* 组成员加入过程
When a host joins a new group, it should immediately transmit a Report for that group, rather than waiting for a Query, in case it is the first member of that group on the network. To cover the possibility of the initial Report being lost or damaged, it is recommended that it be repeated once or twice after short delays. A simple way to accomplish this is to act as if a Query had been received for that group only, setting the group's random report delay timer.
==================
当一个主机想加入某个组播时,它得立即向该组播发送一个报告而不是等到路由点查询信息,为了避免一种情况(该主机是第一个加入该组播的主机)。为了确保该主机的报告丢失或者损坏,它需要重复1次或者2次(每次都有一个短暂时间的间隔)直到收到路由点查询信息才说明该组播已成功运行,然后该主机就可以重新设定一个随机倒计时器,准备发送一个报告(如何发送请看后面)
、
* 路由的查询
Routers periodically send IGMP Host Membership Queries to the all-hosts group (224.0.0.1) with a TTL of 1 (once every minute or two). All multicast-capable hosts hear them, but don't answer immediately to avoid an IGMP Host Membership Report storm. Instead, they start a random delay timer for each group they belong to on the interface they received the query.
Sooner or later, the timer expires in one of the hosts, and it sends an IGMP Host Membership Report (also with TTL 1) to the multicast address of the group being reported. As it is sent to the group, all hosts that joined the group -and which are currently waiting for their own timer to expire- receive it, too. Then, they stop their timers and don't generate any other report. Just one is generated -by the host that chose the smaller timeout-, and that is enough for the router. It only needs to know that there are members for that group in the subnet, not how many nor which.
When no reports are received for a given group after a certain number of queries, the router assumes that no members are left, and thus it doesn't have to forward traffic for that group on that subnet. Note that in IGMPv1 there are no "Leave Group messages".
=================
路由器RTA(IGMP查询器)周期性地(默认60秒)向子网内所有主机(224.0.0.1代表子网内所有主机)发送成员关系查询信息。(一个TTL=1的查询包)
同时接受到该查询信息点所有主机立即启动一个倒计时器(时间长短随机产生),当第一个主机(倒计时器先到0点那台)机首先向组播组发送IGMPv1成员关系报告(TTL=1);然后其他还在倒计时点主机收到该报告后立即停止倒计时,也不再需要再向路由器发送一个关系报告了。因为路由器发送查询包点目的只是想知道在该组播网段是否还存在主机,所有收到 一个回复后就足够了,它不需要具体知道有谁或者多少主机在该组播。 当然如果路由器在几次发送查询包后,一直没有收到任何点回复,那它就认为该组播的所有主机已经默默离开,而它就会回收这个网段。注意,在版本1不存在主机点“Leave Group messages”
附:
224.0.0.0~224.0.0.255为预留的组播地址(永久组地址),地址224.0.0.0保留不做分配,其它地址供路由协议使用;
224.0.1.0~224.0.1.255是公用组播地址,可以用于Internet;
224.0.2.0~238.255.255.255为用户可用的组播地址(临时组地址),全网范围内有效;
239.0.0.0~239.255.255.255为本地管理组播地址,仅在特定的本地范围内有效。
列表如下:
224.0.0.0 基准地址(保留)
224.0.0.1 所有主机的地址 (包括所有路由器 地址)
224.0.0.2 所有组播路由器的地址
224.0.0.3 不分配
224.0.0.4 dvmrp 路由器
224.0.0.5 ospf 路由器
224.0.0.6 ospf dr
224.0.0.7 st 路由器
224.0.0.8 st 主机
224.0.0.9 rip-2 路由器
224.0.0.10 Eigrp 路由器
224.0.0.11 活动代理
224.0.0.12 dhcp 服务器/中继代理
224.0.0.13 所有pim 路由器
224.0.0.14 rsvp 封装
224.0.0.15 所有cbt 路由器
224.0.0.16 指定sbm
224.0.0.17 所有sbms
224.0.0.18 vrrp
请参考。
协议解释
http://www.ibiblio.org/pub/Linux/docs/howto/other-formats/html_single/Multicast-HOWTO.html#s6
协议数据包的格式
http://www.networksorcery.com/enp/protocol/igmp.htm
详细各组播地址:
http://www.networksorcery.com/enp/protocol/ip/multicast.htm