组网图形
图1 配置IGMP静态组播组组网图
如图1所示,网络中的不同用户群组成N1和N2两个末梢网络。PIM网络中的SwitchA连接用户网段N1,SwitchB和SwitchC连接用户网段N2。该PIM网络中传播视频信息使用的组播组地址为225.1.1.1~225.1.1.5。
N1中的HostA和N2中的HostC、HostD都希望通过组播方式接收视频信息。其中接收者HostA希望长期稳定地接收组播组225.1.1.1的数据,HostC和HostD对组播组没有这样的需求。
请确保该场景下互联接口的STP处于未使能状态。同时将互连接口退出VLAN1,避免形成环路。因为在使能STP的环形网络中,如果用交换机的VLANIF接口构建三层网络,会导致某个端口被阻塞,从而导致三层业务不能正常运行。
配置SwitchA与N1网段相连的接口静态加入组播组,可以实现此需求。
配置各交换机接口的IP地址和单播路由协议。
# 按照图1配置各交换机接口的IP地址和掩码,并配置各交换机之间采用OSPF进行互连,确保网络中各交换机间能够在网络层互通,并且各交换机之间能够借助单播路由协议实现动态路由更新。SwitchB、SwitchC和SwitchD的配置与SwitchA类似,配置过程略。
<HUAWEI> system-view
[HUAWEI] sysname SwitchA
[SwitchA] vlan batch 10 11
[SwitchA] interface gigabitethernet 0/0/1
[SwitchA-GigabitEthernet0/0/1] port link-type hybrid
[SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 10
[SwitchA-GigabitEthernet0/0/1] port hybrid pvid vlan 10
[SwitchA-GigabitEthernet0/0/1] quit
[SwitchA] interface gigabitethernet 0/0/2
[SwitchA-GigabitEthernet0/0/2] port link-type trunk
[SwitchA-GigabitEthernet0/0/2] port trunk allow-pass vlan 11
[SwitchA-GigabitEthernet0/0/2] quit
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] ip address 10.110.1.1 24
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 11
[SwitchA-Vlanif11] ip address 192.168.1.1 24
[SwitchA-Vlanif11] quit
[SwitchA] ospf
[SwitchA-ospf-1] area 0
[SwitchA-ospf-1-area-0.0.0.0] network 10.110.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
[SwitchA-ospf-1-area-0.0.0.0] quit
[SwitchA-ospf-1] quit
使能IP组播路由功能,并在所有接口上使能PIM-SM功能。
# 在SwitchA上使能IP组播路由功能,并在所有接口上使能PIM-SM功能。SwitchB、SwitchC和SwitchD的配置与SwitchA类似,配置过程略。
[SwitchA] multicast routing-enable
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] pim sm
[SwitchA-Vlanif10] quit
[SwitchA] interface vlanif 11
[SwitchA-Vlanif11] pim sm
[SwitchA-Vlanif11] quit
配置静态RP。
# 在SwitchA上,配置SwitchD的VLANIF40为静态RP。SwitchB、SwitchC和SwitchD的配置与SwitchA类似,配置过程略。
[SwitchA] pim
[SwitchA-pim] static-rp 192.168.4.1
[SwitchA-pim] quit
在SwitchA、SwitchB、SwitchC成员端接口上使能IGMP功能。
# 在SwitchA的VLANIF10接口上使能IGMP功能。SwitchB和SwitchC的配置与SwitchA类似,配置过程略。
[SwitchA] interface vlanif 10
[SwitchA-Vlanif10] igmp enable
[SwitchA-Vlanif10] quit
将SwitchA的VLANIF10接口静态加入组播组225.1.1.1,使接口VLANIF10下的用户能长期稳定地接收发往组播225.1.1.1的数据。
[SwitchA] interface vlan 10
[SwitchA-Vlanif10] igmp static-group 225.1.1.1
[SwitchA-Vlanif10] quit
验证配置结果。
# 通过display igmp interface命令可以查看各交换机接口上IGMP的配置和运行情况。例如SwitchB的VLANIF20接口上IGMP的显示信息如下:
[SwitchB] display igmp interface vlanif 20
Interface information of VPN-Instance: public net
Vlanif20(10.110.2.1):
IGMP is enabled
Current IGMP version is 2
IGMP state: up
IGMP group policy: none
IGMP limit: -
Value of query interval for IGMP (negotiated): -
Value of query interval for IGMP (configured): 60 s
Value of other querier timeout for IGMP: 0 s
Value of maximum query response time for IGMP: 10 s
Querier for IGMP: 10.110.2.1 (this router)
Total 2 IGMP Groups reported
可以看出,SwitchB的VLANIF20接口已经使能了IGMP。
# 通过display pim routing-table命令,可以查看SwitchA的接口VLANIF10是否已经静态加入组播组225.1.1.1。显示信息如下:
[SwitchA] display pim routing-table
VPN-Instance: public net
Total 1 (*, G) entry; 0 (S, G) entry
(*, 225.1.1.1)
RP: 192.168.4.1
Protocol: pim-sm, Flag: WC
UpTime: 00:12:17
Upstream interface: Vlanif11
Upstream neighbor: 192.168.1.2
RPF prime neighbor: 192.168.1.2
Downstream interface(s) information:
Total number of downstreams: 1
1: Vlanif10
Protocol: static igmp, UpTime: 00:12:17, Expires: -
可以看出,SwitchA上有(*,225.1.1.1)表项,且下游接口是VLANIF10,协议类型为“static igmp”,表明VLANIF10静态加入组播组225.1.1.1配置成功
SwitchA的配置文件
#
sysname SwitchA
#
vlan batch 10 to 11
#
multicast routing-enable
#
interface Vlanif10
ip address 10.110.1.1 255.255.255.0
pim sm
igmp enable
igmp static-group 225.1.1.1
#
interface Vlanif11
ip address 192.168.1.1 255.255.255.0
pim sm
#
interface GigabitEthernet0/0/1
port link-type hybrid
port hybrid pvid vlan 10
port hybrid untagged vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 11
#
ospf 1
area 0.0.0.0
network 10.110.1.0 0.0.0.255
network 192.168.1.0 0.0.0.255
#
pim
static-rp 192.168.4.1
#
return
SwitchB的配置文件
#
sysname SwitchB
#
vlan batch 20 to 21
#
multicast routing-enable
#
interface Vlanif20
ip address 10.110.2.1 255.255.255.0
pim sm
igmp enable
#
interface Vlanif21
ip address 192.168.2.1 255.255.255.0
pim sm
#
interface GigabitEthernet0/0/1
port link-type hybrid
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 21
#
ospf 1
area 0.0.0.0
network 10.110.2.0 0.0.0.255
network 192.168.2.0 0.0.0.255
#
pim
static-rp 192.168.4.1
#
return
SwitchC的配置文件
#
sysname SwitchC
#
vlan batch 20 31
#
multicast routing-enable
#
interface Vlanif20
ip address 10.110.2.2 255.255.255.0
pim sm
igmp enable
#
interface Vlanif31
ip address 192.168.3.1 255.255.255.0
pim sm
#
interface GigabitEthernet0/0/1
port link-type hybrid
port hybrid pvid vlan 20
port hybrid untagged vlan 20
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 31
#
ospf 1
area 0.0.0.0
network 10.110.2.0 0.0.0.255
network 192.168.3.0 0.0.0.255
#
pim
static-rp 192.168.4.1
#
return
SwitchD的配置文件
#
sysname SwitchD
#
vlan batch 11 21 31 40
#
multicast routing-enable
#
interface Vlanif11
ip address 192.168.1.2 255.255.255.0
pim sm
#
interface Vlanif21
ip address 192.168.2.2 255.255.255.0
pim sm
#
interface Vlanif31
ip address 192.168.3.2 255.255.255.0
pim sm
#
interface Vlanif40
ip address 192.168.4.1 255.255.255.0
pim sm
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 11
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 21
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 31
#
interface GigabitEthernet0/0/4
port link-type trunk
port trunk allow-pass vlan 40
#
ospf 1
area 0.0.0.0
network 192.168.1.0 0.0.0.255
network 192.168.2.0 0.0.0.255
network 192.168.3.0 0.0.0.255
network 192.168.4.0 0.0.0.255
#
pim
static-rp 192.168.4.1
#
return
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。