组播——优选RPF(反向路径转发)路由原则验证
验证理论
RPF路由选举规则:
优选RPF路由原则:
- 掩码最长匹配
- 路由最优优先级(Pre值)
- 组播静态路由>MBGP路由>单播路由
实验拓扑
初始配置
配置接口地址以及AR123之间的OSPF
初始结果
实验步骤
第一步,配置组播
在全局下开启组播,在所有接口下配置pim dm
以AR1为例
multicast routing-enable
#
interface Serial1/0/0
link-protocol ppp
ip address 155.1.13.1 255.255.255.0
pim dm
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/0
ip address 155.1.12.1 255.255.255.0
pim dm
ospf enable 1 area 0.0.0.0
#
interface GigabitEthernet0/0/1
ip address 10.1.1.254 255.255.255.0
pim dm
第二步:
验证最长掩码匹配
首先设置组播静态路由出接口为S1/0/0
[AR3]ip rpf-route-static 10.1.1.0 24 Serial 1/0/0
Info: Succeeded in modifying route.
[AR3]dis multicast rpf-info 10.1.1.0
VPN-Instance: public net
RPF information about source: 10.1.1.0
RPF interface: Serial1/0/0, RPF neighbor: 155.1.13.1
Referenced route/mask: 10.1.1.0/24
Referenced route type: mstatic
Route selection rule: preference-preferred
Load splitting rule: disable
然后增加设置组播静态路由掩码增加到25,下一跳到AR2
[AR3]ip rpf-route-static 10.1.1.0 25 155.1.23.2
[AR3]dis multicast rpf-info 10.1.1.0
VPN-Instance: public net
RPF information about source: 10.1.1.0
RPF interface: GigabitEthernet0/0/1, RPF neighbor: 155.1.23.2
Referenced route/mask: 10.1.1.0/25
Referenced route type: mstatic
Route selection rule: preference-preferred
Load splitting rule: disable
此时再查看RPF,下一跳就变更到了AR2上,可见掩码越长越优先
第三步:
验证路由优先级,优先级越小越优先
首先删除前面的两条静态,然后将10.1.1.0宣告进OSPF,同时在AR2,4之间建立BGP,将10.1.11.0放入BGP中进行传递
AR1:
interface GigabitEthernet0/0/1
ip address 10.1.1.254 255.255.255.0
pim dm
ospf enable 1 area 0.0.0.0
bgp 100
peer 150.1.3.3 as-number 100
peer 150.1.3.3 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
undo peer 150.1.3.3 enable
#
ipv4-family multicast
undo synchronization
peer 150.1.3.3 enable
AR3:
bgp 100
timer connect-retry 5
peer 150.1.1.1 as-number 100
peer 150.1.1.1 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
undo peer 150.1.1.1 enable
#
ipv4-family multicast
undo synchronization
peer 150.1.1.1 enable
#
此时可以看到AR3优选从OSPF学到的,因为OSPF的优先级10比BGP的255更优先
[AR3]dis multicast rpf-info 10.1.1.0
VPN-Instance: public net
RPF information about source: 10.1.1.0
RPF interface: GigabitEthernet0/0/1, RPF neighbor: 155.1.23.2
Referenced route/mask: 10.1.1.0/24
Referenced route type: unicast
Route selection rule: preference-preferred
Load splitting rule: disable
此时注意,通过和BGP比较OSPF的优先级更小,更优先,但是从AR1,2均可通过OSPF学习到10.1.1.0,AR4却选择下一跳为AR2,由此可见,相同协议下,度量值越小越优先
[AR3]dis multicast routing-table
Multicast routing table of VPN-Instance: public net
Total 1 entry
00001. (10.1.1.1, 239.1.1.1)
Uptime: 00:00:14
Upstream Interface: GigabitEthernet0/0/1
第四步:
验证:组播静态路由>MBGP路由>单播路由
增加组播静态路由,在掩码相同的情况下,将静态路由,OSPF的优先级都更改为255
[AR3-ospf-1]preference 255
[AR3]ip rpf-route-static 10.1.1.0 24 155.1.13.1 preference 255
此时优选静态的路由
[AR3]dis multicast rpf-info 10.1.1.0
VPN-Instance: public net
RPF information about source: 10.1.1.0
RPF interface: Serial1/0/0, RPF neighbor: 155.1.13.1
Referenced route/mask: 10.1.1.0/24
Referenced route type: mstatic
Route selection rule: preference-preferred
Load splitting rule: disable
删除静态路由之后,此时优选MBGP:
[AR3]UNDO ip rpf-route-static 10.1.1.0 24
[AR3]dis multicast rpf-info 10.1.1.0
VPN-Instance: public net
RPF information about source: 10.1.1.0
RPF interface: GigabitEthernet0/0/1, RPF neighbor: 155.1.23.2
Referenced route/mask: 10.1.1.0/24
Referenced route type: mbgp
Route selection rule: preference-preferred
Load splitting rule: disable
可见,组播静态路由>MBGP>IGP
第五步
验证通过IGP选举,开销相同时选择下一跳较大IP的邻居
首先,删除MBGP
[AR1-bgp-af-multicast]undo network 10.1.1.0 24
然后设置AR3的接口开销为2
[AR3]dis ip routing-table 10.1.1.0
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Table : Public
Summary Count : 2
Destination/Mask Proto Pre Cost Flags NextHop Interface
10.1.1.0/24 OSPF 255 3 D 155.1.23.2 GigabitEthernet0/0/1
OSPF 255 3 D 155.1.13.1 Serial1/0/0
此时负载均衡,但是AR3还是选择了AR2,因此负载均衡时选择下一跳较大IP的邻居
[AR3]dis multicast rpf-info 10.1.1.0
VPN-Instance: public net
RPF information about source: 10.1.1.0
RPF interface: GigabitEthernet0/0/1, RPF neighbor: 155.1.23.2
Referenced route/mask: 10.1.1.0/24
Referenced route type: unicast
Route selection rule: preference-preferred
Load splitting rule: disable
[AR3]
第六步,在AR3的0/0/0口上开启IGMP
[AR3-GigabitEthernet0/0/0]igmp en
总结
RPF检测规则:
1.掩码越长越优先
2.优先级越小越优先(组播静态优先级默认为1)
3.组播静态>MBGP>IGP
4.相同IGP开销越小越优先
5.相同IGP开销相同,则下一跳IP地址越大越优先