源码:--------------------------------------------------------------------------------
Multicast is a UDP-based protocol which literally delivers packets from one
host to many. If abused, it can be made to deliver from many hosts to
many hosts to many hosts to many hosts... This is why it's important to
setup multicasting routing on the routers in a sane manner.
1. First, enable the global multicast routing parameter by:
!
ip multicast-routing
!
This can be disabled, if you so choose, by doing:
!
no ip multicast-routing
!
2. Next, select your style of multicasting. I chose PIM (Protocol-
Independent Multicast) for the following reasons:
- PIM works with all existing multicast routing protocols.
- PIM has two modes (dense & sparse) which gives me some freedom at
configuration time.
You could also choose from IGMP (Internet Group Management Protocol,
which is good for large WANs) or DVMRP (Distance Vector Multicast
Routing Protocol, which is slightly unsupported). However, be aware
that Cisco only tacitly supports DVMRP. To use DVMRP with a Cisco
router, you need to point your Cisco to a router that DOES support
DVMRP directly.
Of the two PIM choices, I went with dense mode. Here are the differences:
- Dense mode: When the router receives a multicast packet, the router
sends the packet out of all interfaces except for the interface from
whence the packet originated. If the router discovers that a certain
interface has no multicast recipients, it sends a "prune" message back
to the sender stating that there is no need to send messages to that
interface/subnet/link/host.
- Sparse mode: In sparse mode, it is assumed that no host wants multi-
cast packets unless the host specifically asks for it. So, instead
of the shotgun approach of dense mode, one router becomes the central
hub. This central hub logs all hosts that wish to receive multicast.
Further multicast packets are sent only to those hosts.
Seeing as how we only have two routers, I did not want one router to be
burdened with the list of multicast hosts (especially since practically
ALL of our hosts "want" multicast). Additionally, I did not want to
spend time fudging entries in the multicast recipient list.
So, to configure for PIM dense mode multicast routing:
!
interface ethernet 0
ip pim dense-mode
!
interface ethernet 1
ip pim dense-mode
!
Obviously, all involved routers should be speaking the same lingo. Thus,
routerA is configured the same as routerB.
3. Next, you need to set the multicast threshold. This is the BIG TRICK[tm]
to multicast routing. In a nutshell, every multicast packet has a TTL.
That's basic to all IP. By setting the multicast threshold on a given
router interface, you create a hurdle. If the packet's TTL is higher
than the multicast threshold, the packet may pass. If the packet's TTL
is LOWER than the multicast threshold, the packet is stopped (actually,
it is bounced with an ICMP message, but that's for another "howto" ;-).
This is how one prevents multicast packets from careening out into the
great 'Net. The range for multicast threshold is 0 to 255, with 0
meaning all packets may pass (well, *almost* all) and 255 meaning
virtually no packets may pass. On the routerB router, I set up the
multicast threshold at a comfortable 1 (because this is an internal
router). The multicast threshold on the interface leading to the
Internet on routerA should be set at 255 (if, in fact, multicast is
enabled on the interface at all).
!
interface ethernet 0
ip multicast-threshold 1
!
interface ethernet 1
ip multicast-threshold 1
!
And you're set!
4. It's probably a VERY good idea at this point to save your config. I
choose to save off to tftp (in case my NVRAM gets scrammed), but you
can choose your own danger here. At the least, you should copy your
running-config to your saved config.
router#copy running-config startup-config
文章来源于领测软件测试网 https://www.ltesting.net/
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073