标签:组播

IP组播

No Comments CISCO

配置PIM-DM 下的组播

提问 配置路由器基本的组播功能

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.1 255.255.255.0

Router1(config-if)#ip pim dense-mode

Router1(config-if)#exit

Router1(config)#interface Serial1/0

Router1(config-if)#ip address 192.168.2.5 255.255.255.252

Router1(config-if)#ip pim dense-mode

Router1(config-if)#end

Router1#

Router2#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router2(config)#ip multicast-routing

Router2(config)#interface FastEthernet0/0

Router2(config-if)#ip address 192.168.3.1 255.255.255.0

Router2(config-if)#ip pim dense-mode

Router2(config-if)#exit

Router2(config)#interface Serial1/0

Router2(config-if)#ip address 192.168.2.6 255.255.255.252

Router2(config-if)#ip pim dense-mode

Router2(config-if)#end

Router2#

注释 密集模式适合于组播发送方和接收方近距离的情况,发送方很少但是接收方数量很大。

23.2.  配置PIM-SM和BSR 下的组播路由

提问 配置稀疏模式下的组播路由,使用BSR来分发RP信息

回答

参与组播的正常路由器

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim rp-address 192.168.15.5

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.1 255.255.255.0

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#interface Serial1/0

Router1(config-if)#ip address 192.168.2.5 255.255.255.252

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#end

Router1#

RP候选路由器和BSR候选路由器

Router-RP1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router-RP1(config)#ip multicast-routing

Router-RP1(config)#interface Loopback0

Router-RP1(config-if)#ip address 192.168.12.1 255.255.255.255

Router-RP1(config-if)# ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#interface FastEthernet0/0

Router-RP1(config-if)#ip address 192.168.1.1 255.255.255.0

Router-RP1(config-if)#ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#interface Serial1/0

Router-RP1(config-if)#ip address 192.168.2.5 255.255.255.252

Router-RP1(config-if)#ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#ip pim rp-address 192.168.12.1 15

Router-RP1(config)#ip pim rp-candidate loopback0 group-list 15

Router-RP1(config)#ip pim bsr-candidate loopback0 1

Router-RP1(config)#access-list 15 permit 239.5.5.0 0.0.0.255

Router-RP1(config)#access-list 15 deny any

Router-RP1(config)#end

Router-RP1#

注释 对于稀疏模式需要配置一个汇集点Rendezvous Point (RP)来作为组播最短路径树Shortest Path Trees (SPT)的根。配置路由器使用RP有两种方法,一种是Router1使用的静态指定的方式ip pim rp-address 192.168.15.5 另一种就是动态的发现RP,这又有两种方式来实现,第一种是思科专有的Auto-RP,另一种就是本例中的Bootstrap Router。在Router-RP1中首先使用ip pim rp-candidate来宣告自己为可能RP,然后使用ip pim bsr-candidate来配置为Bootstrap Router (BSR).BSR目的就是发布网络中所有可能的RP信息。另外需要指出的是建议还要配置ip pim rp-address 192.168.12.1 15 尤其是在12.3以后的IOS。BSR模式需要PIM-SM v2支持

23.3.  配置PIM-SM 和Auto-RP 下的组播路由

提问配置稀疏模式下的组播路由,使用Auto-RP来分发RP信息

回答

参与组播的正常路由器

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim rp-address 192.168.15.5

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.1 255.255.255.0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#exit

Router1(config)#interface Serial1/0

Router1(config-if)#ip address 192.168.2.5 255.255.255.252

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#end

Router1#

候选RP路由器

Router-RP1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router-RP1(config)#ip multicast-routing

Router-RP1(config)#interface Loopback0

Router-RP1(config-if)#ip address 192.168.12.1 255.255.255.255

Router-RP1(config-if)#ip pim sparse-dense-mode

Router-RP1(config-if)#exit

Router-RP1(config)#interface FastEthernet0/0

Router-RP1(config-if)#ip address 192.168.1.1 255.255.255.0

Router-RP1(config-if)#ip pim sparse-dense-mode

Router-RP1(config-if)#exit

Router-RP1(config)#interface Serial1/0

Router-RP1(config-if)#ip address 192.168.2.5 255.255.255.252

Router-RP1(config-if)#ip pim sparse-dense-mode

Router-RP1(config-if)#exit

Router-RP1(config)#ip pim send-rp-announce loopback0 scope 16 group-list 15

Router-RP1(config)#ip pim send-rp-discovery scope 16

Router-RP1(config)#access-list 15 permit 239.5.5.0 0.0.0.255

Router-RP1(config)#access-list 15 deny any

Router-RP1(config)#end

Router-RP1#

注释 在Auto-RP方式下,增加了sparse-dense-mode 模式,使用了专有的224.0.1.39 and 224.0.1.40.两个组播地址

23.4.  过滤PIM邻居

提问 防止路由器从其他设备接收到PIM数据包

回答

在R1上配置过滤对R2

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.1 255.255.255.0

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#ip pim neighbor-filter 18

Router1(config-if)#exit

Router1(config)#access-list 18 deny any

Router1(config)#end

Router1#

Router2#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router2(config)#ip multicast-routing

Router2(config)#interface FastEthernet0/0

Router2(config-if)#ip address 192.168.1.2 255.255.255.0

Router2(config-if)#ip pim dense-mode

Router2(config-if)#ip igmp helper-address 192.168.1.1

Router2(config-if)#end

Router2#

注释 对PIM邻居的过滤除了可以实现安全以外,还可以做到Multicast stub routing

23.5.  低频度组播包应用的支持

提问 配置对于低频度组播包应用的支持

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim spt-threshold 10 group-list 15

Router1(config)#access-list 15 permit 239.5.5.55

Router1(config)#access-list 15 deny any

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.1 255.255.255.0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#exit

Router1(config)#interface Serial1/0

Router1(config-if)#ip address 192.168.2.5 255.255.255.252

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#end

Router1#

注释 对于那些发送组播数据包小,间隔长的应用需要使用稀疏模式,同时通过配置SPT阀值来保持所生成的组播路径树

23.6.  在Frame Relay或者ATM 网络中使用组播

提问 在NBMA网络中使用PIM-SM

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface Serial0/0

Router1(config-if)#encapsulation frame-relay

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#ip pim nbma-mode

Router1(config-if)#end

Router1#

注释 对于通常的NBMA网络中的NBMA接口无法区分下联不同接口的组播请求,通过ip pim nbma-mode命令来各自邻居的组播请求

23.7.  配置CGMP

提问 配置路由器和Catalyst交换机之间使用CGMP通讯

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip cgmp

Router1(config-if)#end

Router1#

注释 不同交换机上启用CGMP的命令可能不同,也不是所有的交换机都支持CGMP

23.8.  使用IGMP版本3

提问 配置IGMPv3

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim ssm default

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip igmp version 3

Router1(config-if)#end

Router1#

 

使用TTL来控制组播范围
提问 确保组播只作用于特定的网络范围
回答
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip multicast-routing
Router1(config)#interface FastEthernet0/0
Router1(config-if)#ip multicast ttl-threshold 16
Router1(config-if)#end
Router1#
注释 这里的配置更多取决于组播服务器对TTL的定义,通常本地TTL为1,部门为16,企业为64,互联网为128。另外跟单播不同的是,如果TTL超期被丢弃不会返回ICMP TTL超时的错误消息
23.15.  使用Administratively Scoped Addressing来控制组播范围
提问 使用RFC2365中定义的管理范围地址来控制组播的分发
回答
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip multicast-routing
Router1(config)#access-list 15 deny 239.255.0.0 0.0.255.255
Router1(config)#access-list 15 permit any
Router1(config)#interface FastEthernet0/0
Router1(config-if)#ip multicast boundary 15
Router1(config-if)#end
Router1#
注释 由于使用TTL来控制更多依赖于组播应用,所以使用了上例的控制方法,针对239.0.0.0到 239.255.255.255的组播地址,不同的应用和范围使用不同的地址段,对地址段进行控制。这里的命令不同于在端口配置简单的过滤列表,还对PIM的消息进行了控制,从而防止加入组播树
23.16.  使用MBGP来交换组播路由信息
提问 使用MBGP在两个网络中互相交换组播路由信息
回答
首先在ASBR上启用组播路由和对本地组播进行过滤
Router-ASBR1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router-ASBR1(config)#ip multicast-routing
Router-ASBR1(config)#access-list 15 deny 239.0.0.0 0.255.255.255
Router-ASBR1(config)#access-list 15 deny 224.0.1.39
Router-ASBR1(config)#access-list 15 deny 224.0.1.40
Router-ASBR1(config)#access-list 15 permit any
Router-ASBR1(config)#interface Serial0/0
Router-ASBR1(config-if)#ip multicast boundary 15
Router-ASBR1(config-if)#ip multicast ttl-threshold 64
Router-ASBR1(config-if)#ip pim dense-mode
Router-ASBR1(config-if)#end
Router-ASBR1#
然后配置MBGP
Router-ASBR1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router-ASBR1(config)#router bgp 65530
Router-ASBR1(config-router)#network 10.0.0.0 mask 255.0.0.0
Router-ASBR1(config-router)#neighbor 10.15.32.1 remote-as 65531
Router-ASBR1(config-router)#address-family ipv4 multicast
Router-ASBR1(config-router-af)#neighbor 10.15.32.1 activate
Router-ASBR1(config-router-af)#end
Router-ASBR1#
注释 MBGP并不像PIM一样是一种组播路由协议,只是用来传递路由信息,所以在配置中还有PIM的配置
23.17.  使用MSDP来发现外部源
提问 使用MSDP来发现另一个自治域的组播源
回答
Router-ASBR1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router-ASBR1(config)#ip multicast-routing
Router-ASBR1(config)#interface Loopback0
Router-ASBR1(config-if)#ip address 192.168.12.1 255.255.255.255
Router-ASBR1(config-if)# ip pim sparse-mode
Router-ASBR1(config-if)#interface FastEthernet0/0
Router-ASBR1(config-if)#ip address 192.168.1.1 255.255.255.0
Router-ASBR1(config-if)#ip pim sparse-mode
Router-ASBR1(config-if)#exit
Router-ASBR1(config)#interface Serial1/0
Router-ASBR1(config-if)#ip address 192.168.2.5 255.255.255.252
Router-ASBR1(config-if)#ip multicast boundary 15
Router-ASBR1(config-if)#ip multicast ttl-threshold 64
Router-ASBR1(config-if)#ip pim sparse-mode
Router-ASBR1(config-if)#exit
Router-ASBR1(config)#ip pim rp-candidate loopback0
Router-ASBR1(config)#ip pim bsr-candidate loopback0 1
Router-ASBR1(config-if)#router bgp 65530
Router-ASBR1(config-router)#network 10.0.0.0 mask 255.0.0.0
Router-ASBR1(config-router)#neighbor 192.168.2.6 remote-as 65531
Router-ASBR1(config-router)#address-family ipv4 multicast
Router-ASBR1(config-router-af)#neighbor 192.168.2.6 activate
Router-ASBR1(config-router-af)#exit
Router-ASBR1(config-router)#exit
Router-ASBR1(config)#ip msdp peer 192.168.2.6
Router-ASBR1(config)#ip msdp sa-request 192.168.2.6
Router-ASBR1(config)#access-list 15 deny 239.0.0.0 0.255.255.255
Router-ASBR1(config)#access-list 15 deny 224.0.1.39
Router-ASBR1(config)#access-list 15 deny 224.0.1.40
Router-ASBR1(config)#access-list 15 permit any
Router-ASBR1(config)#end
Router-ASBR1#
注释 这里面主要是配置了sa对端来发布如果有新源的消
23.18.  配置 Anycast RP
提问配置两个或者多个RP来让路由器自动选择最近的
回答
第一个RP的配置
Router-RP1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router-RP1(config)#ip multicast-routing
Router-RP1(config)#interface Loopback0
Router-RP1(config-if)# ip address 10.4.4.4 255.255.255.255
Router-RP1(config-if)#exit
Router-RP1(config)#interface Loopback1
Router-RP1(config-if)# ip address 192.168.99.1 255.255.255.255
Router-RP1(config-if)# ip pim sparse-dense-mode
Router-RP1(config-if)#exit
Router-RP1(config)#ip pim send-rp-announce Loopback1 scope 16 group-list 22
Router-RP1(config)#ip pim send-rp-discovery Loopback1 scope 16
Router-RP1(config)#ip msdp peer 10.5.5.5 connect-source Loopback0
Router-RP1(config)#access-list 22 permit 239.0.0.0 0.255.255.255.255
Router-RP1(config)#end
Router-RP1#
第二个RP的配置
Router-RP2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router-RP2(config)#ip multicast-routing
Router-RP2(config)#interface Loopback0
Router-RP2(config-if)# ip address 10.5.5.5 255.255.255.255
Router-RP2(config-if)#exit
Router-RP2(config)#interface Loopback1
Router-RP2(config-if)# ip address 192.168.99.1 255.255.255.255
Router-RP2(config-if)# ip pim sparse-dense-mode
Router-RP2(config-if)#exit
Router-RP2(config)#ip pim send-rp-announce Loopback1 scope 16 group-list 22
Router-RP2(config)#ip pim send-rp-discovery Loopback1 scope 16
Router-RP2(config)#ip msdp peer 10.4.4.4 connect-source Loopback0
Router-RP2(config)#access-list 22 permit 239.0.0.0 0.255.255.255.255
Router-RP2(config)#end
Router-RP2#
注释 PIM-SM有个缺陷就是在一个组播组里面只能有一个RP,冗余性不够。而Anycast通过配置相同的Anycast地址,然后利用单播路由协议来保证采用最近的RP,不同的RP之间可以利用MSDP来保证组播源的信息同步
23.19.  转化广播为组播
提问 把基于广播的应用转为组播包在网络中传递
回答
第一跳路由器
Router1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#ip multicast-routing
Router1(config)#access-list 115 permit any any udp 3535
Router1(config)#access-list 115 deny any any udp
Router1(config)#interface FastEthernet0/0
Router1(config-if)#ip directed broadcast
Router1(config-if)#ip multicast helper-map broadcast 239.3.5.35 115
Router1(config-if)#exit
Router1(config)#ip pim sparse-dense-mode
Router1(config)#ip forward-protocol udp 3535
Router1(config)#end
Router1#
最后一跳路由器
Router2#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Router2(config)#ip multicast-routing
Router2(config)#access-list 115 permit any any udp 3535
Router2(config)#access-list 115 deny any any udp
Router2(config)#interface Ethernet0
Router2(config-if)#ip address 192.168.9.1 255.255.255.0
Router2(config-if)#ip directed broadcast
Router2(config-if)#ip multicast helper-map 239.3.5.35 192.168.9.255 115
Router2(config-if)#ip pim sparse-dense-mode
Router2(config-if)#exit
Router2(config)#ip igmp join-group 239.3.5.35
Router2(config)#ip forward-protocol udp 3535
Router2(config)#end
Router2#
注释 IP Multicast Helper的特性帮助路由器实现了此种转换,但是此种转化比较耗费CPU,仅仅是临时解决方案
23.20.  显示组播状态信息
提问 显示组播状态信息
回答
Router#show ip mroute
Router#show ip mroute count
Router#show ip mroute active
Router#show ip igmp groups
Router#show ip igmp interface
Router#show ip pim neighbor
Router#show ip pim interface
Router#show ip pim rp
Router#show ip msdp count
Router#show ip msdp peer 192.168.201.15
Router#show ip msdp summary
Router#show ip rpf 192.168.3.2
Router#mstat 192.168.3.2 239.5.5.55
注释 无
23.21.  组播路由排错
提问 组播路由排错
回答
Router#debug ip mrouting
Router#debug ip mpacket 239.5.5.55
Router#debug ip igmp

 

如果想使用Source-Specific Multicast(SSM)特性,但是终端设备不支持v3,可以使用思科的IGMP v3lite

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim ssm default

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip igmp v3lite

Router1(config-if)#end

Router1#

注释 v3里面最有用的特性就是SSM,不但可以指定想要接收的组播组,还可以指定组播源

23.9.  静态组播路由和组成员

提问 使用静态条目来取代动态的组播路由和组成员

回答

静态组播路由:

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip mroute 192.168.15.0 255.255.255.0 192.168.98.6

Router1(config)#interface Tunnel0

Router1(config-if)#ip address 192.168.98.5 255.255.255.252

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#tunnel mode gre ip

Router1(config-if)#end

Router1#

静态组成员

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip igmp join-group 239.5.5.55

Router1(config-if)#end

Router1#

注释 在12.3(2)T后引入了相近的ip igmp join-group命令,好处是此命令使用fast switching来处理组播包

------中间广告---------

23.10.  启用MOSPF来进行组播路由

提问 使用MOSPF来分发组播路由表

回答 思科不支持MOSPF

23.11.  启用DVMRP来进行组播路由

提问 配置DVMRP来支持组播路由

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip dvmrp unicast-routing

Router1(config-if)#ip dvmrp summary-address 192.168.0.0 255.255.0.0

Router1(config-if)#end

Router1#

注释 思科对DVMRP的支持也不是全面的,更多的是作为DVMRP和PIM之间的网关,而目前网络中很少有DVMRP的部署,推荐使用PIM,PIM使用的是单播的路由表,而DVMRP是自己维护一个组播路由表,使用224.0.0.4这个组播地址来交换邻居信息

23.12.  DVMRP 隧道

提问 建立DVMRP隧道来穿越不支持组播的网络

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface Tunnel0

Router1(config-if)#ip unnumbered FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip dvmrp unicast-routing

Router1(config-if)#tunnel source FastEthernet0/0

Router1(config-if)#tunnel destination 192.168.99.15

Router1(config-if)#tunnel mode dvmrp

Router1(config-if)#exit

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.1 255.255.255.0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#end

Router1#

注释 DVMRP隧道是建立在思科路由器和传统的支持DVMRP的设备上,两台思科设备之间不支持这种隧道,这种隧道只能封装的是组播包,隧道接口和源接口都必须启用PIM。

23.13.  配置双向PIM(Configuring Bidirectional PIM)

提问 配置网络对双向PIM的支持

回答

RP路由器

Router-RP1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router-RP1(config)#ip multicast-routing

Router-RP1(config)#ip pim bidir-enable

Router-RP1(config)#ip pim rp-address 192.168.12.1 bidir

Router-RP1(config)#ip pim rp-candidate Loopback0 group-list 15 bidir

Router-RP1(config)#ip pim bsr-candidate Loopback0 1

Router-RP1(config)#access-list 15 permit 239.5.5.0 0.0.0.255

Router-RP1(config)#access-list 15 deny any

Router-RP1(config)#interface Loopback0

Router-RP1(config-if)#ip address 192.168.12.1 255.255.255.255

Router-RP1(config-if)# ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#interface FastEthernet0/0

Router-RP1(config-if)#ip address 192.168.1.1 255.255.255.0

Router-RP1(config-if)#ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#interface Serial1/0

Router-RP1(config-if)#ip address 192.168.2.5 255.255.255.252

Router-RP1(config-if)#ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#end

Router-RP1#

其他路由器

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim bidir-enable

Router1(config)#ip pim rp-address 192.168.12.1 bidir

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.2 255.255.255.0

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#interface Serial1/0

Router1(config-if)#ip address 192.168.3.5 255.255.255.252

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#end

Router1#

注释 双向PIM类似PIM-SM,但是在机理上稍微有所不同,如果要部署双向PIM一定要在全网路由器上都配置支持,版本都要在12.2以上

23.6.  在Frame Relay或者ATM 网络中使用组播

提问 在NBMA网络中使用PIM-SM

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface Serial0/0

Router1(config-if)#encapsulation frame-relay

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#ip pim nbma-mode

Router1(config-if)#end

Router1#

注释 对于通常的NBMA网络中的NBMA接口无法区分下联不同接口的组播请求,通过ip pim nbma-mode命令来各自邻居的组播请求

23.7.  配置CGMP

提问 配置路由器和Catalyst交换机之间使用CGMP通讯

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip cgmp

Router1(config-if)#end

Router1#

注释 不同交换机上启用CGMP的命令可能不同,也不是所有的交换机都支持CGMP

23.8.  使用IGMP版本3

提问 配置IGMPv3

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim ssm default

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip igmp version 3

Router1(config-if)#end

Router1#

如果想使用Source-Specific Multicast(SSM)特性,但是终端设备不支持v3,可以使用思科的IGMP v3lite

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim ssm default

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip igmp v3lite

Router1(config-if)#end

Router1#

注释 v3里面最有用的特性就是SSM,不但可以指定想要接收的组播组,还可以指定组播源

23.9.  静态组播路由和组成员

提问 使用静态条目来取代动态的组播路由和组成员

回答

静态组播路由:

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip mroute 192.168.15.0 255.255.255.0 192.168.98.6

Router1(config)#interface Tunnel0

Router1(config-if)#ip address 192.168.98.5 255.255.255.252

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#tunnel mode gre ip

Router1(config-if)#end

Router1#

静态组成员

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip igmp join-group 239.5.5.55

Router1(config-if)#end

Router1#

注释 在12.3(2)T后引入了相近的ip igmp join-group命令,好处是此命令使用fast switching来处理组播包

23.10.  启用MOSPF来进行组播路由

提问 使用MOSPF来分发组播路由表

回答 思科不支持MOSPF

23.11.  启用DVMRP来进行组播路由

提问 配置DVMRP来支持组播路由

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip dvmrp unicast-routing

Router1(config-if)#ip dvmrp summary-address 192.168.0.0 255.255.0.0

Router1(config-if)#end

Router1#

注释 思科对DVMRP的支持也不是全面的,更多的是作为DVMRP和PIM之间的网关,而目前网络中很少有DVMRP的部署,推荐使用PIM,PIM使用的是单播的路由表,而DVMRP是自己维护一个组播路由表,使用224.0.0.4这个组播地址来交换邻居信息

23.12.  DVMRP 隧道

提问 建立DVMRP隧道来穿越不支持组播的网络

回答

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#interface Tunnel0

Router1(config-if)#ip unnumbered FastEthernet0/0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#ip dvmrp unicast-routing

Router1(config-if)#tunnel source FastEthernet0/0

Router1(config-if)#tunnel destination 192.168.99.15

Router1(config-if)#tunnel mode dvmrp

Router1(config-if)#exit

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.1 255.255.255.0

Router1(config-if)#ip pim sparse-dense-mode

Router1(config-if)#end

Router1#

注释 DVMRP隧道是建立在思科路由器和传统的支持DVMRP的设备上,两台思科设备之间不支持这种隧道,这种隧道只能封装的是组播包,隧道接口和源接口都必须启用PIM。

23.13.  配置双向PIM(Configuring Bidirectional PIM)

提问 配置网络对双向PIM的支持

回答

RP路由器

Router-RP1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router-RP1(config)#ip multicast-routing

Router-RP1(config)#ip pim bidir-enable

Router-RP1(config)#ip pim rp-address 192.168.12.1 bidir

Router-RP1(config)#ip pim rp-candidate Loopback0 group-list 15 bidir

Router-RP1(config)#ip pim bsr-candidate Loopback0 1

Router-RP1(config)#access-list 15 permit 239.5.5.0 0.0.0.255

Router-RP1(config)#access-list 15 deny any

Router-RP1(config)#interface Loopback0

Router-RP1(config-if)#ip address 192.168.12.1 255.255.255.255

Router-RP1(config-if)# ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#interface FastEthernet0/0

Router-RP1(config-if)#ip address 192.168.1.1 255.255.255.0

Router-RP1(config-if)#ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#interface Serial1/0

Router-RP1(config-if)#ip address 192.168.2.5 255.255.255.252

Router-RP1(config-if)#ip pim sparse-mode

Router-RP1(config-if)#exit

Router-RP1(config)#end

Router-RP1#

其他路由器

Router1#configure terminal

Enter configuration commands, one per line.  End with CNTL/Z.

Router1(config)#ip multicast-routing

Router1(config)#ip pim bidir-enable

Router1(config)#ip pim rp-address 192.168.12.1 bidir

Router1(config)#interface FastEthernet0/0

Router1(config-if)#ip address 192.168.1.2 255.255.255.0

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#interface Serial1/0

Router1(config-if)#ip address 192.168.3.5 255.255.255.252

Router1(config-if)#ip pim sparse-mode

Router1(config-if)#end

Router1#

注释 双向PIM类似PIM-SM,但是在机理上稍微有所不同,如果要部署双向PIM一定要在全网路由器上都配置支持,版本都要在12.2以上

组播命令汇总

No Comments CISCO

SUMMARY STEPS

1. enable
2. configure terminal
3. ip multicast-routing [distributed] //启用多播路由后面一条是SW上的
4. interface type number
5. Either perform Steps 6 and 7 and proceed to Step 9 or perform Step 8 and then proceed to Step 9.
6. ip pim sparse-mode ////SP模式
7. ip pim autorp listener /////让SP支持AUTO-RP
8. ip pim sparse-dense-mode ///sp&de模式
9. end
10. Repeat Steps 1 through 9 on all PIM interfaces.
11. ip pim send-rp-announce {interface-type interface-number | ip-address} scope ttl-value [group-list access-list] [intervalseconds] [bidir] ///////C-RP
12. ip pim send-rp-discovery [interface-type interface-number] scope ttl-value [interval seconds] /////////MA
13. ip pim rp-announce-filter rp-list access-list group-list access-list ////RP过滤
14. no ip pim dm-fallback ////防止在SP&DE模式时RP挂了之后回到DE模式
15. interface type number
16. ip multicast boundary access-list [filter-autorp]
17. end
18. show ip pim autorp
19. show ip pim rp [mapping] [rp-address]
20. show ip igmp groups [group-name | group-address | interface-type interface-number] [detail]
21. show ip mroute [group-address | group-name] [source-address | source-name] [interface-type interface-number] [summary] [count] [active kbps]

组播排错

No Comments 网络技术

 

r1#sh ip pim ap
r1#sh ip pim rp
r1#sh ip pim rp

看不到RP

r1#sh 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,
       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
Outgoing interface flags: H – Hardware switched, A – Assert winner
Timers: Uptime/Expires
Interface state: Interface, Next-Hop or VCD, State/Mode

(*, 224.0.1.39), 00:28:29/stopped, RP 0.0.0.0, flags: DC
Incoming interface: Null, RPF nbr 0.0.0.0
Outgoing interface list:
    Ethernet0/1, Forward/Sparse-Dense, 00:28:29/00:00:00
    Serial0/0, Forward/Sparse-Dense, 00:28:29/00:00:00

(10.10.4.4, 224.0.1.39), 00:18:58/00:02:51, flags: T
Incoming interface: Serial0/0, RPF nbr 10.10.11.4
Outgoing interface list:
    Ethernet0/1, Forward/Sparse-Dense, 00:18:59/00:00:00

(*, 224.0.1.40), 00:28:43/stopped, RP 0.0.0.0, flags: DCL
Incoming interface: Null, RPF nbr 0.0.0.0
Outgoing interface list:
    Ethernet0/1, Forward/Sparse-Dense, 00:28:43/00:00:00
    Serial0/0, Forward/Sparse-Dense, 00:28:43/00:00:00

(10.10.4.4, 224.0.1.40), 00:10:16/00:02:39, flags: LT
Incoming interface: Serial0/0, RPF nbr 10.10.11.4
Outgoing interface list:
    Ethernet0/1, Forward/Sparse-Dense, 00:10:17/00:00:00

看不到正确的组

r1#ping 224.30.30.30
Translating "224.30.30.30"

Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 224.30.30.30, timeout is 2 seconds:

Reply to request 0 from 10.10.11.4, 104 ms

组可以PING通

再SHOW RP, 已经显示加入组?原因,不知,可能PIM进程要激活,

r1#sh ip pim rp
r1#sh ip pim rp
Group: 224.30.30.30, RP: 10.10.4.4, v2, v1, uptime 00:10:48, expires 00:02:04
Group: 224.50.50.50, RP: 10.10.4.4, v2, v1, uptime 00:10:48, expires 00:02:02