Multicast PIM

       PIM (Protocol Independent Multicast) is a multicast routing protocol. PIM does not depend on a specific unicast routing protocol. It can use the unicast routing table established by any unicast routing protocol to complete the RPF check function, thereby establishing multicast routing. Since PIM does not need to send and receive multicast routing updates, the overhead of PIM is much lower than other multicast routing protocols.
       PIM defines two modes: Dense Mode and Sparse Mode. PIM-DM (Protocol Independent Multicast-Dense Mode), the dense mode of PIM, is suitable for situations where the network scale is relatively small and multicast members are relatively concentrated. PIM-DM is defined in the RFC 3973 document.
PIM-DM devices discover neighbors through Hello messages. Once a PIM-DM device is up, it periodically sends Hello messages on each PIM-DM-configured interface. Hello messages have a hold time (Hello Hold Time) field, this time parameter defines the maximum time the neighbor waits for the next Hello message. If the neighbor does not receive another Hello message within this time, the device will be removed from the neighbor relationship table.
1. Multicast forwarding method
1. Contrary to the direction of unicast routing, unicast routing cares about the destination IP address, while multicast cares about source IP, and multicast cares about where the traffic comes from! Multicast routing is equivalent to the reverse path of unicast routing, referred to as RPF (Reverse Path Forwarding). This RPF is for unicast.
2. Multicast RPF Check (Reverse Path Forwarding Technology Check)
Because the paths of multicast and unicast are opposite, this detection is to detect whether the paths of unicast and multicast are opposite (corresponding).
In this figure, the RPF check performed by R3 as a multicast router is: when the destination IP of the unicast traffic is the traffic going out from the S1/0 port to R1, the traffic from the multicast source must also be from R1 The multicast source traffic sent by the source and received through the S1/0 interface can pass the RPF detection. Otherwise, if the unicast traffic is sent from S1/0, but the multicast traffic is received from S1/1 (not from S1/0) to) then the multicast traffic received from S1/1 will be dorp for security consideration. (There is also RPF technology in unicast)
    PIM (protocol Independent, which means supporting multiple unicast protocols to build underlying paths): protocol used for multicast traffic between routers (IGMP is a protocol between multicast clients and multicast gateways)
PIM is divided into two types and two modes (types and modes can be arbitrarily matched):
1. There are two types of PIM:
1. The shortest path tree (active tree), the receiver has the shortest distance to the multicast traffic source and becomes an active tree. The root is the source!
Similar to direct sales, manufacturers sell directly to customers
2. Shared tree, shared distribution tree, characterized by the fact that the source of multicast traffic is *, which means that all are sources. Among them, there is the concept of RP rendezvous point, RP is one or more multicast routers, and there are multiple roots (RP) in the shared tree. The multicast traffic sent by the source is forwarded and received through the RP proxy.
Similar to distribution, manufacturers sell to customers through agents, so the routing of multicast traffic without active trees is optimal (because it is forwarded by RP in the middle)
Two, two modes of PIM
1. Dense-mode, dense mode, the client is relatively concentrated
1) The device closest to the source in multicast is called the first hop device.
2) The device closest to the client source in multicast is called: the last hop device (last hop)
1)、组播中离源最近的设备叫做:第一跳设备(first hop),在Dense-mode模式中当有了源以后first hop负责初始化泛红(类似switch的arp查询广播),这个初始化泛红的意义是:让所有收到组播流量的路由器产生(S源 G组)表项,然后根据收到的所有路由器回应的报文来进行最短路径的选择,修剪掉不必要的路径,找出(到源)最短的路径。如下图中所示的,经过组播流量的修剪,最终路径确定为红色的箭头路径为receive客户端到源最短的路径(叫做SPT最短路径),其余的路径被修剪掉了,以节省网络带宽。
2)、组播中客户端源最近的设备叫做:最末跳设备(last hop)
其中R1就是first hop设备,而R2就是last hop设备。假如最右边的R后面也是客户端的话,那么最右边的R也同样是一个last hop设备。
2、Spares-mode,稀疏模式,客户端相对分散(实际部署当中一般都使用spares-mode)
RP(集合点):代理源来转发和接收组播流量的路由器。
R2lasthop会将join信息发给R3,由R3到达源(从R3到达源的路径最短,比走RP要短),而不是走RP,只是开始从RP哪里得到了源的位置,然后开始自己选择最优的路径(但是可以人为的控制让R2lasthop强制从RP到达源而不去自己做switchover的最短路径切换,命令是:ip pim spt-threshold infinity,这个命令有特殊要求的时候和做实验的时候使用,能看到完整的过程。这个命令只有在lasthop上配置才有用)
show ip pim neighbor              查看pim邻居
show ip pim interface               查看哪些接口运行了pim,可以查看到当前的pim是哪种模式
组播中ping是组播ping,单播回复。ping一个组地址,有多少个单播回复,就知道这个组中有多少客户加入。
ping 224.1.1.1         可以得到该组中有哪些客户端 show ip mrouter     查看组播路由表,也就是(S G)表项,其中包括(* G)父表项和子表项(S G)
R1(config-if)#ip pim dense-mode               配置接口为稀疏模式 R1(config-if)#ip pim sparse-mode              配置接口为密集模式 R1(config)#ip pim rp-address x.x.x.x           密集模式中手动指定RP地址
R1(config)#ip pim spt-threshold infinity    密集模式中关闭SPT的switch-over最短路径切换功能(客户端的流量只从RP到源,而不选择最短到源的路径)
debug ip pim
debug ip mrouter *
拓扑如下:
组播Multicast <wbr>2 <wbr>PIM
组播Multicast <wbr>2 <wbr>PIM
一、PIM的dens-mode密集模式
1、底层R1-R3使用IGP搭建,eigrp 1
2、源和PC指网关,并且加入组224.1.1.1
source#show run interface s0/0   Building configuration...
Current configuration : 136 bytes ! interface Serial0/0  ip address 192.168.1.100 255.255.255.0  no ip route-cache  ip igmp join-group 224.1.1.1  clock rate 2000000 end
source(config)#no ip routing source(config)#ip default-gateway 192.168.1.100
source#show run interface s0/0   Building configuration...
Current configuration : 136 bytes ! interface Serial0/3  ip address 172.16.1.1 255.255.255.0  no ip route-cache  ip igmp join-group 224.1.1.1  clock rate 2000000 end
pc(config)#no ip routing pc(config)#ip default-gateway 172.16.1.100
R1上:
interface Serial0/0  ip address 192.168.1.1 255.255.255.0  ip pim dense-mode  clock rate 2000000 !
interface Serial0/0  ip address 12.1.1.1 255.255.255.0  ip pim dense-mode  clock rate 2000000 !
R2上:
interface Serial0/0  ip address 12.1.1.2 255.255.255.0  ip pim dense-mode  clock rate 2000000 !
interface Serial0/0  ip address 23.1.1.2 255.255.255.0  ip pim dense-mode  clock rate 2000000 !
R3上:
interface Serial0/0  ip address 23.1.1.3 255.255.255.0  ip pim dense-mode  clock rate 2000000 !
interface Serial0/0  ip address 172.16.1.1 255.255.255.0  ip pim dense-mode  clock rate 2000000 !
source#ping 224.1.1.1
Type escape sequence to abort. Sending 1, 100-byte ICMP Echos to 224.1.1.1, timeout is 2 seconds:
Reply to request 0 from 172.16.1.100, 36 ms                                                 PC已经响应源的ping source#
R2#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,        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 Outgoing interface flags: H - Hardware switched, A - Assert winner  Timers: Uptime/Expires  Interface state: Interface, Next-Hop or VCD, State/Mode
(*, 224.1.1.1), 00:21:32/00:03:23, RP 2.2.2.2, flags: S   Incoming interface: Null, RPF nbr 0.0.0.0   Outgoing interface list:     Serial0/1, Forward/Sparse, 00:16:21/00:02:47     Serial0/2, Forward/Sparse, 00:21:32/00:03:23                  该接口信息表明S0/2口有组播流量,如IGMP的加组信息流量等,如果没有组播流量(IGMP或者PIM的)的话该接口不会出现在组播路由表中
(192.168.1.100, 224.1.1.1), 00:00:34/00:02:25, flags:   Incoming interface: Serial0/1, RPF nbr 12.1.1.1   Outgoing interface list:     Serial0/2, Forward/Sparse, 00:00:35/00:03:21
(*, 224.0.1.40), 00:22:40/00:03:26, RP 2.2.2.2, flags: SJCL   Incoming interface: Null, RPF nbr 0.0.0.0   Outgoing interface list:     Serial0/2, Forward/Sparse, 00:21:33/00:03:26     Serial0/1, Forward/Sparse, 00:22:40/00:02:49
R2#
二、PIM的sparse-mode稀疏模式
1、R1-R3底层IGP eigrp保证通信
2、源、PC配置不变
source#show run interface s0/0   Building configuration...
Current configuration : 136 bytes ! interface Serial0/0  ip address 192.168.1.100 255.255.255.0  no ip route-cache  ip igmp join-group 224.1.1.1  clock rate 2000000 end
source(config)#no ip routing source(config)#ip default-gateway 192.168.1.100
source#show run interface s0/0   Building configuration...
Current configuration : 136 bytes ! interface Serial0/3  ip address 172.16.1.1 255.255.255.0  no ip route-cache  ip igmp join-group 224.1.1.1  clock rate 2000000 end
pc(config)#no ip routing pc(config)#ip default-gateway 172.16.1.100
R1:
R1#show run interface s0/0 Building configuration...
Current configuration : 105 bytes ! interface Serial0/0  ip address 192.168.1.1 255.255.255.0  ip pim sparse-mode  clock rate 2000000 end
R1#show run interface s0/1 Building configuration...
Current configuration : 102 bytes ! interface Serial0/1  ip address 12.1.1.1 255.255.255.0  ip pim sparse-mode  clock rate 2000000 end
R1#
R1(config)#ip pim rp-address 2.2.2.2                  手工指定RP
R1(config)#exit
R2#show run interface s0/0 Building configuration...
Current configuration : 72 bytes ! interface Serial0/0  no ip address  shutdown  clock rate 2000000 end
R2#show run interface s0/1 Building configuration...
Current configuration : 102 bytes ! interface Serial0/1  ip address 12.1.1.2 255.255.255.0  ip pim sparse-mode  clock rate 2000000 end
R2#show run interface loopback 0        Building configuration...
Current configuration : 63 bytes ! interface Loopback0                                                让R2的loopback0成为RP  ip address 2.2.2.2 255.255.255.255 end
R2#
R2(config)#ip pim rp-address 2.2.2.2                  手工指定RP
R2(config)#exit
R3:
R3#show run interface s0/2 Building configuration...
Current configuration : 102 bytes ! interface Serial0/2  ip address 23.1.1.3 255.255.255.0  ip pim sparse-mode  clock rate 2000000 end
R3#show run interface s0/3 Building configuration...
Current configuration : 104 bytes ! interface Serial0/3  ip address 172.16.1.1 255.255.255.0  ip pim sparse-mode  clock rate 2000000 end
R3#
R3(config)#ip pim rp-address 2.2.2.2                  手工指定RP
R3(config)#exit
验证: source#ping 224.1.1.1
Type escape sequence to abort. Sending 1, 100-byte ICMP Echos to 224.1.1.1, timeout is 2 seconds:
Reply to request 0 from 172.16.1.100, 20 ms                                                    PC的回应 source#
R3#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,        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 Outgoing interface flags: H - Hardware switched, A - Assert winner  Timers: Uptime/Expires  Interface state: Interface, Next-Hop or VCD, State/Mode
(*, 224.1.1.1), 00:01:18/stopped, RP 2.2.2.2, flags: SJCF                           可以看到RP是谁   Incoming interface: Serial0/2, RPF nbr 23.1.1.2   Outgoing interface list:     Serial0/3, Forward/Sparse, 00:01:18/00:02:41
(172.16.1.100, 224.1.1.1), 00:01:16/00:02:22, flags: FT                            用PCping 224.1.1.1得到的路由表项   Incoming interface: Serial0/3, RPF nbr 0.0.0.0, Registering   Outgoing interface list:     Serial0/2, Forward/Sparse, 00:01:16/00:03:12
(192.168.1.100, 224.1.1.1), 00:00:44/00:02:21, flags: JT                          用源ping 224.1.1.1得到的表项   Incoming interface: Serial0/2, RPF nbr 23.1.1.2   Outgoing interface list:     Serial0/3, Forward/Sparse, 00:00:44/00:02:40
(*, 224.0.1.40), 00:01:37/00:02:34, RP 2.2.2.2, flags: SJCL                      cisco默认的   Incoming interface: Serial0/2, RPF nbr 23.1.1.2   Outgoing interface list:     Serial0/3, Forward/Sparse, 00:01:37/00:02:34
T字符代表了该组播路由PIM的稀疏模式已经使用了"switchover的最短路径切换"来选择了最近的到达源的路由,而不是把流量发给RP(当然本例中RP就是最短的到达源的路由器,所以在本例中启不启用switchover无关系)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325996193&siteId=291194637
PIM
PIM
PIM