PIM内容汇总

缩写:MD,组播域;mSRC,组播源;mDST,组播目的地;RP,汇聚点;intf,端口;RT,路由器;USRT,上游路由器;DSRT,下游路由器
RPF:PIM里最关键的技术。由于组播没有可供RT收集的目的地信息,也就是说组播域内的RT没有路由收敛的概念,因此RT必须通过一定手段防止环路。RPF就是告诉RT,哪个端口才应该接收组播包。若不是从该端口收到的组播包,则判断其经过了环路,应该将其丢弃。RPF地址及端口与路由表项一致;
PIM:使用Hello建立邻居关系;使用PIM-Prune请求USRT停止转发组播,使用PIM-Join请求USRT转发组播
PIM-DM
使用PIM-Prune通告邻居,不需要相应的multicast流量。密集模式下,针对不同的(源,组播地址)生成不同的SPT。源树是由mSRC驱动的,即mSRC发送组播数据包后,所有收到该组播包的PIM-DM RT都将根据该数据包的(S,G)计算RPF,生成相应的SPT。这时,所有PIM-DM的RT,除了RPF intf以外,都转发该RPF,若遇到非RPF intf接收到组播包的情况,则向该端口发送PIM-Prune主动终断该部分的连接。而若在3min内RT所有PIM-DM模式的non-RPF intf为以下两种情况之一:
一、没有收到IGMP Report(IGMP v1)或收到IGMP Leave(IGMP v2);
二、收到PIM-Prune;
则认为本RT不需要组播包,并向RPF intf发送PIM-Prune要求停止发送(S,G)的组播。RT接收到PIM-Prune的端口,若为广播多路访问端口,将等待3sec,目的是为了等待其它同一广播域的RT发送Join,此称为prune override。若3s过后没有PIM-Join,则将其状态置为Dense/Prune,停止转发组播,并设置3min的定时器,若定时器时间内收到PIM-Prune,则重置定时器;否则重新将该端口置为Dense/Forward,继续转发组播。
若intf收到DSRT发送的PIM-Graft,则表明需要立即恢复接收组播,若该端口被置为Dense/Prune,则重置为Dense/Forward并转发。
PIM-SM
使用PIM-join通告邻居,需要连接到RP上接收所有的(或指定的)流量。稀疏模式下,默认所有组播地址都使用同一棵根树(RPT)。根树是由mDST驱动的,即mDST发送组播请求后,以指向RP的RPF为上游方向发送PIM-Join,最终到达RP,从而建立一棵完整的RPT,。当且仅当RP收到至少一个IGMP-Report或者PIM-Join后,才开始转发mSRC发送到的组播包。
注意有三步:1、DSRT使用PIM-Join连接到RP;2、RP接受mSRC所发送的PIM-Reg单播包,并通过RPT组播到mDST;3、RP发送PIM-Join到mSRC,建立SPT,之后mSRC到RP的数据流就使用组播发送;4、mDST获取组播包,了解了mSRC后,可主动发送PIM-Join到mSRC,建立SPT,并往USRT发送PIM-Prune删除RPT。
PIM-SDM:由于PIM-SM在使用auto-RP时,前期不知道RP的位置。为确保能接收到224.0.1.40(RP Discovery)的组播包,首先使用PIM-DM进行组播包接收,待收到RP Discovery之后,确定了RP位置,再转回PIM-SM模式。这就是PIM-SDM。
  关联RP的方式 一、静态指定
在全局配置模式下输入:ip pim rp-address rp-address [acl] [override]
二、Auto-RP
使用Auto-RP时,RP通过224.0.1.39向所有agent发送rp-announce,agent收到这些rp-announce后,选择最优RP,并通过224.0.1.40向所有PIM-SM成员发送rp-discovery。注意:由于224.0.1.39、224.0.1.40也是两个不同的组播域,要接收这些组播信息,必须生成相对应的SPT,这就是为何需要PIM-SDM的原因了。
三、BootStrap Router(BSR)
candidate-BSR往224.0.0.13发送bootstrap msg,其它c-BSR收到后共同选举出一个BSR。而candidate-RP收到这些msg后,以unicast形式发送c-rp-adv给所选定的BSR。BSR在通过224.0.0.13向所有PIM RT通告所有的c-RP。PIM RT自己判断使用哪个RP。
四、MSDP
无论使用Auto-RP或者BSR,只要所有的RP使用同一个IP地址,即可实现同组Load-Balance。但如何使这些RP为根的RPT之间转发组播呢?答案是MSDP。运行MSTP后,RP之间会交换所有已知mSRC的IP,其余RP将与该源建立SPT,最后实现LB。
路由条目
SPT:源树,以(S,G)节点生成图。其中RPF指向mSRC,incoming intf为指向mSRC的端口,其它intf均为outgoing intf。若incoming intf为null,且RPF为0.0.0.0,则本RT直连mSRC;
RPT:根树,以(*,G)节点生成图。其中RPF指向RP,incoming intf为指向RP的端口,若有端口收到PIM-join,则置该端口为outgong intf。若incoming intf为null,且RPF为0.0.0.0,则该RT直连RP。
flags:
D:以PIM-DM模式转发;
S:以PIM-SM模式转发;
P:该条目已经被Prune;
C:DST直连,指该RT为收到IGMP report的路由器;
J:(仅用于PIM-SM)RPT-〉SPT,指通过本RT的multicast已从RPT转为SPT进行转发。当该条目用于(*,G)里面,代表SPT-Threshold已经超过预定值(Cisco默认1min0字节),下一个包将引发建立SPT;当条目用于(S,G)里面,表示SPT-Threshold已经低于预定值,将删除SPT重新使用RPT;
T:SPT,使用SPT进行转发;
L:RT本身就是组播成员;
F:(没搞懂)

Topo

由于配置基本一样,只贴出R2(RP)、R3、R8的配置:

RP:

hostname R2
ip cef
ip multicast-routing
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
ip pim sparse-dense-mode
!
interface FastEthernet0/0
ip address 172.16.12.2 255.255.255.0
ip pim sparse-dense-mode
!
interface FastEthernet1/4
no switchport
ip address 172.16.24.2 255.255.255.0
ip pim sparse-dense-mode
!
interface FastEthernet1/5
no switchport
ip address 172.16.25.2 255.255.255.0
ip pim sparse-dense-mode
!
interface FastEthernet1/7
no switchport
ip address 172.16.27.2 255.255.255.0
ip pim sparse-dense-mode
!
interface FastEthernet1/8
no switchport
ip address 172.16.28.2 255.255.255.0
ip pim sparse-dense-mode
!
router ospf 100
router-id 2.2.2.2
log-adjacency-changes
passive-interface Loopback0
network 2.2.2.2 0.0.0.0 area 0
network 172.16.12.2 0.0.0.0 area 0
network 172.16.24.2 0.0.0.0 area 0
network 172.16.25.2 0.0.0.0 area 0
network 172.16.27.2 0.0.0.0 area 0
network 172.16.28.2 0.0.0.0 area 0
!
ip pim send-rp-announce Loopback0 scope 2
ip pim send-rp-discovery Loopback0 scope 2
ip pim rp-candidate Loopback0 priority 5
!
end

------------------------------------------------

Source:

hostname R3
ip cef
ip multicast-routing
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface Loopback1
ip address 3.0.0.1 255.255.255.0
ip ospf network point-to-point
!
interface FastEthernet0/0
ip address 172.16.13.3 255.255.255.0
ip pim sparse-dense-mode
!
interface Serial0/0
ip address 172.16.34.3 255.255.255.0
ip pim sparse-dense-mode
!
interface Serial0/1
ip address 172.16.36.3 255.255.255.0
ip pim sparse-dense-mode
!
router ospf 100
router-id 3.3.3.3
log-adjacency-changes
passive-interface Loopback0
passive-interface Loopback1
network 3.0.0.1 0.0.0.0 area 345
network 3.3.3.3 0.0.0.0 area 345
network 172.16.13.3 0.0.0.0 area 0
network 172.16.34.3 0.0.0.0 area 345
network 172.16.36.3 0.0.0.0 area 36
!
end

------------------------------------------------

Destination:

hostname R8
ip cef
ip multicast-routing
!
interface Loopback0
ip address 8.8.8.8 255.255.255.255
!
interface Loopback1
ip address 8.0.0.1 255.255.255.0
ip pim sparse-dense-mode
ip igmp join-group 224.8.8.8
ip ospf network point-to-point
!
interface Serial0/0
ip address 172.16.58.8 255.255.255.0
ip pim sparse-dense-mode
!
interface FastEthernet0/1
ip address 172.16.28.8 255.255.255.0
ip pim sparse-dense-mode
!
interface Serial0/1
ip address 172.16.78.8 255.255.255.0
ip pim sparse-dense-mode
!
router ospf 100
router-id 8.8.8.8
log-adjacency-changes
passive-interface Loopback0
passive-interface Loopback1
network 8.0.0.1 0.0.0.0 area 678
network 8.8.8.8 0.0.0.0 area 678
network 172.16.28.8 0.0.0.0 area 0
network 172.16.58.8 0.0.0.0 area 58
network 172.16.78.8 0.0.0.0 area 678
!
end

------------------------------------------------

其中红色字体代表RP专用配置。首先loopback口必须配置为pim sparse-dense-mode,否则下述配置报错;send-rp-announce用于向RP Agent通告RP所在,并在本地mrouting table生成(2.2.2.2,224.0.1.39)、(*,224.0.1.39)条目;send-rp-discovery用于RP Agent,用于向PIM Sparse-mode路由器通告RP所在,并生成(2.2.2.2,224.0.1.40)和(*,224.0.1.40)条目。最后由于本实验使用R1、R2作为RP,因此需要配置优先级(优先级数值越小越高)。

绿色字体代表PIM稀疏密集模式配置,包括启动ip multicast-routing、端口下启动PIM-SPARSE-DENSE模式。

紫色字体用于测试,使R8的LoopBack 1端口模拟加入组播组224.8.8.8。

Log如下:

R8#conf t
R8(config)#in l1
R8(config-if)#ip igmp join 224.8.8.8
*Mar  1 04:17:12.238: PIM(0): Check RP 2.2.2.2 into the (*, 224.8.8.8) entry
*Mar  1 04:17:12.242: PIM(0): Building Triggered (*,G) Join / (S,G,RP-bit) Prune message for 224.8.8.8
*Mar  1 04:17:12.242: PIM(0): Insert (*,224.8.8.8) join in nbr 172.16.28.2's queue
*Mar  1 04:17:12.246: PIM(0): Building Join/Prune packet for nbr 172.16.28.2
*Mar  1 04:17:12.250: PIM(0): Adding v2 (2.2.2.2/32, 224.8.8.8), WC-bit, RPT-bit, S-bit Join
*Mar  1 04:17:12.250: PIM(0): Send v2 join/prune to 172.16.28.2 (FastEthernet0/1)
*Mar  1 04:17:22.382: PIM(0): Insert (172.16.36.3,224.8.8.8) join in nbr 172.16.28.2's queue
*Mar  1 04:17:22.382: PIM(0): Building Join/Prune packet for nbr 172.16.28.2
*Mar  1 04:17:22.386: PIM(0): Adding v2 (172.16.36.3/32, 224.8.8.8), S-bit Join
*Mar  1 04:17:22.386: PIM(0): Send v2 join/prune to 172.16.28.2 (FastEthernet0/1)
*Mar  1 04:17:22.550: PIM(0): Insert (172.16.13.3,224.8.8.8) join in nbr 172.16.28.2's queue
*Mar  1 04:17:22.554: PIM(0): Insert (172.16.34.3,224.8.8.8) join in nbr 172.16.28.2's queue
*Mar  1 04:17:22.558: PIM(0): Building Join/Prune packet for nbr 172.16.28.2
*Mar  1 04:17:22.558: PIM(0): Adding v2 (172.16.13.3/32, 224.8.8.8), S-bit Join
*Mar  1 04:17:22.562: PIM(0): Adding v2 (172.16.34.3/32, 224.8.8.8), S-bit Join
*Mar  1 04:17:22.562: PIM(0): Send v2 join/prune to 172.16.28.2 (FastEthernet0/1)

R8#show ip mroute 224.8.8.8
(*, 224.8.8.8), 00:00:52/stopped, RP 2.2.2.2, flags: SJCL
  Incoming interface: FastEthernet0/1, RPF nbr 172.16.28.2
  Outgoing interface list:
    Loopback1, Forward/Sparse-Dense, 00:00:52/00:02:07

(172.16.13.3, 224.8.8.8), 00:00:42/00:02:26, flags: LJT
  Incoming interface: FastEthernet0/1, RPF nbr 172.16.28.2
  Outgoing interface list:
    Loopback1, Forward/Sparse-Dense, 00:00:42/00:02:17

(172.16.34.3, 224.8.8.8), 00:00:42/00:02:26, flags: LJT
  Incoming interface: FastEthernet0/1, RPF nbr 172.16.28.2
  Outgoing interface list:
    Loopback1, Forward/Sparse-Dense, 00:00:42/00:02:17

(172.16.36.3, 224.8.8.8), 00:00:42/00:02:26, flags: LJT
  Incoming interface: FastEthernet0/1, RPF nbr 172.16.28.2
  Outgoing interface list:
    Loopback1, Forward/Sparse-Dense, 00:00:42/00:02:17

主要观察R8 mroute条目里的Flags:第1个条目,S代表这是稀疏模式使用的条目,这是因为224.8.8.8组播组是使用RPT进行转发的;C代表其中一个接口连接组播目的地(Loopback1),L代表路由器本身就是组播成员(端口下配的igmp join-group)。关键是J。在RPT条目内,J代表该RPT已达到了SPT-Thresthold的值,将通过新生成的SPT进行转发。因此RPT条目状态已改为stopped;

而2-4个条目为SPT条目,J代表该条目为RPT超过SPT-Thresthold后生成的。若在一段时间(蓝色字体表示)内流量没超过阀值则失效。由于J标识是由RPT生成的,因此可以判断该路由器PIM为稀疏模式。

-----------------------------------------------------------
R2#debug ip pim
PIM debugging is on
R2#
*Mar  1 04:49:38.782: PIM(0): Received v2 Join/Prune on FastEthernet1/8 from 172.16.28.8, to us
*Mar  1 04:49:38.786: PIM(0): Join-list: (*, 224.8.8.8), RPT-bit set, WC-bit set, S-bit set
*Mar  1 04:49:38.786: PIM(0): Check RP 2.2.2.2 into the (*, 224.8.8.8) entry
*Mar  1 04:49:38.790: PIM(0): Add FastEthernet1/8/172.16.28.8 to (*, 224.8.8.8), Forward state, by PIM *G Join
*Mar  1 04:49:48.590: PIM(0): Received v2 Register on FastEthernet0/0 from 172.16.16.6 for 172.16.36.3, group 224.8.8.8
*Mar  1 04:49:48.598: PIM(0): Insert (172.16.36.3,224.8.8.8) join in nbr 172.16.12.1's queue
*Mar  1 04:49:48.598: PIM(0): Forward decapsulated data packet for 224.8.8.8 on FastEthernet1/8
*Mar  1 04:49:48.602: PIM(0): Building Join/Prune packet for nbr 172.16.12.1
*Mar  1 04:49:48.602: PIM(0): Adding v2 (172.16.36.3/32, 224.8.8.8), S-bit Join
*Mar  1 04:49:48.602: PIM(0): Send v2 join/prune to 172.16.12.1 (FastEthernet0/0)
*Mar  1 04:49:48.610: PIM(0): Received v2 Register on FastEthernet0/0 from 172.16.13.3 for 172.16.13.3, group 224.8.8.8
*Mar  1 04:49:48.614: PIM(0): Insert (172.16.13.3,224.8.8.8) join in nbr 172.16.12.1's queue
*Mar  1 04:49:48.618: PIM(0): Forward decapsulated data packet for 224.8.8.8 on FastEthernet1/8
*Mar  1 04:49:48.618: PIM(0): Received v2 Register on FastEthernet1/4 from 172.16.24.4 for 172.16.34.3, group 224.8.8.8
*Mar  1 04:49:48.622: PIM(0): Insert (172.16.34.3,224.8.8.8) join in nbr 172.16.24.4's queue
*Mar  1 04:49:48.622: PIM(0): Forward decapsulated data packet for 224.8.8.8 on FastEthernet1/8
*Mar  1 04:49:48.626: PIM(0): Building Join/Prune packet for nbr 172.16.24.4
*Mar  1 04:49:48.626: PIM(0): Adding v2 (172.16.34.3/32, 224.8.8.8), S-bit Join
*Mar  1 04:49:48.626: PIM(0): Send v2 join/prune to 172.16.24.4 (FastEthernet1/4)
*Mar  1 04:49:48.630: PIM(0): Building Join/Prune packet for nbr 172.16.12.1
*Mar  1 04:49:48.630: PIM(0): Adding v2 (172.16.13.3/32, 224.8.8.8), S-bit Join
*Mar  1 04:49:48.634: PIM(0): Send v2 join/prune to 172.16.12.1 (FastEthernet0/0)
*Mar  1 04:49:48.650: PIM(0): Received v2 Join/Prune on FastEthernet1/8 from 172.16.28.8, to us
*Mar  1 04:49:48.654: PIM(0): Join-list: (172.16.36.3/32, 224.8.8.8), S-bit set
*Mar  1 04:49:48.654: PIM(0): Update FastEthernet1/8/172.16.28.8 to (172.16.36.3, 224.8.8.8), Forward state, by PIM SG Join
*Mar  1 04:49:48.670: PIM(0): Received v2 Join/Prune on FastEthernet1/8 from 172.16.28.8, to us
*Mar  1 04:49:48.670: PIM(0): Join-list: (172.16.13.3/32, 224.8.8.8), S-bit set
*Mar  1 04:49:48.670: PIM(0): Update FastEthernet1/8/172.16.28.8 to (172.16.13.3, 224.8.8.8), Forward state, by PIM SG Join
*Mar  1 04:49:48.674: PIM(0): Join-list: (172.16.34.3/32, 224.8.8.8), S-bit set
*Mar  1 04:49:48.674: PIM(0): Update FastEthernet1/8/172.16.28.8 to (172.16.34.3, 224.8.8.8), Forward state, by PIM
R2#show ip mroute 224.8.8.8
(*, 224.8.8.8), 00:01:03/00:03:25, RP 2.2.2.2, flags: S
  Incoming interface: Null, RPF nbr 0.0.0.0
  Outgoing interface list:
    FastEthernet1/8, Forward/Sparse-Dense, 00:01:03/00:03:25

(172.16.13.3, 224.8.8.8), 00:00:53/00:02:06, flags:
  Incoming interface: FastEthernet0/0, RPF nbr 172.16.12.1
  Outgoing interface list:
    FastEthernet1/8, Forward/Sparse-Dense, 00:00:53/00:03:25

(172.16.34.3, 224.8.8.8), 00:00:53/00:02:06, flags:
  Incoming interface: FastEthernet1/4, RPF nbr 172.16.24.4
  Outgoing interface list:
    FastEthernet1/8, Forward/Sparse-Dense, 00:00:53/00:03:25

(172.16.36.3, 224.8.8.8), 00:00:53/00:02:06, flags:
  Incoming interface: FastEthernet0/0, RPF nbr 172.16.12.1
  Outgoing interface list:
    FastEthernet1/8, Forward/Sparse-Dense, 00:00:53/00:03:25

--------------------------------------------------------------

R3#debug ip pim
PIM debugging is on
R3#ping 224.8.8.8

Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 224.8.8.8, timeout is 2 seconds:

Reply to request 0 from 172.16.28.8, 624 ms
Reply to request 0 from 172.16.28.8, 764 ms
Reply to request 0 from 172.16.28.8, 720 ms

*Mar  1 04:45:01.846: PIM(0): Check RP 2.2.2.2 into the (*, 224.8.8.8) entry
*Mar  1 04:45:01.850: PIM(0): Send v2 Register to 2.2.2.2 for 172.16.13.3, group 224.8.8.8

*Mar  1 04:46:00.306: PIM(0): Building Periodic (*,G) Join / (S,G,RP-bit) Prune message for 224.8.8.8
*Mar  1 04:46:08.886: PIM(0): Send v2 Null Register to 2.2.2.2
*Mar  1 04:46:09.070: PIM(0): Received v2 Register-Stop on FastEthernet0/0 from 2.2.2.2 for source 0.0.0.0, group 0.0.0.0
*Mar  1 04:46:59.186: PIM(0): Building Periodic (*,G) Join / (S,G,RP-bit) Prune message for 224.8.8.8
*Mar  1 04:47:18.886: PIM(0): Send v2 Null Register to 2.2.2.2
*Mar  1 04:47:19.162: PIM(0): Received v2 Register-Stop on FastEthernet0/0 from 2.2.2.2 for source 0.0.0.0, group 0.0.0.0

R3#show ip mroute 224.8.8.8
(*, 224.8.8.8), 00:01:08/stopped, RP 2.2.2.2, flags: SPF
  Incoming interface: FastEthernet0/0, RPF nbr 172.16.13.1
  Outgoing interface list: Null

(172.16.13.3, 224.8.8.8), 00:01:08/00:01:58, flags: PFT
  Incoming interface: FastEthernet0/0, RPF nbr 0.0.0.0, Registering
  Outgoing interface list: Null

从R3的RPT条目可以看出,该条目已经Stopped,因为RP(R2)不再相应其Register消息。

你可能感兴趣的:(职场,休闲,pim,组播,RP)