PIM SM模式下BSR與RP選舉機制

PIM SM模式下BSR與RP選舉機制

BSR作用:

BSR:bootstarp router 管理動態選舉RP。選舉出BSR,BSR然後向整個網絡通告自己的存在。PIM-SM路由器偵聽BSR洪泛的通過,並保存BSR信息。而C-RP(候選RP)則向BSR發送候選通告。BSR收集所有的C-RP信息,將彙總的信息進行全網洪泛。PIM-SM路由器會收到BSR洪泛的信息,根據相同的算法計算出組播組和RP的映射關係。

BSR通過多個C-BSR(候選BSR)通過PIM自舉(bootstarp)選舉而出,根據優先級、最大IP作爲條件依次選舉。

RP作用:

RP:rendezvous point 組播流量匯聚點。1、組播源以單播的形式向RP註冊,從組播源接收流量,構建組播源到RP的SPT。2、組播路由器向RP發起PIM加入報文,構建自己與RP之間的RPT。最後一條路由器接收到組播流量後,RFC檢查通過後,會自動觸發RPT向SPT切換機制。RP可以通過靜態指定,也可以通過動態選舉。

實驗如下圖:

R1-R6之間使用OSPF協議,接口建立PIM-SM 鄰居,各個接口之間爲30位掩碼IP互聯。

R2:爲C-RP,組播範圍爲239.0.0.0/24,優先級爲100;R3:爲C-RP,優先級爲0,組播範圍爲默認224.0.0.0/4。

R4:爲C-BSR,哈希掩碼長度默認爲30,優先級爲100;R5:爲C-BSR,哈希掩碼長度默認爲30,優先級爲0。

MSC1:239.0.0.10;MSC2:238.0.0.10,PC1:192.168.1.2,PC2:192.168.1.3

配置如下:

R1:
#
multicast routing-enable
#

#
interface Ethernet0/0/0
 description MSC1
 ip address 192.168.0.1 255.255.255.252
 pim sm
#
interface Ethernet0/0/1
 description to-r2
 ip address 192.168.0.9 255.255.255.252
 pim sm
#
interface GigabitEthernet0/0/0
 description to-r3
 ip address 192.168.0.13 255.255.255.252
 pim sm
#
interface GigabitEthernet0/0/1
 description MCS2
 ip address 192.168.0.5 255.255.255.252
 pim sm
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255
#
ospf 1
 area 0.0.0.0
  network 192.168.0.0 0.0.0.3
  network 192.168.0.8 0.0.0.3
  network 192.168.0.12 0.0.0.3
  network 192.168.0.4 0.0.0.3
#
-----------------------------------------------
R2:
#
multicast routing-enable
#
acl number 2000
 rule 5 permit source 239.0.0.0 0.0.0.255
#
#
interface Ethernet0/0/0
 description to-r1
 ip address 192.168.0.10 255.255.255.252
 pim sm
#
interface Ethernet0/0/1
 description to-r3
 ip address 192.168.0.18 255.255.255.252
 pim sm
#
interface GigabitEthernet0/0/0
 description to-r4
 ip address 192.168.0.21 255.255.255.252
 pim sm
#
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255
 pim sm
#
ospf 1
 area 0.0.0.0
  network 192.168.0.8 0.0.0.3
  network 192.168.0.16 0.0.0.3
  network 192.168.0.20 0.0.0.3
  network 2.2.2.2 0.0.0.0
#
pim
 c-rp LoopBack0 group-policy 2000 priority 100 ///loopback0需要使能pim,優先級100,組播範圍爲ACl2000限制(239.0.0.0/24)
#
----------------------------------
R3:
#
multicast routing-enable
#
interface Ethernet0/0/0
 description to-r1
 ip address 192.168.0.14 255.255.255.252
 pim sm
#
interface Ethernet0/0/1
 description to-r2
 ip address 192.168.0.17 255.255.255.252
 pim sm
#
interface GigabitEthernet0/0/0
 description to-r5
 ip address 192.168.0.25 255.255.255.252
 pim sm
#
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255
 pim sm
#
ospf 1
 area 0.0.0.0
  network 192.168.0.12 0.0.0.3
  network 192.168.0.16 0.0.0.3
  network 192.168.0.24 0.0.0.3
  network 3.3.3.3 0.0.0.0
#
pim
 c-rp LoopBack0 ////優先級默認爲0,組播組默認範圍224.0.0.0/4
#
---------------------------------
R4:
#
multicast routing-enable
#
interface Ethernet0/0/0
 description to-r2
 ip address 192.168.0.22 255.255.255.252
 pim sm
#
interface Ethernet0/0/1
 description to-r5
 ip address 192.168.0.29 255.255.255.252
 pim sm
#
interface GigabitEthernet0/0/0
 description to-r6
 ip address 192.168.0.33 255.255.255.252
 pim sm
#
#
interface LoopBack0
 ip address 4.4.4.4 255.255.255.255
 pim sm
#
ospf 1
 area 0.0.0.0
  network 192.168.0.20 0.0.0.3
  network 192.168.0.28 0.0.0.3
  network 192.168.0.32 0.0.0.3
  network 4.4.4.4 0.0.0.0
#
pim
 c-bsr priority 100 ////BSR優先級爲100,哈希掩碼長度默認30
 c-bsr LoopBack0 ////loopbackp0必須使能pim sm
#
----------------------------------------
R5:
#
multicast routing-enable
#
#
interface Ethernet0/0/0
 description to-r4
 ip address 192.168.0.30 255.255.255.252
 pim sm
#
interface Ethernet0/0/1
 description to-r3
 ip address 192.168.0.26 255.255.255.252
 pim sm
#
#
interface GigabitEthernet0/0/0
 description to-r6
 ip address 192.168.0.37 255.255.255.252
 pim sm
#
#
interface LoopBack0
 ip address 5.5.5.5 255.255.255.255
 pim sm
#
ospf 1
 area 0.0.0.0
  network 192.168.0.24 0.0.0.3
  network 192.168.0.28 0.0.0.3
  network 192.168.0.36 0.0.0.3
  network 5.5.5.5 0.0.0.0
#
pim
 c-bsr LoopBack0 ////BSR優先級爲默認值0,哈希掩碼長度默認30,loopbackp0必須使能pim sm
#
---------------------------------
R6:
#
multicast routing-enable
#
interface Ethernet0/0/0
 description to-r5
 ip address 192.168.0.38 255.255.255.252
 pim sm
#
interface Ethernet0/0/1
 description to-r4
 ip address 192.168.0.34 255.255.255.252
 pim sm
#
interface GigabitEthernet0/0/0
 description to-user
 ip address 192.168.1.1 255.255.255.0
 pim sm
 igmp enable  ////最後一跳路由器,使能igmp。
#
interface LoopBack0
 ip address 6.6.6.6 255.255.255.255
 pim sm
#
ospf 1
 area 0.0.0.0
  network 192.168.0.36 0.0.0.3
  network 192.168.0.32 0.0.0.3
  network 192.168.1.0 0.0.0.255
#

PC1加入238.0.0.10;PC2加入239.0.0.10時:

在R6已經由RPT切換到SPT,其中SPT ACT標誌。針對與238.0.0.10的RP爲3.3.3.3,239.0.0.10的RP爲2.2.2.2。

RP以及BSR選舉結果如下:

組播組與RP的映射關係

1、BSR選舉機制

C-BSR以組播(239.0.0.13)洪泛PIM自舉報文。1、C-BSR優先級,值大者優選;2、C-BSR的IP(均配置爲loopback地址),IP大者優選。

2、動態RP選舉機制

    2.1、C-RP所服務的組播組範圍與該組播組地址匹配度最長的C-RP勝出。即239.0.0.0的RP爲2.2.2.2

    2.2、組播組範圍相同,C-RP優先級最小的勝出。

    2.3、C-RP優先級相同,將組播組地址、BSR哈希掩碼、C-RP地址作爲哈希函數參數,得出哈希值最大的勝出。

    2.4、如果哈希值相等,則C-RP的Ip地址最大的勝出。

3、DR選舉後,斷言機制

R6會收到R4和R5相同的組播源的組播報文,此時觸發斷言機制,選舉出DR,由DR負責組播報文轉發。選舉出R5作爲DR。這樣就避免了收到重複發報文。組成員所在的網段中的DR負責向RP發起RPT加入。同時,組播源所在的網段中方的DR負責向RP發起組播源註冊過程。

選舉機制:

  3.1、DR優先級 pim hello-option dr-priority 

  3.2、優先級相同,比IP大的勝出。

  3.3、對方若不支持hello攜帶DR優先級,就比IP大的勝出。

3、RPT與SPT切換

組播源向R1發送組播報文,R1(DR)通過單播報文向RP發起組播源註冊(register),此單播報文封裝了源、組播組;

RP通過解封註冊報文,得到組播源。RP與組播源建立起SPT。SPT構建完成後,RP收到組播流量,此時向R1發送PIM註冊停止報文,R1停止發送註冊報文.

PC1宣告加入組播組,發送組成員關係查詢報告宣佈加入組播組,R6收到IGMP的組成員關係查詢報文後,在PIM路由表中創建(*,238.0.0.10)表項。R6向RP(R3)發起加入RPT,R4和R5通過DR選舉,R5勝出。R5作爲RPT進行組播報文轉發。R6與R3之間構成RPT。當R6收到第一個組播報文後,會立即觸發RPT切換SPT,以達到最優路徑問題。

即:MSC2-R1-R3-R5-R6-PC2。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章