目录
实验条件
网络拓朴
实验环境
实验目的
实验组播功能
开始实验
实验1:PIM-DM
- R1/R2/R3/R5在一个PIM域中,这4台路由器需要开启组播路由功能,同时相应接口需要运行PIM-SM,从而为组播流量进行路由;
- R7/R8/R9模拟主机,分别模拟加入到不同的组播组当中
- R5模拟组播末节路由器,需要与主机R7/R8/R9之间通过IGMP进行通信
查询配置发现R7/R8/R9已经通过igmp-join分别加入了不同或相同的组播组,查看加入的组播情况
R7#show ip igmp groups
IGMP Connected Group Membership
Group Address Interface Uptime Expires Last Reporter Group Accounted
239.1.1.1 Ethernet0/0 00:06:23 never 192.168.2.1
239.1.1.3 Ethernet0/0 00:06:23 never 192.168.2.1 R8#show ip igmp groups
IGMP Connected Group Membership
Group Address Interface Uptime Expires Last Reporter Group Accounted
239.1.1.1 Ethernet0/0 00:07:33 never 192.168.2.1
239.1.1.3 Ethernet0/0 00:07:33 never 192.168.2.1
239.1.1.2 Ethernet0/0 00:07:33 never 192.168.2.2 R9#show ip igmp groups
IGMP Connected Group Membership
Group Address Interface Uptime Expires Last Reporter Group Accounted
239.1.1.3 Ethernet0/0 00:07:57 never 192.168.2.1
239.1.1.2 Ethernet0/0 00:07:57 never 192.168.2.3
三组组播:
Group1:239.1.1.1 R7、R8
Group1:239.1.1.2 R8、R9
Group1:239.1.1.3 R7、R8、R9
配置PIM域中的路由,开启PIM-DM组播路由功能,
R1:
conf t
ip multicast-routing
interface range e0/0-2ip pim dense-modeR2:
conf t
ip multicast-routing
interface range e0/0-1ip pim dense-modeR3:
conf t
ip multicast-routing
interface range e0/1-2ip pim dense-modeR5:
conf t
ip multicast-routing
interface range e0/0, e0/2ip pim dense-mode
验证组播情况
在R6模拟发出组播流量之前,观察各组播路由器的组播路由表情况。
- 发起组播流量前:R1/R2/R3/R5组播路由表暂没有形成(S,G)的表项:
下图是R5上查看的结果,只有组成员发送IGMP report后形成的(*,G)项,无任何(S,G)表项,其他R1/R2/R3也都不会形成
R5#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, G - Received BGP C-Mroute, g - Sent BGP C-Mroute, N - Received BGP Shared-Tree Prune, n - BGP C-Mroute suppressed, Q - Received BGP S-A Route, q - Sent BGP S-A Route, V - RD & Vector, v - Vector, p - PIM Joins on route, x - VxLAN group
Outgoing interface flags: H - Hardware switched, A - Assert winner, p - PIM JoinTimers: Uptime/ExpiresInterface state: Interface, Next-Hop or VCD, State/Mode(*, 239.1.1.1), 00:43:35/00:02:27, RP 0.0.0.0, flags: DCIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/2, Forward/Dense, 00:43:35/stoppedEthernet0/0, Forward/Dense, 00:43:35/stopped(*, 239.1.1.3), 00:43:35/00:02:25, RP 0.0.0.0, flags: DCIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/2, Forward/Dense, 00:43:35/stoppedEthernet0/0, Forward/Dense, 00:43:35/stopped(*, 239.1.1.2), 00:43:35/00:02:25, RP 0.0.0.0, flags: DCIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/2, Forward/Dense, 00:43:35/stoppedEthernet0/0, Forward/Dense, 00:43:35/stopped(*, 224.0.1.40), 00:43:36/00:02:46, RP 0.0.0.0, flags: DCLIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/2, Forward/Dense, 00:43:35/stoppedEthernet0/0, Forward/Dense, 00:43:36/stopped
- R6模拟发出组播流量
R6#ping 239.1.1.1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 239.1.1.1, timeout is 2 seconds:Reply to request 0 from 192.168.2.1, 26 ms
Reply to request 0 from 192.168.2.1, 47 ms
Reply to request 0 from 192.168.2.2, 47 ms
Reply to request 0 from 192.168.2.2, 26 ms
R6#ping 239.1.1.1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 239.1.1.1, timeout is 2 seconds:Reply to request 0 from 192.168.2.1, 1 ms
Reply to request 0 from 192.168.2.2, 1 ms
R6#
再次观察R1/R2/R3/R5组播路由表,已形成(S,G)表项
R1#show ip mroute
......
(*, 239.1.1.3), 00:01:39/stopped, RP 0.0.0.0, flags: DIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/2, Forward/Dense, 00:01:39/stoppedEthernet0/1, Forward/Dense, 00:01:39/stopped(192.168.1.1, 239.1.1.3), 00:01:39/00:01:20, flags: TIncoming interface: Ethernet0/0, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/1, Prune/Dense, 00:01:39/00:01:20Ethernet0/2, Forward/Dense, 00:01:39/stoppedR2#show ip mroute
......
(*, 239.1.1.3), 00:02:03/stopped, RP 0.0.0.0, flags: DIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/1, Forward/Dense, 00:02:03/stoppedEthernet0/0, Forward/Dense, 00:02:03/stopped(192.168.1.1, 239.1.1.3), 00:02:03/00:00:56, flags: PTIncoming interface: Ethernet0/1, RPF nbr 12.1.1.1Outgoing interface list:Ethernet0/0, Prune/Dense, 00:02:03/00:00:58......
上面模拟向239.1.1.1组中发起1个包的流量,第一次发起时由R7/R8组成员分别回复,但是会发现每个组成员均回复了2次,
原因分析:R2、R3作为运行了PIM-DM的路由器,处在一个MA网络中,当有第一次组播流量触发后,会发assert声明报文进行DR选举,但第一次的流量仍然会下发,所以R7、R8会各自接收到R2和R3共2份包,所以就各回复1份;当DR选举完后(R3成为assert winner),所以后续该组播流量就只有R3进行转发,R2会发prune报文进行修剪!
实现结果表明:
- PIM-DM模式是先进行组播流量的push
- 组播流量触发后,各运行PIM-DM的路由器才会形成组播路由表(S,G),形成SPT源树!
- 在MA网络中, Assert声明选举DR失败的一方,将发送prune进行修剪(还有其他可能造成prune的情况,本次实验没有涉及)。
RP_173">实验2:PIM-SM(静态RP)
PIM域为R1/R2/R3/R5,静态指定R3为RP
R1/R2/R3/R5开启组播路由功能,并配置PIM-SM,每台PIM路由器均手工指定R3为RP
(R3上也要指定自己为RP)
重置实验LAB,再来配置实验,以免之前的配置干扰
RP_179">配置PIM域中的路由,开启PIM-SM组播路由功能,并指定RP
R1:
conf t
ip multicast-routing
interface range e0/0-2ip pim sparse-mode
ip pim rp-address 3.3.3.3 overrideR2:
conf t
ip multicast-routing
interface range e0/0-1ip pim sparse-mode
ip pim rp-address 3.3.3.3 overrideR3:
conf t
ip multicast-routing
interface range e0/1-2ip pim sparse-mode
ip pim rp-address 3.3.3.3 overrideR5:
conf t
ip multicast-routing
interface range e0/0, e0/2ip pim sparse-mode
ip pim rp-address 3.3.3.3 override
这里不指定override会让静态指定的RP无效。因为思科路由器会默认开启其它类型的RP协议
这里指定R3为RP(其lo0已经在IGP里通告,可以被其他PIM路由器学习到,该lo0无需接收组播流量,可以不用开启PIM-SM)
- R6模拟发出组播流量前:R5会接受R7/R8/R9的IGMP-join的report报文,本身会形成(,G)表项,同时R5会从RPF接口沿着RP方向发送(,G)join报文形成共享树!
分析:对于本拓扑来说,由于R3被静态指定成RP,所以R5会从RPF接口e0/2发出(*,G)join,被R3-e0/1接收到
R5上观察组播路由表:静态RP为3.3.3.3
R5#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, G - Received BGP C-Mroute, g - Sent BGP C-Mroute, N - Received BGP Shared-Tree Prune, n - BGP C-Mroute suppressed, Q - Received BGP S-A Route, q - Sent BGP S-A Route, V - RD & Vector, v - Vector, p - PIM Joins on route, x - VxLAN group
Outgoing interface flags: H - Hardware switched, A - Assert winner, p - PIM JoinTimers: Uptime/ExpiresInterface state: Interface, Next-Hop or VCD, State/Mode(*, 239.1.1.1), 00:04:14/00:02:45, RP 3.3.3.3, flags: SJCIncoming interface: Ethernet0/2, RPF nbr 2.3.5.3Outgoing interface list:Ethernet0/0, Forward/Sparse, 00:04:13/00:02:45(*, 239.1.1.3), 00:04:14/00:02:46, RP 3.3.3.3, flags: SJCIncoming interface: Ethernet0/2, RPF nbr 2.3.5.3Outgoing interface list:Ethernet0/0, Forward/Sparse, 00:04:13/00:02:46(*, 239.1.1.2), 00:04:13/00:02:46, RP 3.3.3.3, flags: SJCIncoming interface: Ethernet0/2, RPF nbr 2.3.5.3Outgoing interface list:Ethernet0/0, Forward/Sparse, 00:04:13/00:02:46
R3上观察组播路由表:R3接收到(*,G)join报文后,会在组播路由表形成(*,G)表项
:
R3(config)#do 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, G - Received BGP C-Mroute, g - Sent BGP C-Mroute, N - Received BGP Shared-Tree Prune, n - BGP C-Mroute suppressed, Q - Received BGP S-A Route, q - Sent BGP S-A Route, V - RD & Vector, v - Vector, p - PIM Joins on route, x - VxLAN group
Outgoing interface flags: H - Hardware switched, A - Assert winner, p - PIM JoinTimers: Uptime/ExpiresInterface state: Interface, Next-Hop or VCD, State/Mode(*, 239.1.1.1), 00:02:47/00:02:37, RP 3.3.3.3, flags: SIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/1, Forward/Sparse, 00:02:47/00:02:37(*, 239.1.1.3), 00:02:47/00:02:39, RP 3.3.3.3, flags: SIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/1, Forward/Sparse, 00:02:47/00:02:39(*, 239.1.1.2), 00:02:47/00:02:39, RP 3.3.3.3, flags: SIncoming interface: Null, RPF nbr 0.0.0.0Outgoing interface list:Ethernet0/1, Forward/Sparse, 00:02:47/00:02:39
以上从R5的RPF接口开始沿着RP方向到R3之间会形成共享树!
R2上观察组播路由表:由于R2不是RP,同时也不在R5的RPF口沿着RP方向的链路上,所以R2上不会接收到(,G)join报文,不会形成(,G)表项:
R2(config)#do 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, G - Received BGP C-Mroute, g - Sent BGP C-Mroute, N - Received BGP Shared-Tree Prune, n - BGP C-Mroute suppressed, Q - Received BGP S-A Route, q - Sent BGP S-A Route, V - RD & Vector, v - Vector, p - PIM Joins on route, x - VxLAN group
Outgoing interface flags: H - Hardware switched, A - Assert winner, p - PIM JoinTimers: Uptime/ExpiresInterface state: Interface, Next-Hop or VCD, State/Mode(*, 224.0.1.40), 00:02:55/00:02:12, RP 3.3.3.3, flags: SJPLIncoming interface: Ethernet0/0, RPF nbr 2.3.5.3Outgoing interface list: NullR2(config)#
- R6模拟发出组播流量:R1与R3形成GRE-tunnel,然后将组播报文封装成单播发送一个register报文,沿着GRE隧道发送给RP进行注册,RP将报文拆包还原成组播沿着共享树的方向发给R5,同时RP发送register-stop报文给R1,R1-R3之间形成SPT源树!
以下是R3上的组播路由表:
R1(config)#do show ip int br
Interface IP-Address OK? Method Status
......
Loopback0 1.1.1.1 YES TFTP up up
Tunnel0 13.1.1.1 YES unset up up
R1(config)#do show int tunnel0
Tunnel0 is up, line protocol is up Hardware is TunnelDescription: Pim Register Tunnel (Encap) for RP 3.3.3.3Interface is unnumbered. Using address of Ethernet0/2 (13.1.1.1)MTU 17912 bytes, BW 100 Kbit/sec, DLY 50000 usec, reliability 255/255, txload 1/255, rxload 1/255Encapsulation TUNNEL, loopback not setKeepalive not setTunnel linestate evaluation upTunnel source 13.1.1.1 (Ethernet0/2), destination 3.3.3.3Tunnel Subblocks:src-track:Tunnel0 source tracking subblock associated with Ethernet0/2Set of tunnels with source Ethernet0/2, 1 member (includes iterators), on interface <OK>Tunnel protocol/transport PIM/IPv4Tunnel TTL 255Tunnel transport MTU 1472 bytesTunnel is transmit only
......
R1(config)#
以上实验表明:
- PIM-SM是last-hop路由器先沿着RP方向发送join报文形成(*,G)表项,首先构造出一个共享树;
- first-hop到RP之间通过通过GRE隧道发送register报文和register-stop,RP通过反向溯源的方式,成功构造出一个源树;
- 当R5溯源成功后,从RPF口沿着到source的方向沿途形成(S,G),于是完成SPT切换;
- 后续组播流量沿着SPT源树进行下发
RP_354">实验3:PIM-SM(auto-RP)
将R1作为MA,R2/R3作为C-RP,为保证RP相关报文能顺利从PIM-SM接口泛洪,本实验主要是要让R5也能接收,则R2和R3开启autorp listen功能,使得在还没有选出RP的情况下,有关RP选举报文能泛洪出去被R5接收到!
开启PIM-SM组播路由功能
注:由于R1要配置成MA,并配置其lo0要发送rp-discovery报文而都要配置C-RP,并配置其lo0要能发送rp-announce报文
R1:
conf t
ip multicast-routing
interface range e0/0-2ip pim sparse-mode
interface lo 0ip pim sparse-mode
ip pim send-rp-discovery loopback 0 scope 255
ip pim autorp listenerR2:
conf t
ip multicast-routing
interface range e0/0-1ip pim sparse-mode
interface lo 0ip pim sparse-mode
ip pim send-rp-announce loopback 0 scope 255
ip pim autorp listenerR3:
conf t
ip multicast-routing
interface range e0/1-2ip pim sparse-mode
interface lo 0ip pim sparse-mode
ip pim send-rp-announce loopback 0 scope 255R5:
conf t
ip multicast-routing
interface range e0/0, e0/2ip pim sparse-mode
验证结果
R1#show ip pim rp mapping in-use
PIM Group-to-RP Mappings
This system is an RP-mapping agent (Loopback0)Group(s) 224.0.0.0/4RP 3.3.3.3 (?), v2v1Info source: 3.3.3.3 (?), elected via Auto-RPUptime: 00:00:54, expires: 00:02:01RP 2.2.2.2 (?), v2v1Info source: 2.2.2.2 (?), via Auto-RPUptime: 00:01:04, expires: 00:02:52Dynamic (Auto-RP or BSR) RPs in cache that are in use:
R1#
在R5上查看:RP选举结果已经泛洪被R5接收
R5#show ip pim rp mapping in-use
PIM Group-to-RP MappingsGroup(s) 224.0.0.0/4RP 3.3.3.3 (?), v2v1Info source: 1.1.1.1 (?), elected via Auto-RPUptime: 00:01:42, expires: 00:02:14Dynamic (Auto-RP or BSR) RPs in cache that are in use:
Group(s): 224.0.0.0/4, RP: 3.3.3.3, expires: 00:00:57
R5#
现在,整个PIM域中,选举出R3作为RP
RP_430">实验4:PIM-SM(auto-RP)
将R1设置为C-BSR(最终成为BSR),R2/R3设置为C-RP
开始配置
R1:
conf t
ip multicast-routing
interface range e0/0-2ip pim sparse-mode
interface lo 0ip pim sparse-mode
ip pim bsr-candidate lo0 0 0R2:
conf t
ip multicast-routing
interface range e0/0-1ip pim sparse-mode
interface lo 0ip pim sparse-mode
ip pim rp-candidate lo0 priority 0R3:
conf t
ip multicast-routing
interface range e0/1-2ip pim sparse-mode
interface lo 0ip pim sparse-mode
ip pim rp-candidate lo0 priority 0R5:
conf t
ip multicast-routing
interface range e0/0, e0/2ip pim sparse-mode
验证结果
R1#show ip pim bsr-router
PIMv2 Bootstrap information
This system is the Bootstrap Router (BSR)BSR address: 1.1.1.1 (?)Uptime: 00:01:05, BSR Priority: 0, Hash mask length: 0Next bootstrap message in 00:00:56
R1#
R2#show ip pim rp mapping in-use
PIM Group-to-RP Mappings
This system is a candidate RP (v2)Group(s) 224.0.0.0/4RP 2.2.2.2 (?), v2Info source: 1.1.1.1 (?), via bootstrap, priority 0, holdtime 150Uptime: 00:00:47, expires: 00:01:40RP 3.3.3.3 (?), v2Info source: 1.1.1.1 (?), via bootstrap, priority 0, holdtime 150Uptime: 00:00:48, expires: 00:01:40Dynamic (Auto-RP or BSR) RPs in cache that are in use:
Group(s): 224.0.0.0/4, RP: 2.2.2.2, expires: 00:00:58
R2#show ip pim rp-hash 239.1.1.1RP 2.2.2.2 (?), v2Info source: 1.1.1.1 (?), via bootstrap, priority 0, holdtime 150Uptime: 00:01:42, expires: 00:01:45PIMv2 Hash Value (mask 0.0.0.0)RP 2.2.2.2, via bootstrap, priority 0, hash value 1524600152RP 3.3.3.3, via bootstrap, priority 0, hash value 450145259
R2#
注:这里通过RP选举规则第三条:较大的HASH值成为RP(前两条规则比不出来)R2运算得到的hash值更大:
RP 2.2.2.2, via bootstrap, priority 0, hash value 1524600152RP 3.3.3.3, via bootstrap, priority 0, hash value 450145259
- 查看组播路由表:R5上查看组播路由表,当有组播流量后,完成了SPT切换
R5#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, G - Received BGP C-Mroute, g - Sent BGP C-Mroute, N - Received BGP Shared-Tree Prune, n - BGP C-Mroute suppressed, Q - Received BGP S-A Route, q - Sent BGP S-A Route, V - RD & Vector, v - Vector, p - PIM Joins on route, x - VxLAN group
Outgoing interface flags: H - Hardware switched, A - Assert winner, p - PIM JoinTimers: Uptime/ExpiresInterface state: Interface, Next-Hop or VCD, State/Mode(*, 239.1.1.1), 00:38:10/00:02:49, RP 2.2.2.2, flags: SJCIncoming interface: Ethernet0/2, RPF nbr 2.3.5.2Outgoing interface list:Ethernet0/0, Forward/Sparse, 00:38:08/00:02:49(*, 239.1.1.3), 00:38:10/00:02:52, RP 2.2.2.2, flags: SJCIncoming interface: Ethernet0/2, RPF nbr 2.3.5.2Outgoing interface list:Ethernet0/0, Forward/Sparse, 00:38:08/00:02:52(*, 239.1.1.2), 00:38:10/00:02:51, RP 2.2.2.2, flags: SJCIncoming interface: Ethernet0/2, RPF nbr 2.3.5.2Outgoing interface list:Ethernet0/0, Forward/Sparse, 00:38:08/00:02:51
R6模拟发出组播流量,再查看R5路由表(*, 239.1.1.1),变成了从(192.168.1.1,239.1.1.1)从R3转发,完成了SPT切换。