组播

 

组播中用到的协议

主机 & 路由器之间通信协议: IGMPv1, 2(default) and 3

路由器 & 路由器之间通信协议: PIM in IPv4, MLD in IPv6

交换机 & 路由器: IGMP Snooping or CGMP

 

组播的主要组成部分:
Control plane (routing) : IGMP , PIM
Data plane (forwarding) : RPF , Mroute table

 

1. 组播简介

组播定义: 组播是一个源发送消息到组内特定接收者接收消息的一个过程。主要目标是为了提高网络效率与减少资源占用。

有四种IP地址

(1) unicast(单播)

(2) any-cast (任意播)

(3) multicast (组播)

(4) broadcast(广播)

 

IP组播包括这些组件:

(1)一个地址标准

(2)组播用户形成的组播组(IGMP协议)

(3)源与共享树

(4)组播协议(PIM, Protocol Independent Multicase)

 

Multicasting allows the source to send a single packet to a single multicast destination address,

thus removing the processing burden of replicating packets.

Any receiver that is listening for the multicast address can receive the packet,

removing the need for disinterested hosts to process an unwanted packet.

And unlike broadcast packets, multicast - aware routers can forward multicast packets.

 

为什么是组播?

  • Used when sending same data to multiple receivers
  • Better bandwidth utilization
  • Less host/router processing
  • Used when addresses of receivers unknown
  • Used when simultaneous delivery for a group of receivers is required(simulcast)

Note: simultaneous delivery for a group of receivers -- may be used for:

  • audio or video streaming
  • news and silmilar data delivery
  • deploying software upgrades

 

Multicast Advantages and Drawbacks:

Advantages:

  • Enhanced efficiency: Controls network traffic and reduces server and CPU loads
  • Optimized performance: Eliminates traffic redundancy
  • Distributed applications: makes multipoint applications possible

Multicast Drawbacks (Multicast is UDP-based):

  • Best-effort delivery: Drops are to be expected. Multicast applications must not expect reliable delivery of data and should be designed accordingly. Reliable multicast applications will address this issue.
  • No congestion avoidance: The lack of TCP windowing and "slow-start" mechanisms can result in network congestion. If possible, multicast applications should attempt to detect and avoid congestion conditions.
  • Duplicates: Some multicast protocol mechanisms result in the occasional generation of duplicate packets. Multicast applications should be designed to expect occasional duplicate packets.
  • Out-of-sequence delivery: Network topology changes affect the order of delivery - the application  must properly address the issue.

 

Types of Multicast Applications

  • One to many: A single host sending to two or more receivers
  • Many to Many: any number of hosts sending to the same multicast group; hosts are also members of the group (sender = receiver)
  • Many to one: Any number of receivers sending data back to a source (via unicast or multicast )

 

IP Multicast Applications

实时应用:

1. 直播

2. 财务报表

3. 协作应用

4. 视频会议

非实时应用 :

文件传输

数据与文件重传

VoD (Video on Demand) 

 

组播IP地址 (RFC 1700)

D类 地址从 224.0.0.0 - 239.255.255.255, 是扁平的, subnetting is not used, with 28 variable bit.

224.0.0.0 - 224.0.0.255   IANA reserves for routing protocols and other network maintenance functions. Never forward off the local network, regardless of TTL (usually TTL=1)

224.0.1.0 - 238.255.255.255 Global scope addresses, allocated cynamically throughout the Internet.

239.0.0.0 - 239.255.255.255 Administratively scope address, use inside private domains

  • 239.255.0.0/16 & 239.252.0.0/16 & 239.253.0.0/16 & 239.254.0.0/16 site-local scope also reserved
  • 239.192.0.0 - 239.251.255.255 organization-local scope

Note: For complete list of reserved Class D addresses , RFC 1700

 

知名保留组播地址

Address

Group

224.0.0.1

All system on this subnet

224.0.0.2

All routers on this subnet

224.0.0.4

DVMRP(Distance Vector Multicast Routing Protocol) routers

224.0.0.5

All OSPF routers

224.0.0.6

OSPF Designated Routers(DRs)

224.0.0.9

RIPv2 routers

224.0.0.10

EIGPR routers

224.0.0.13

PIM routers

224.0.0.15

CBT routers

224.0.1.39

Cisco RP Announce

224.0.1.40

Cisco RP Discovery

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

二层组播地址 (0100.5E00.0000)

IP multicast Address -> Multicast MAC Address (Low-order 23 bit)

Calss D IP Address
11100000 00000000 00000000 00000000
       

 

 

 

 

 

1.2 Multicasting Over Ethernet and FDDI

Ethernet and FDDI interfaces map the lower 23 bits of the group IP address onto the lower 23 bits of the reserved MAC address to form a multicast MAC address.

Decimal:  235.147.18.23

Hex:          EB  . 93 .12.17

Binary   :   11101011.10010011.00010010.00010111

Base MAC address :   0100.5E00.0000

Binary   :

Multicast MAC add:   0000000100000000.0101111000010011.00010010.00010111

Multicast MAC add:   0100.5E13.1217

 

The benefits of this predictable MAC approach are twofold:

  • A multicast source or router on the local network has to deliver only a single frame to the multicast MAC address in order for all group members on the LAN to receiver it.
  • Because the MAC address is always known if the group address is known, there is no need for an ARP process.

 

Multicast Over Token Ring

 

组成员概念 (IGMP)

在不受控制的网络环境中,组播包通过交换机时,会以未知单播包发送。

在一台主机想要加入一个组,必须知道当前网络环境中有哪些组? 以及如何加入它们?

 

IGMP (IP protocol number is 2, TTL is 1)

  • IGMPv1 RFC 1112
  • IGMPv2 RFC 2236
  • IGMPv3

备注: Cisco IOS: ip igmp version, Determining which IGMP version is running on an interface   // show igmp interface e0, default is IGMPv2

When you enable PIM on interface, IGMP version 2 will be enabled automatically by default.

 

IGMPv1

IGMP is a host-to-router protocol used when hosts want to join a multicast group.

With IGMPv1, routers send periodic membership queries to the multicast address 224.0.0.1.

Hosts send membership reports to the group multicast address they want to join;

hosts silently leave the multicast group.

 

IGMPv2

These were some important changes made in revising IGMPv1 to IGMPv2:

  • Group-specific queries(not all-hosts 224.0.0.1, is a specific group multicast address)
  • Leave group message
  • Queried election mechanism
  • Query-interval response time(default is 60s) [control the burstiness of reports]

 

IGMPv2-joining a Group

members joining a multicast group do not have to wait for a query to join. They send an unsolicited report indicating their interest. 

Note: When there are two IGMP routers on the same Ethernet segment (broadcast domain),

the router with the highest IP address is the designated queried.

 

IGMPv2-leaving a Group

In IGMPv1, hosts leave passively(just stop reporting their membership by responding to membership queries).

However, IGMPv2 has explicit leave group messages.

When the IGMPv2 router receives a leave message,

it responds by sending a group-specific query for the associated group to see whether there are other hosts interested in receiving traffic for the group.

This process helps to reduce overall leave latency.

 

1. H2 sends a leave message

2. Router sends a group-specific query

3. A remaining member host sends report, so group remains active 

 

IGMPv2 Host Functions

Hosts running IGMPv2 use three types of messages:

  • Membership Report messages
  • Version 1 Membership Report messages
  • Leave Group messages

 

IGMPv2 路由器功能

The only type of IGMP message sent by routers is a query.

Within IGMPv2, there are two subtypes of queries:

  • General Query
  • Group-Specific Query
    • Router sends groups-specific query to make sure that there are no members present before ceasing to forward data for the group for that subnet.
  • Leave group message
    • Host sends leave message if it leaves the group and is the last member(reduces leave latency in comparison v1).

 

The General Query is the message with which the router pols each of its subnets to discover whether group members are present and to detect when there are no members of a group left on a subnet. By default, the queries are sent every 60 seconds; the default can be changed to any value between 0 and 65535 seconds with the command ip igmp query-interval.

 

The General Query message is sent to the "all system on this subnet" address of 224.0.0.1 and does not contain a reference to any specific group.  // show ip igmp groups

 

The normal way that a host leaves a group is by sending a Leave Group message. When a router receives a Leave Group messages, it must determine whether any remaining members of that group are on the subnet. To do this, the router issues a Group-Specific Query, which differs from a General Query in that it contains the group address, and it also uses the group address as its destination address.

 

IGMPv3

IGMPv3 adds the ability to filter multicasts based on multicast source. Allow hosts to indicate that they want to receive traffic only from particular sources within a multicast group.

 

IGMP Commands:

int f0/0
ip igmp join-group 239.1.1.1

 (will force Router to begin sending IGMPv2 membership reports , this command useful to test our multicast network by making receivers ping this multicast address and emulate this router connected to multicast streaming source )

 

int f0/0
ip igmp version 1/2/3

Change manually your IGMP version

 

 

Layer 2 Multicast Switching Solutions

problem:

For most Layer 2 switches, multicast traffic is normally treated like an unknown MAC address

or broadcast frame that causes the frame to be flooded out every port within a VLAN. [wasted bandwidth].

 

Solution

1. allow the administrator to configure the switch to manually associate a multicast MAC address with various ports.[not scalable]

2. Dynamic configuration of the forwarding tables of the switches. [more effective]

  • Cisco Group Management Protocol (CGMP): simple, proprietary; routers and switches
  • IGMP snooping: Complex, standardized, proprietary implementations; switches only

 

CGMP(Client/Server model)

CGMP is designed to do exactly that --- distribute multicast sessions only to those switch ports on which group members are located. CGMP is a Cisco Systems proprietary protocol that runs between a multicast router and a switch.  This protocol enables the Cisco multicast router, following the receipt of IGMP messages sent by hosts, to inform he switch about the information contained in the IGMP packet.

  1. Runs on switches and routers.
  2. CGMP packets sent by routers to switches at the CGMP multicast MAC address(0100.0cdd.dddd) C/S model.
  3. CGMP packet contains:
    • type field: join or leave
    • MAC address of the IGMP client
    • Multicast MAC address of the group
  4. Switch uses CGMP packet information to add or remove an entry for a particular multicast MAC address.

 

Alternative Multicast Control Methods on Switched Networks

There are three methods besides CGMP for constraining multicast traffic in switched environments.

  1. Manual configuration of switched multicast trees
  2. GMRP
  3. IGMP Snooping

 

IGMP Snopping

With IMGP snooping, the switch intercepts IMGP messages from the host and updates the MAC table accordingly. To implement IMGP snooping without suffering switch performance loss, it is necessary to make the switch Layer 3-aware. This result is typically accomplished by using Layer 3 ASICs.

  1. Switches become IGMP-aware and listen in on the IGMP conversations between hosts and routers.
  2. IGMP packets are intercepted by the CPU or by special hardware ASICs
  3. The switch must examine contents of IGMP messages to determine which ports want what traffic:
    • IGMP membership reports
    • IGMP leave messages
  4. Effect on switch:
    • Must process all Layer 2 multicast packets
    • Administration load increased with multicast traffic load
    • Requires special hardware to maintain throughput

 

 

组播路由协议

组播协议的分类

(1)密集模式协议(Dense-Mode)

(2)稀疏模式协议 (Sparse-Mode)

(3)链路状态协议

 

多播包应从源到目的,向下游传送,而不能向上游,从目的到源。

每个多播路由器都有一张多播路由表    // show ip mroute

C72-15#show ip mroute 
IP Multicast Routing Table
Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,
       L - Local, P - Pruned, R - RP-bit set, F - Register flag,
       T - SPT-bit set, J - Join SPT, M - MSDP created entry, E - Extranet,
       X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,
       U - URD, I - Received Source Specific Host Report, 
       Z - Multicast Tunnel, z - MDT-data group sender, 
       Y - Joined MDT-data group, y - Sending to MDT-data group, 
       V - RD & Vector, v - Vector
Outgoing interface flags: H - Hardware switched, A - Assert winner
 Timers: Uptime/Expires
 Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 230.1.1.1), 00:08:01/00:03:23, RP 15.15.15.15, flags: S
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    GigabitEthernet0/3, Forward/Sparse, 00:08:01/00:03:23

(70.1.1.2, 230.1.1.1), 00:08:01/00:02:28, flags: PT
  Incoming interface: GigabitEthernet0/3, RPF nbr 124.1.1.16
  Outgoing interface list: Null

(*, 228.1.1.1), 00:23:07/stopped, RP 15.15.15.15, flags: SP
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list: Null

(70.1.1.2, 228.1.1.1), 00:23:07/00:01:18, flags: PT
  Incoming interface: GigabitEthernet0/3, RPF nbr 124.1.1.16
  Outgoing interface list: Null

(*, 224.0.1.40), 2d18h/00:02:03, RP 0.0.0.0, flags: DCL
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    Loopback1, Forward/Sparse, 2d18h/00:02:03

 

其中记录着(源,组)地址对,来自一个特定的源地址,发送一个特定的组的包总是在上游的接口处收到,

再转发到一个或多个下游的接口上。

 

多播路由器协议的功能

(1) 判断上游接口(离源更近)的接口。找出到源的最短路径。

(2) 判断与(S, G)对相关联的实际下游网络接口。

      当这两点都达到后,则会建立一颗以源直连的路由器为根的多播树。

      多播树只会在多播会话期间存活。树的结构是动态的。

(3) 对树进行管理,组员加入时接上树枝,退出时剪去树枝。

 

密集与稀疏模式

 

密集模式协议使用 Push 原理,利用SPT来发送(S,G)组播信息。

密集模式特点

使用PUSH模型

流量在整个网络中溢流

在不需要的地方进行剪枝

Flood 和 Prune 行为(一般3分钟)

密集模式协议的主代表(DVMRP, PIM-DM)

 

Multicast Distribution Trees

Multicast distribution trees: define the path from the source to the receivers, over which the multicast traffic flows.

两种组播分发树比较

  • source-rooted(Shortest Path Tree) 基于源的树
  • shared trees(less efficient than an SPT, but less memory, CPU) 共享树

With a source-rooted tree, a separate tree is built for each source to all members of its group. 

Shared tree protocols create multicast forwarding paths that rely on a central core router that serves as a Rendezvous Point(RP) between multicast sources and destinations. Sources initiall send their multicast packets to the RP, which in turn forwards data through a shared tree to the members of the group. A shared tree is less efficient than an SPT, but it is less demanding on routers(memory, CPU).

 

There are basically two types of multicast routing protocols: dense mode protocols & Sparse mode protocols 

  • Dense mode protocols flood multicast traffic to all parts of the netwrok and prune the flows where there are no receivers using a periodic flood-and-prune mechanism.
  • Sparse mode protocols use an explicit join mechanism where distribution trees are built on demand by explicit tree join messages sent by routers that have directly connected receviers.

 

Shortest-Path Tree


 

(S,G) entries [pronounced S comma G], S is the IP address of the source, and G is the multicast Group address. (192.168.1.1,224.1.1.1)

For this particular source sending to this particular group

Traffic forwarded via the shortest path from the source

The main point is that a separate SPT is built for every source S sending to group G. 

 

 

Shared Distribution Trees

(*,G) entries [star comma G]

For any (*) source sending to this group

Traffic forwarded via a meeting point for this group

 

IP Multicast Routing 

In unicast routing, when the router receives the packet, the decidion about where to forward the packet depends on the destination address of the packet.

In multicast routing, the decision about where to forward the multicast packet depends on where the packet came from.

Multicast routing use a mechanism called Reverse Path Forwarding(RPF) to prevent forwarding loops and to ensure the shortest path from the source to the receivers.

 

Currently, five IP multicast routing protocols are in various stages of development and deployment:

  1. Distance Vector Multicast Routing Protocol(DVMRP) RFC 1075
  2. Multicast OSPF (MOSPF) RFC 1584
  3. Core-Based Trees(CBT) RFC 2189
  4. Protocol - Independent Multicast, Dense Mode (PIM - DM) Internet-draft
  5. Protocol - Independent Multicast, Sparse Mode (PIM - SM) RFC 2362 proposed standard

Dense mode protocols flood multicast traffic to all parts of the network and prune the flows where there are no receivers using a periodic flood-and-prune mechanism.

Sparse mode protocols use an explicit join mechanism where distribution trees are built on demand by explicit tree join messages sent by routers that have directly connected receivers.

 

Multicast Forwarding

Multicast packets should always flow downstream from the source to the destinations, never upstream toward the source. To ensure this behavior, each multicast router maintains a multicast forwarding table in which(source, group) or (S,G) address pairs are recorded. 

 

PIM does not maintain its own topology database. Instead, it relies on the unicast forwarding table of the router to avoid loops.

 

PIM 有两种模式:

密集模式与松散模式

PIM-Dense Mode (not required RP)
PIM-Sparse Mode (Require RP)
RP can be chosen statically by manually specify the RP address or can be chosen dynamically by using PIMv1

(Cisco Propriety) called Auto-RP or using PIMv2 (standards) called RP/BSR

 

PIM-SM  RFC 2362

同时支持共享式和基于源的树。

使用PULL模型

流量仅仅被发送到需要它的地方

显示/主动的加入

稀疏模式主要代表: PIM-SM, CBT

 

PIM-SM 消息

hello  - 交换hello数据包发现邻居

bootstrap - 

Candidate-RP-Advertisement

Join/Prune

Assert/Register

Register-Stop

 

1. PIM-SM 邻居发现机制

PIM 路由器每隔30s周期性的发送hello消息,用以发现邻接的PIM路由器。 Hello消息被组播到所有PIM组(224.0.0.13)

如果是在多路访问网络时,必须选择一个指定路由器(DR),负责为组成员向组播分发树的根节点

发送“加入/剪枝”消息。网络上的每个PIM路由器都检查收到的Hello消息,具有最高网络层地址的路由器

被选为DR。

 

 

 

Part 4: Multicast Configuration and Verification

PIM-SM Configuration Commands

router(config)# ip multicast-routing  //enables multicast routing

 

Router(config-if)#ip pim {sparse-mode | sparse-dense-mode}  //enables PIM SM on an interface; the sparse-dense-mode option enables mixeds parse-dense groups

 

Router(config)#ip pim send-rp-announce {interface type} scope {ttl} group-list {acl}

Router(config)#ip pim send-rp-discovery {interface type} scope {ttl}

//configures the ability of a group of routers to be and discover RPs dynamically.

 

Inspecting Multicast Routing Table

Router#show ip mroute [group-address] [summary] [count] [active kbps]

  • Summary: display a one-line, abbreviated summary of each entry in the IP multicast routing table
  • count: Display statistics about the group and source, including number of packets, packets per second, average packet size, and bits per second.
  • active: display the rate at which active sources are sending to multicast groups.

 

Multicast Tables
Once tree from sender to receiver is built, traffic begin to flow ,when routers receive multicast packets , two tables will be checked to see how forwarding should occur:
1-CEF Table - called reverse path forwarding RPF check
2-Multicast Routing Table like unicast routing table controls what interfaces packets should forward to

 

Reverse Path Forwarding (RPF)
check source address and outgoing interface
in RPF check if incoming multicast interface == outgoing unicast int , RPF check passed
in RPF check if incoming multicast interface not equal outgoing unicast int , RPF check fails and packets dropped , which mean maybe loop would happen .
RPF checks are performed on each multicast packet received by a PIM router. RPF verifies that incoming multicast packets arrive on the interface closest to their source, by comparing the source address with the unicast routing table. We will talk later more about RPF

 

Multicast routing Table (mroute)
PIM monitoring the unicast routing table, also maintains its own multicast routing table to track incoming and outgoing interfaces for multicast traffic. Multicast routes are expressed in the format (S, G), where S is the multicast source and G is the group address.

 

Finding PIM Neighbors

Router# show ip pim interface [type number] [count]  //displays information about interfaces configured for PIM

Router#show ip pim neighbor [type number]  //lists the PIM neighbors discovered 

Router#mrinfo [hostname | address] //Queries which neighboring multicast routers are peering wiht the local router or router specified

 

Checking RP Information

Router#show ip pim rp [group-name | group-address | mapping]

//display active RPs that are cached with associated multicast routing entries

 

Router#show ip rpf {address | name}

//Display how IP multicast routing does RPF 

 

Example:
In R1 G0/0 is incoming , G0/1 is outgoing interfaces list (OIL)

 

 

 

 

 

 

 

 

 

 

 

posted @ 2015-08-22 14:34  elewei  阅读(1089)  评论(0)    收藏  举报