配置PIM-SM
涉及知识点:
*静态配置RP
*PIM-SM出口只记录Forward状态的接口
*配置Auto-RP,RP的选择
*配置BSR,RP的选择
说明:实验基本配置如上图所示
1 开启组播路由功能
(1)在每台路由器上开启组播路由功能
R1-R6:
R1(config)#ip multicast-routing
2 在接口上开启Pim Sparse-Mode
说明:在全网所有路由器的所有接口上开启PIM,从而建立PIM邻居,要在所有接口开启是因为要让PIM自己决定该在什么接口转发组播,这样可以避免RPF检测失败,因为有可能只开部分接口,将导致接口不符合RPF接口而组播失败!
(1)在所有路由器的每个接口上开启PIM
R1(config)#int fa0/0
R1(config-if)#ip pim sparse-mode
其他路由器接口同理!
3 将R5加入组224.6.6.6
(1)配置R6加入组224.6.6.6
R5(config)#int s1/0
R5(config-if)#ip igmp join-group 224.6.6.6
4 静态配置R4为RP
说明:将R4的环回口配置为RP,静态配置RP时,RP的接口可以不开启PIM。手工配置就需要在每一台路由器上都配置静态RP
(1)在R1上静态配置R4为RP,其他路由器同理
R1(config)#ip pim rp-address 4.4.4.4
说明:配置后面的不跟上ACL限制,就默认该地址为所有组的RP
(2)在R1上查看PIM路由器的RP情况
R1#show ip pim rp mapping
PIM Group-to-RP Mappings
Group(s): 224.0.0.0/4, Static
RP: 4.4.4.4 (?)
说明:R1已经正常看到所有组的RP为4.4.4.4,其他路由器同理
(3)查看RP到组成员的组播树情况
R4#show ip mroute
IP Multicast Routing Table
(*, 224.6.6.6), 00:05:37/00:02:46, RP 4.4.4.4, flags: S
Incoming interface: Null, RPF nbr 0.0.0.0
Outgoing interface list:
FastEthernet0/0, Forward/Sparse, 00:05:37/00:02:46
(*, 224.0.1.40), 00:13:10/00:02:50, RP 4.4.4.4, flags: SJCL
Incoming interface: Null, RPF nbr 0.0.0.0
Outgoing interface list:
FastEthernet0/0, Forward/Sparse, 00:05:39/00:02:45
FastEthernet0/1, Forward/Sparse, 00:13:13/00:02:47
说明:在PIM-SM模式中,组成员会主动加入组,所以RP到组成员之间在没有源的情况下也会形成组播树;从输出可以看到RP到组成员的接口已经被标记为Forward,所以RP在有组播流量的情况下,是会向组成员发送的。
(4)查看R5上的组播路由表
R5#show ip mroute
IP Multicast Routing Table
Interface state: Interface, Next-Hop or VCD, State/Mode
(*, 224.6.6.6), 00:10:22/00:02:58, RP 4.4.4.4, flags: S
Incoming interface: FastEthernet0/0, RPF nbr 45.1.1.4
Outgoing interface list:
Serial1/0, Forward/Sparse, 00:10:22/00:02:58
(*, 224.0.1.40), 00:17:42/00:02:45, RP 4.4.4.4, flags: SJCL
Incoming interface: FastEthernet0/0, RPF nbr 45.1.1.4
Outgoing interface list:
FastEthernet0/1, Forward/Sparse, 00:09:28/00:02:53
Serial1/0, Forward/Sparse, 00:10:24/00:02:57
说明:可以看到R5的fa0/0接口就是组播的进口,而连组成员R6的接口s1/0为出口,状态也正常;另外我们也可以看到PIM-SM出口只记录为forward状态的,被剪出的接口(fa0/1)是不做记录的;相比较于PIM-DM,PIM-SM会更省资源。
(5)测试组播通信
R1#ping 224.6.6.6
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 224.6.6.6, timeout is 2 seconds:
Reply to request 0 from 56.1.1.6, 740 ms
说明:从回包中看出,已经收到组成员50.1.1.6的回包,说明组播成功被转发到组成员R6
(6)查看R2组播树的情况
R2#show ip mroute
IP Multicast Routing Table
(*, 224.6.6.6), 00:01:32/stopped, RP 4.4.4.4, flags: SPF
Incoming interface: FastEthernet0/1, RPF nbr 24.1.1.4
Outgoing interface list: Null
(12.1.1.1, 224.6.6.6), 00:01:32/00:01:59, flags: FT
Incoming interface: Serial1/0, RPF nbr 0.0.0.0, Registering
Outgoing interface list:
FastEthernet0/1, Forward/Sparse, 00:01:31/00:02:57
(*, 224.0.1.40), 00:25:20/00:02:10, RP 4.4.4.4, flags: SJCL
Incoming interface: FastEthernet0/1, RPF nbr 24.1.1.4
Outgoing interface list:
Serial1/0, Forward/Sparse, 00:25:20/00:02:34
说明:(*,G)中说明了RP是4.4.4.4,但是组播源到RP之间会创建(S,G)的记录,并且通往RP的路径正常,RPF邻居为0.0.0.0,也属正常
(7)查看R4组播树的情况
R4#show ip mroute
IP Multicast Routing Table
(*, 224.6.6.6), 00:20:31/stopped, RP 4.4.4.4, flags: S
Incoming interface: Null, RPF nbr 0.0.0.0
Outgoing interface list:
FastEthernet0/0, Forward/Sparse, 00:20:31/00:02:34
(12.1.1.1, 224.6.6.6), 00:00:48/00:03:20, flags: T
Incoming interface: FastEthernet0/1, RPF nbr 24.1.1.2
Outgoing interface list:
FastEthernet0/0, Forward/Sparse, 00:00:48/00:02:41
(*, 224.0.1.40), 00:28:08/00:02:58, RP 4.4.4.4, flags: SJCL
Incoming interface: Null, RPF nbr 0.0.0.0
Outgoing interface list:
FastEthernet0/0, Forward/Sparse, 00:20:36/00:02:36
FastEthernet0/1, Forward/Sparse, 00:28:08/00:03:27
说明:RP上也有了(S,G)的记录,并且接口状态正常
(8)查看R5组播树的情况
R5#show ip mroute
IP Multicast Routing Table
(*, 224.6.6.6), 00:21:47/00:03:23, RP 4.4.4.4, flags: S
Incoming interface: FastEthernet0/0, RPF nbr 45.1.1.4
Outgoing interface list:
Serial1/0, Forward/Sparse, 00:21:47/00:03:23
(12.1.1.1, 224.6.6.6), 00:00:26/00:03:29, flags: T
Incoming interface: FastEthernet0/0, RPF nbr 45.1.1.4
Outgoing interface list:
Serial1/0, Forward/Sparse, 00:00:26/00:03:23
(*, 224.0.1.40), 00:29:09/00:03:20, RP 4.4.4.4, flags: SJCL
Incoming interface: FastEthernet0/0, RPF nbr 45.1.1.4
Outgoing interface list:
FastEthernet0/1, Forward/Sparse, 00:20:55/00:03:16
Serial1/0, Forward/Sparse, 00:21:49/00:03:20
说明:同样也有(S,G)的记录,方便后面从RPT切换到SPT
(9)查看R3组播树的情况
R3#show ip mroute
IP Multicast Routing Table
(*, 224.0.1.40), 00:28:52/00:02:27, RP 4.4.4.4, flags: SJCL
Incoming interface: FastEthernet0/1, RPF nbr 35.1.1.5
Outgoing interface list:
FastEthernet0/0, Forward/Sparse, 00:28:52/00:02:27
说明:因为R3不需要转发所有没有任何记录!另外IGMPG查询器和PIM前传器和PIM-DM相同,这里就不验证了
4 配置Auto-RP
说明:先把每台路由器的静态RP删除
(1)配置R3为C-RP
R3(config)#int lo 0
R3(config-if)#ip pim sparse-mode
R3(config)#access-list 24 permit 224.5.5.5
R3(config)#access-list 24 permit 224.6.6.6
R3(config)#ip pim send-rp-announce loopback 0 scope 10 group-list 24
说明:配置为RP的接口必须开启PIM了,这里和静态配置是不同的,这里把lo0配置为RP地址,然后使用ACL限制其只做组224.5.5.5和224.6.6.6的RP
(2)配置R4为C-RP
R4(config)#int lo 0
R4(config-if)#ip pim sparse-mode
R4(config)#access-list 24 permit 224.5.5.5
R4(config)#access-list 24 permit 224.6.6.6
R4(config)#ip pim send-rp-announce loopback 0 scope 10 group-list 24
说明:配置R4的lo0为RP的地址,并且使用ACL限制其只做组224.5.5.5和224.6.6.6的RP
(3)配置R1为RP-mapping agent(选举RP的裁判)
R1(config)#int lo 0
R1(config-if)#ip pim sparse-mode
R1(config)#ip pim send-rp-discovery loopback 0 scope 16
说明:配置R1的lo0为RP-mapping agent
(4)查看RP信息,在R1上查看RP-mapping agent的组加入情况
说明:所有C-RP的竞选消息都发送到224.0.1.39,由RP-mapping agent接收后将选为RP的地址公布给所有PIM路由器,要让RP-mapping agent成功收到C-RP竞选消息,就必须能够接收到组播224.0.1.39的数据
R1#show ip igmp interface
Serial1/0 is up, line protocol is up
Internet address is 12.1.1.1/24
IGMP is enabled on interface
Current IGMP host version is 2
Current IGMP router version is 2
IGMP query interval is 60 seconds
IGMP querier timeout is 120 seconds
IGMP max query response time is 10 seconds
Last member query count is 2
Last member query response interval is 1000 ms
Inbound IGMP access group is not set
IGMP activity: 2 joins, 1 leaves
Multicast routing is enabled on interface
Multicast TTL threshold is 0
IGMP querying router is 0.0.0.0 (this system)
Multicast groups joined by this system (number of users):
224.0.1.39(1)
Loopback0 is up, line protocol is up
Internet address is 1.1.1.1/32
IGMP is enabled on interface
Current IGMP host version is 2
Current IGMP router version is 2
IGMP query interval is 60 seconds
IGMP querier timeout is 120 seconds
IGMP max query response time is 10 seconds
Last member query count is 2
Last member query response interval is 1000 ms
Inbound IGMP access group is not set
IGMP activity: 2 joins, 0 leaves
Multicast routing is enabled on interface
Multicast TTL threshold is 0
Multicast designated router (DR) is 1.1.1.1 (this system)
IGMP querying router is 1.1.1.1 (this system)
Multicast groups joined by this system (number of users):
224.0.1.40(1) 224.0.1.39(1)
说明:可以看出配置成为RP-mapping agent后,所有的接口都已经加入了224.0.1.39.但是这并不能保证RP-mapping agent就一定能够收到C-RP的竞选消息,因为在PIM-SM模式下,没有RP时,组播是不通的。
(5)解决RP-mapping agent接收C-RP竞选消息
说明:因为组播不通,所以当RP-mapping agent和C-RP不是同一台路由器时,是无法收到C-RP的竞选消息的,为了解决此问题,我们可以通过在路由器上配置Autorp listener来解决,网络中最好所有路由器都配置!下面在R上配置,其他路由器同理
R1(config)#ip pim autorp listener
说明:除此以为我们还可以把PIM模式改为Sparse-dense-mode来解决此问题
(6)查看RP情况
R1#show ip pim rp mapping
PIM Group-to-RP Mappings
This system is an RP-mapping agent (Loopback0)
Group(s) 224.5.5.5/32
RP 4.4.4.4 (?), v2v1
Info source: 4.4.4.4 (?), elected via Auto-RP
Uptime: 00:01:00, expires: 00:02:58
RP 3.3.3.3 (?), v2v1
Info source: 3.3.3.3 (?), via Auto-RP
Uptime: 00:01:10, expires: 00:02:49
Group(s) 224.6.6.6/32
RP 4.4.4.4 (?), v2v1
Info source: 4.4.4.4 (?), elected via Auto-RP
Uptime: 00:01:00, expires: 00:02:58
RP 3.3.3.3 (?), v2v1
Info source: 3.3.3.3 (?), via Auto-RP
Uptime: 00:01:10, expires: 00:02:4
说明:在RP-mapping agent上,同时看到所有信息,其他路由器上只看到RP的信息;因为R4的地址比R3大,所有被选举为两个组的RP
(7)测试组播通信
R1#ping 224.6.6.6
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 224.6.6.6, timeout is 2 seconds:
Reply to request 0 from 56.1.1.6, 720 ms
Reply to request 0 from 56.1.1.6, 720 ms
R1#ping 224.5.5.5
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 224.5.5.5, timeout is 2 seconds:
Reply to request 0 from 56.1.1.6, 604 ms
Reply to request 0 from 56.1.1.6, 604 ms
说明:通信成功,注意要把R6再加入224.5.5.5
4 配置BSR
(1)配置R3为C-RP,优先级为10;配置R4为C-RP,优先级为0
R3(config)#ip pim rp-candidate loopback 0 group-list 24 priority 10
R4(config)#ip pim rp-candidate loopback 0 group-list 24
说明:ACL依然保留前面Auto-rp的配置,并且删除之前的候选C-RP的配置
(2)配置R1为C-BSR(裁判)
R1(config)#ip pim bsr-candidate loopback 0
说明:注意删除之前的RP-mapping agent
(3)查看BSR的情况
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:35, BSR Priority: 0, Hash mask length: 0
Next bootstrap message in 00:00:25
说明:因为C-BSR只有R1,所以RI自然被选为BSR
(3)在R4上查看RP结果
R4#show ip pim rp mapping in-use
PIM Group-to-RP Mappings
This system is a candidate RP (v2)
Group(s) 224.5.5.5/32
RP 4.4.4.4 (?), v2
Info source: 1.1.1.1 (?), via bootstrap, priority 0, holdtime 150
Uptime: 00:08:54, expires: 00:01:34
RP 3.3.3.3 (?), v2
Info source: 1.1.1.1 (?), via bootstrap, priority 10, holdtime 150
Uptime: 00:09:45, expires: 00:01:37
Group(s) 224.6.6.6/32
RP 4.4.4.4 (?), v2
Info source: 1.1.1.1 (?), via bootstrap, priority 0, holdtime 150
Uptime: 00:08:54, expires: 00:01:35
RP 3.3.3.3 (?), v2
Info source: 1.1.1.1 (?), via bootstrap, priority 10, holdtime 150
Uptime: 00:09:45, expires: 00:01:37
Dynamic (Auto-RP or BSR) RPs in cache that are in use:
Group(s): 224.5.5.5/32, RP: 4.4.4.4, expires: 00:00:56
Group(s): 224.6.6.6/32, RP: 4.4.4.4, expires: 00:00:54
说明:可以看到最终RP为4.4.4.4 因为其优先级最小,越小越优!如果优先级相同则,IP地址越大越优!