本文档介绍ip igmp join-group和ip igmp static-group命令在Cisco IOS®中的工作方式。
如果路由器在任何接口上都有ip igmp join-group命令,则路由器本身将成为组播流的接收方。此命令用于将组播流量移动到此路由器,而没有真正的直连接收方,或者没有向组播流发送PIM加入请求的协议独立组播(PIM)邻居下游。但是,由于此路由器加入组播流,所有组播数据包都会传送到CPU。这可能导致高CPU,也可能导致速率限制器(如果有)或控制平面保护(CoPP)命中。
为吸引此路由器的组播流,您可以使用的更好的替代方案是配置ip igmp static-group 接口命令。使用此命令,路由器仍然可以吸引组播流并将其转发到接口上,但路由器本身并不成为该流的接收方。
ip igmp join-group 接口命令和ip igmp static-group 命令都会导致PIM向源或汇集点(RP)上游发送加入请求,但仅当使用此命令的路由器是该接口上的PIM指定路由器(DR)时,才会发生这种情况。为了确保命令生效并吸引组播流量,请在作为特定网络DR的路由器上使用命令。或者,您可以将使用命令的路由器设置为PIM DR。为此,请在接口上配置ip pim dr-priority 命令,并确保该接口具有该网络上任何PIM路由器的最高PIM DR优先级值。
示例如下:
在本例中,有一个IP地址为10.1.3.3的源和一个组232.1.1.1的接收器。
路由器R1上的组播转发条目如下:
R1#show ip mroute 232.1.1.1 10.1.3.3
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,
Q - Received BGP S-A Route, q - Sent BGP S-A Route,
V - RD & Vector, v - Vector
Outgoing interface flags: H - Hardware switched, A - Assert winner
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode
(10.1.3.3, 232.1.1.1), 01:54:48/00:02:54, flags: sT
Incoming interface: Ethernet1/0, RPF nbr 10.1.2.2
Outgoing interface list:
Ethernet0/0, Forward/Sparse-Dense, 01:54:48/00:02:54
如输出所示,接口Ethernet0/0在传出接口列表(OIL)中,(10.1.3.3、232.1.1.1)组播流量转发到接口Ethernet0/0。
在组播转发信息库(MFIB)条目中也可以观察到以下情况:
R1#show ip mfib 232.1.1.1 10.1.3.3
Entry Flags: C - Directly Connected, S - Signal, IA - Inherit A flag,
ET - Data Rate Exceeds Threshold, K - Keepalive
DDE - Data Driven Event, HW - Hardware Installed
I/O Item Flags: IC - Internal Copy, NP - Not platform switched,
NS - Negate Signalling, SP - Signal Present,
A - Accept, F - Forward, RA - MRIB Accept, RF - MRIB Forward,
MA - MFIB Accept
Forwarding Counts: Pkt Count/Pkts per second/Avg Pkt Size/Kbits per second
Other counts: Total/RPF failed/Other drops
I/O Item Counts: FS Pkt Count/PS Pkt Count
Default
(10.1.3.3,232.1.1.1) Flags:
SW Forwarding: 0/0/0/0, Other: 0/0/0
Ethernet1/0 Flags: A
Ethernet0/0 Flags: F NS
Pkts: 0/0
如果路由器R1没有收到来自路由器R4的组播流的PIM加入请求(出于任何原因),则组播流不会流动。一个可能的原因是PIM不允许在路由器R1和R4之间形成邻居关系,因为路由器属于不同的管理域。解决方案是以静态方式将流量从路由器R1转发到路由器R4。
在路由器R1的接口Ethernet0/0上使用ip igmp join-group命令。这允许路由器R1向上游(源或RP)发送PIM加入请求,并吸引组播流(10.1.3.3、232.1.1)。 然后,此流量会转发到接口Ethernet0/0,因为此接口在OIL中。但是,流量也会传送到CPU。
R1#show running-config interface Ethernet 0/0
!
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0
ip pim sparse-dense-mode
ip igmp join-group 232.1.1.1 source 10.1.3.3
end
R1#show ip mroute 232.1.1.1 10.1.3.3
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,
Q - Received BGP S-A Route, q - Sent BGP S-A Route,
V - RD & Vector, v - Vector
Outgoing interface flags: H - Hardware switched, A - Assert winner
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode
(10.1.3.3, 232.1.1.1), 00:09:30/00:02:19, flags: sLTI
Incoming interface: Ethernet1/0, RPF nbr 10.1.2.2
Outgoing interface list:
Ethernet0/0, Forward/Sparse-Dense, 00:00:40/00:02:19
L 标志表示组播流量被传送。接口Ethernet0/0在OIL中,因此流量被传送到CPU并转发到接口Ethernet0/0。
MFIB条目显示内部复制(IC)标志。这表示此流的数据包被传送到CPU。
R1#show ip mfib 232.1.1.1 10.1.3.3
Entry Flags: C - Directly Connected, S - Signal, IA - Inherit A flag,
ET - Data Rate Exceeds Threshold, K - Keepalive
DDE - Data Driven Event, HW - Hardware Installed
I/O Item Flags: IC - Internal Copy, NP - Not platform switched,
NS - Negate Signalling, SP - Signal Present,
A - Accept, F - Forward, RA - MRIB Accept, RF - MRIB Forward,
MA - MFIB Accept
Forwarding Counts: Pkt Count/Pkts per second/Avg Pkt Size/Kbits per second
Other counts: Total/RPF failed/Other drops
I/O Item Counts: FS Pkt Count/PS Pkt Count
Default
(10.1.3.3,232.1.1.1) Flags:
SW Forwarding: 0/0/0/0, Other: 0/0/0
Ethernet1/0 Flags: A
Ethernet0/0 Flags: F IC NS
Pkts: 0/0
由于此组播流的所有流量都被传送,因此可能会造成不必要的副作用,如前所述。
ip igmp static-group命令用作解决方案,以便以静态方式将流量从路由器R1转发到路由器R4。在此场景中,路由器R1向上游(到源或RP)发送PIM加入请求,并吸引组播流(10.1.3.3、232.1.1.1)。 然后,此流量会转发到接口Ethernet0/0,因为此接口在OIL中,但该流量不会传送到CPU。
R1#show running-config interface Ethernet 0/0
!
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0
ip pim sparse-dense-mode
ip igmp static-group 232.1.1.1 source 10.1.3.3
end
R1#show ip mroute 232.1.1.1 10.1.3.3
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,
Q - Received BGP S-A Route, q - Sent BGP S-A Route,
V - RD & Vector, v - Vector
Outgoing interface flags: H - Hardware switched, A - Assert winner
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode
(10.1.3.3, 232.1.1.1), 00:07:41/stopped, flags: sTI
Incoming interface: Ethernet1/0, RPF nbr 10.1.2.2
Outgoing interface list:
Ethernet0/0, Forward/Sparse-Dense, 00:05:06/00:00:53
L标志不再显示。流量不会在此路由器上传送,但会转发到OIL中的接口。
同样,MFB条目不显示IC标志:
R1#show ip mfib 232.1.1.1 10.1.3.3
Entry Flags: C - Directly Connected, S - Signal, IA - Inherit A flag,
ET - Data Rate Exceeds Threshold, K - Keepalive
DDE - Data Driven Event, HW - Hardware Installed
I/O Item Flags: IC - Internal Copy, NP - Not platform switched,
NS - Negate Signalling, SP - Signal Present,
A - Accept, F - Forward, RA - MRIB Accept, RF - MRIB Forward,
MA - MFIB Accept
Forwarding Counts: Pkt Count/Pkts per second/Avg Pkt Size/Kbits per second
Other counts: Total/RPF failed/Other drops
I/O Item Counts: FS Pkt Count/PS Pkt Count
Default
(10.1.3.3,232.1.1.1) Flags:
SW Forwarding: 0/0/0/0, Other: 0/0/0
Ethernet1/0 Flags: A
Ethernet0/0 Flags: F NS
Pkts: 0/0
如果路由器R1不是接口Etherent0/0的PIM DR,则ip igmp static-group 命令和ip igmp join-group 命令都不会生效。
示例如下:
R1#show running-config interface Ethernet 0/0
!
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0
ip pim sparse-dense-mode
ip igmp static-group 232.1.1.1 source 10.1.3.3
end
R1#show ip mroute 232.1.1.1 10.1.3.3
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,
Q - Received BGP S-A Route, q - Sent BGP S-A Route,
V - RD & Vector, v - Vector
Outgoing interface flags: H - Hardware switched, A - Assert winner
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode
(10.1.3.3, 232.1.1.1), 00:00:30/00:02:29, flags: sPT
Incoming interface: Ethernet1/0, RPF nbr 10.1.2.2
Outgoing interface list: Null
接口Ethernet0/0不在OIL中。这是因为路由器R1不是链路上的PIM DR,它使用ip igmp static-group命令进行:
R1#show ip pim interface ethernet 0/0
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
10.1.1.1 Ethernet0/0 v2/SD 1 30 1 10.1.1.4
路由器R1也不向上游发送PIM加入请求。在路由器R2上,这是显而易见的,因为缺少组播条目:
R2#show ip mroute 232.1.1.1 10.1.3.3
Group 232.1.1.1 not found
以下是当路由器R1是接口Ethernet0/0上的PIM DR时可以观察到的输出:
R1#show ip pim interface ethernet 0/0
Address Interface Ver/ Nbr Query DR DR
Mode Count Intvl Prior
10.1.1.1 Ethernet0/0 v2/SD 1 30 1 10.1.1.1
R1#show ip mroute 232.1.1.1 10.1.3.3
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,
Q - Received BGP S-A Route, q - Sent BGP S-A Route,
V - RD & Vector, v - Vector
Outgoing interface flags: H - Hardware switched, A - Assert winner
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode
(10.1.3.3, 232.1.1.1), 00:02:39/00:02:55, flags: sTI
Incoming interface: Ethernet1/0, RPF nbr 10.1.2.2
Outgoing interface list:
Ethernet0/0, Forward/Sparse-Dense, 00:00:04/00:02:55
为了排除故障,您可能希望使用组播执行测试,即使在实验室之外。在这种情况下,请确保以安全的方式使用ip igmp join-group命令。您应在ip igmp static-group命令上使用ip igmp join-group命令的原因是组播数据包被传送。因此,如果对组播目标执行ping,则使用命令的路由器是组播流的接收方,可以回复ping。
示例如下:
源10.1.3.3是路由器R3的IP地址。如果您在路由器R1的Ethernet0/0接口上输入命令并从路由器R3 ping,则路由器R1可以回复ping。因此,您可以执行测试,就像路由器R1上有直连接的接收器一样。在路由器R1的Ethernet0/0接口上发出ip igmp join-group命令,并指定源,以确保路由器R1只发送来自该源的流量(并响应该流量)。
R1#show running-config interface Ethernet 0/0
!
interface Ethernet0/0
ip address 10.1.1.1 255.255.255.0
ip pim sparse-dense-mode
ip igmp join-group 232.1.1.1 source 10.1.3.3
end
R3#ping 232.1.1.1 source 10.1.3.3
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 232.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 10.1.3.3
Reply to request 0 from 10.1.1.1, 2 ms
R3#
路由器R1上的debug ip icmp命令表示ping已到达,路由器R1发送应答:
R1#debug ip icmp
ICMP packet debugging is on
R1#
*Oct 30 11:35:41.133: ICMP: echo reply sent, src 10.1.1.1, dst 10.1.3.3,
topology BASE, dscp 0 topoid 0
最佳实践是,除非用于实验中的测试或实时网络上的临时测试,否则不要使用ip igmp join-group命令。完成所有测试后,删除命令。如果组播流量必须仅静态转发,请改用ip igmp static-group命令。