本檔案介紹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 interface命令和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靜態轉發流量。
ip igmp join-group命令用於路由器R1的介面Ethernet0/0。這允許路由器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 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條目顯示Internal Copy(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不是介面Ethernet0/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中。這是因為使用ip igmp static-group命令時,路由器R1不是鏈路上的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.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命令。