PIM-ASM Configuration
40 min
introduction introduction pim stands for protocol independent multicast, which means it can utilize the unicast routing table generated by static routing or any unicast routing protocol (including rip, ospf, is is, bgp, etc ) to provide routing for ip multicast multicast routing is independent of the unicast routing protocol used, as long as the corresponding multicast routing table entries can be generated through the unicast routing protocol as a multicast routing solution, it directly leverages the routing information from the unicast routing table to perform rpf (reverse path forwarding) checks on multicast packets once the checks are passed, multicast routing table entries are created to forward the multicast packets as an intra domain multicast routing protocol, pim supports two modes dense mode (pim dm) and sparse mode (pim sm) pim sm (asm) operates as a sparse network model, and its implementation involves the following key aspects maintenance of a critical pim router in the network the rendezvous point (rp), which serves any group members or multicast sources that may appear all pim routers in the network are aware of the rp's location when a group member appears (a user host joins a multicast group g via igmp), the last hop router sends a join message toward the rp this process creates ( , g) entries hop by hop, forming a rendezvous point tree (rpt) rooted at the rp when an active multicast source emerges (the source sends the first multicast packet to group g), the first hop router encapsulates the multicast data in register messages and unicasts them to the rp the rp then creates (s, g) entries, registering the source information basic concepts basic concepts rpt check rpt check the router looks up the egress interface corresponding to the multicast source or rp in the unicast routing table (when using spt, it looks up the egress interface for the multicast source; when using rpt, it looks up the egress interface for the rp) this egress interface is the rpf interface if the multicast packet is received from the rpf interface, the rpf check passes, and the packet is forwarded to downstream interfaces; otherwise, it is discarded in addition to correctly forwarding packets according to the multicast routing configuration, the rpf check can also prevent potential loops neighbor discovery neighbor discovery on a pim router, every interface enabled with the pim protocol will send out hello messages the hello message is encapsulated in a multicast packet with a destination address of 224 0 0 13 (representing all pim routers on the same network segment), a source address of the interface’s ip address, and a ttl value of 1 the purpose of the hello message is to discover pim neighbors, negotiate various pim protocol parameters, and maintain neighbor relationships dr election dr election on a network segment where multicast sources or group members are located, multiple pim routers are typically connected these pim routers become neighbors by exchanging hello messages, which carry dr priority and the interface address of the segment each pim router compares its own conditions with the information in the received hello messages to elect a designated router (dr), which will be responsible for sending and receiving multicast packets on behalf of the source or group members the election rules are as follows the router with the higher dr priority wins (provided all pim routers on the segment support dr priority) if dr priorities are equal, or if at least one pim router on the segment does not support carrying dr priority in hello messages, the router with the higher ip address wins if the current dr fails, pim neighbor relationships will timeout, triggering a new round of dr election among the remaining pim neighbors in the asm model, the dr primarily serves the following functions on a shared segment connected to a multicast source, the dr is responsible for sending register messages to the rp the dr connected to the multicast source is referred to as the source side dr on a shared segment connected to group members, the dr is responsible for sending join messages toward the rp the dr connected to group members is referred to as the member side dr rp discovery rp discovery the rendezvous point (rp) is a critical pim router in the network, responsible for processing registration messages from source side drs and handling join requests from group members all pim routers in the network must be aware of the rp’s address, which functions as a central hub for coordinating multicast supply and demand information a single rp can serve multiple multicast groups simultaneously, but each multicast group can be associated with only one rp currently, the rp can be configured using the following methods static rp the same rp address is manually configured on all pim routers in the network, statically defining the location of the rp dynamic rp several pim routers within the pim domain are configured as candidate rps (c rps) to dynamically participate in rp election additionally, a candidate bsr (c bsr) must be configured and elected as the bootstrap router (bsr) the bsr collects advertisement messages from c rps and distributes the rp information to all pim routers within the pim sm domain rpt construction rpt construction the pim sm rpt (rendezvous point tree) is a multicast distribution tree with the rp as its root and pim routers connected to group members as leaves when a group member appears (e g , a user host joins multicast group g via igmp), the member side dr sends a join message toward the rp this process creates ( , g) entries hop by hop along the path to the rp, forming an rpt rooted at the rp during rpt construction, each pim router performing the join message forwarding conducts an rpf check it looks up the unicast route to the rp, where the egress interface of this route is considered the upstream interface, and the next hop becomes the rpf neighbor the join message is then forwarded hop by hop from the member side dr until it reaches the rp multicast source registration multicast source registration in a pim sm network, any newly active multicast source must first "register" with the rp before its multicast traffic can be delivered to group members the detailed process is as follows the multicast source sends multicast packets to the source side dr upon receiving these multicast packets, the source side dr encapsulates them within register messages and forwards them to the rp after receiving the register message, the rp decapsulates it, creates an (s, g) entry, and forwards the multicast data along the rpt to reach group members assert assert when multiple pim routers connected to the same network segment pass the rpf check and attempt to forward multicast packets to that segment, the assert mechanism is used to ensure that only one pim router forwards multicast packets to the segment after receiving identical multicast packets from a neighbor router, a pim router multicasts an assert message to all pim routers on the local segment, using the permanent group address 224 0 0 13 as the destination upon receiving the assert message, other pim routers compare their own parameters with those carried in the received message to participate in an assert election the election rules are as follows the router with the higher unicast routing protocol priority wins if priorities are equal, the router with the lower cost to the multicast source wins if all of the above are identical, the router with the highest ip address on the downstream interface wins based on the assert election result, routers perform the following actions the winning router's downstream interface is called the assert winner and is responsible for forwarding subsequent multicast packets to the segment the losing router's downstream interface is called the assert loser and will cease forwarding multicast packets to the segment the pim router also removes this interface from the downstream interface list in the (s, g) entry after the assert election, only one downstream interface remains active on the segment, forwarding only one copy of the multicast traffic all assert losers may periodically resume multicast packet forwarding, triggering recurring assert elections pim basic configuration pim basic configuration pim interface pim interface operation command description enter the system configuration view configure terminal enter interface view interface ethernet interface id interface id refers to the interface identifier, which can also be a vlanif/lagif interface enable pim ip pim enable pim on the interface enable multicast routing forwarding multicast enable enable multicast routing forwarding on the interface static rp configuration static rp configuration operation command description enter the system configuration view configure terminal config statis rp address ip pim rp a b c d a b c d/m a b c d represents the rp address; a b c d/m represents the multicast group address dynamic rp configuration dynamic rp configuration operation command description enter the system configuration view configure terminal config c bsr address ip pim bsr candidate bsr source interface specify the ip address of the c bsr config c bsr priority ip pim bsr candidate bsr priority priority configure c bsr priority, default 64, range 0 255; a larger value indicates higher priority the rules for c bsr to compete for bsr are as follows 1 c bsr priority, the larger the id, the higher the priority 2 c bsr ip address, the larger the address, the higher the priority config c rp address ip pim bsr candidate rp source interface inteval interval priority priority specify the c rp ip address, advertisement interval, and priority priority defaults to 192, range 0 255; a smaller value indicates higher priority the rules for c rp to compete for rp are as follows 1 mask length of the multicast group range covered by the c rp 2 c rp priority, the smaller the id, the higher the priority 3 hash value, the larger the value, the higher the priority 4 c rp ip address, the larger the address, the higher the priority configure the multicast group address range covered by the c rp ip pim bsr candidate rp group a b c d/m a b c d/m is the multicast group address segment during c rp election, the longest mask match of the multicast address range has higher priority source side dr configuration source side dr configuration operation command description enter the system configuration view configure terminal enter interface view interface ethernet interface id interface connected to the multicast source enable pim functionality ip pim enable pim on the interface enable multicast routing and forwarding multicast enable enable multicast routing and forwarding on the interface enable source‑side dr registration unknown multicast trap enable unknown multicast traffic to be sent to the cpu for source‑side dr registration static mroute configuration static mroute configuration operation command description enter the system configuration view configure terminal enter interface view interface ethernet interface id interface id refers to the interface identifier, which can also be a vlanif/lagif interface config static mroute entry ip mroute ethernet interface id a b c d a b c d interface id refers to the outgoing interface in the multicast routing table entry; a b c d represent the parameters of the (s, g) entry when configuring static multicast routes, ensure that both the interface and outgoing interface have pim enabled source side dr configuration source side dr configuration operation command description enter the system configuration view configure terminal enter interface view interface ethernet interface id interface connected to the multicast source enable pim functionality ip pim enable pim on the interface enable multicast routing and forwarding multicast enable enable multicast routing and forwarding on the interface enable source‑side dr registration unknown multicast trap enable unknown multicast traffic to be sent to the cpu for source‑side dr registration display and maintenance display and maintenance operation command view the pim interface show ip pim interface view the pim neighbors show ip pim neighbors view the rp address show ip pim rp info view the mroute entries show ip mroute view the rpf interface show ip pim rpf configuration example configuration example static rp configuration example static rp configuration example the host and the multicast source are interconnected at layer 3 through three switches, with all switches running the ospf protocol the requirement is to enable the host (pc) to access video services from the multicast source via the layer 3 network through video on demand procedure procedure device a \# configure ip address of interfaces sonic(config)# interface ethernet 1 sonic(config if 1)# ip address 30 1 1 2/30 sonic(config)# interface ethernet 2 sonic(config if 2)# ip address 20 1 1 1/30 \# configure ospf neighbor and distribute route sonic(config)# router ospf sonic(config router)# ospf router id 30 1 1 2 sonic(config router)# network 30 1 1 0/30 area 0 0 0 0 sonic(config router)# network 20 1 1 0/30 area 0 0 0 0 \# configure the pim interface, enable multicast routing and forwarding, set a static rp address, and activate the source side dr's capability to forward unknown multicast traffic sonic(config)# interface ethernet 1 sonic(config if 1)# multicast enable sonic(config if 1)# ip pim sonic(config)# interface ethernet 2 sonic(config if 2)# multicast enable sonic(config if 2)# ip pim sonic(config)# ip pim rp 20 1 1 2 224 1 1 0/24 sonic(config)# unknown multicast trap device b \# configure ip address of interfaces sonic(config)# interface ethernet 1 sonic(config if 1)# ip address 10 1 1 1/30 sonic(config)# interface ethernet 2 sonic(config if 2)# ip address 20 1 1 2/30 \# configure ospf neighbor and distribute route sonic(config)# router ospf sonic(config router)# ospf router id 20 1 1 2 sonic(config router)# network 10 1 1 0/30 area 0 0 0 0 sonic(config router)# network 20 1 1 0/30 area 0 0 0 0 \# configure the pim interface, enable multicast routing and forwarding, set a static rp address, and activate the source side dr's capability to forward unknown multicast traffic sonic(config)# interface ethernet 1 sonic(config if 1)# multicast enable sonic(config if 1)# ip pim sonic(config)# interface ethernet 2 sonic(config if 2)# multicast enable sonic(config if 2)# ip pim sonic(config)# ip pim rp 20 1 1 2 224 1 1 0/24 device c \# configure ip address of interfaces sonic(config)# vlan 100 sonic(config)# interface ethernet 10 sonic(config if 10)# switchport access vlan 100 sonic(config)# interface ethernet 1 sonic(config if 1)# ip address 10 1 1 2/30 sonic(config)# interface vlan 100 sonic(config vlanif 100)# ip address 100 1 1 1/24 sonic(config vlanif 100)# exit \# configure ospf neighbor and distribute route sonic(config)# router ospf sonic(config router)# ospf router id 10 1 1 2 sonic(config router)# network 100 1 1 0/24 area 0 0 0 0 sonic(config router)# network 10 1 1 0/30 area 0 0 0 0 \# configure the pim interface, enable multicast routing and forwarding, set a static rp address, and activate the source side dr's capability to forward unknown multicast traffic sonic(config)# interface ethernet 1 sonic(config if 1)# multicast enable sonic(config if 1)# ip pim sonic(config)# interface vlan 100 sonic(config vlanif 100)# ip igmp sonic(config vlanif 100)# ip pim sonic(config)# ip pim rp 20 1 1 2 224 1 1 0/24 verify configuration verify configuration the pc initiates a video on demand request for multicast source video services devices a, b, and c can dynamically establish pim entries and perform guided forwarding dynamic rp configuration example dynamic rp configuration example the host and multicast source are interconnected via four layer 3 switches, all running ospf protocol the host pc is required to be able to request video services from the multicast source over the layer 3 network the network uses dynamic rp; if the rp fails, a new rp can be elected to continue providing services taking the following topology as an example device b and device c are configured as c rps covering the multicast range 224 1 1 0/24 by setting priorities, device b is elected as the rp, and device c serves as the backup c rp when device b fails, device c can be elected as the new rp to continue service procedure device a \# configure an ip address and loopback0 address for the interface sonic(config)# interface ethernet 9 sonic(config if 9)# ip address 10 1 1 2/24 sonic(config)# interface ethernet 7 sonic(config if 7)# ip address 20 1 1 1/24 sonic(config)# interface ethernet 8 sonic(config if 8)# ip address 21 1 1 1/24 sonic(config)# interface loopback 0 sonic(config loif 0)# ip address 120 1 1 217/32 \# configure ospf neighbors and advertise routes sonic(config)# router ospf sonic(config router)# ospf router id 120 1 1 217 sonic(config router)# network 10 1 1 0/24 area 0 0 0 0 sonic(config router)# network 20 1 1 0/24 area 0 0 0 0 sonic(config router)# network 21 1 1 0/24 area 0 0 0 0 sonic(config router)# network 120 1 1 217/32 area 0 0 0 0 \# configure pim on the interface, enable multicast routing and forwarding, and enable source side dr to forward unknown multicast traffic to the cpu sonic(config)# interface ethernet 9 sonic(config if 9)# multicast enable sonic(config if 9)# ip pim sonic(config)# interface ethernet 7 sonic(config if 7)# multicast enable sonic(config if 7)# ip pim sonic(config)# interface ethernet 8 sonic(config if 8)# multicast enable sonic(config if 8)# ip pim sonic(config)# interface loopback 0 sonic(config loif 0)# ip pim sonic(config)# unknown multicast trap \# configure c bsr, specifying the priority and ip address of the c bsr sonic(config)# ip pim bsr candidate bsr source interface loopback 0 priority 200 device b \# configure an ip address and loopback0 address for the interface sonic(config)# interface ethernet 11 sonic(config if 11)# ip address 20 1 1 2/24 sonic(config)# interface ethernet 47 sonic(config if 47)# ip address 30 1 1 1/24 sonic(config)# interface ethernet 1 sonic(config if 1)# ip address 41 1 1 1/24 sonic(config)# interface loopback 0 sonic(config loif 0)# ip address 120 1 1 80/32 \# configure ospf neighbors and advertise routes sonic(config)# router ospf sonic(config router)# ospf router id 120 1 1 80 sonic(config router)# network 20 1 1 0/24 area 0 0 0 0 sonic(config router)# network 30 1 1 0/24 area 0 0 0 0 sonic(config router)# network 41 1 1 0/24 area 0 0 0 0 sonic(config router)# network 120 1 1 80/32 area 0 0 0 0 \# configure pim on the interface, enable multicast routing and forwarding sonic(config)# interface ethernet 11 sonic(config if 11)# multicast enable sonic(config if 11)# ip pim sonic(config)# interface ethernet 47 sonic(config if 47)# multicast enable sonic(config if 47)# ip pim sonic(config)# interface ethernet 1 sonic(config if 1)# multicast enable sonic(config if 1)# ip pim sonic(config)# interface loopback 0 sonic(config loif 0)# ip pim \# configure c bsr, specifying the ip address configure c rp, specifying the ip address, covered multicast group address, and priority sonic(config)# ip pim bsr candidate bsr source interface loopback 0 sonic(config)# ip pim bsr candidate rp source interface loopback 0 priority 98 sonic(config)# ip pim bsr candidate rp group 224 1 1 0/24 device c \# configure an ip address and loopback0 address for the interface sonic(config)# interface ethernet 11 sonic(config if 11)# ip address 21 1 1 2/24 sonic(config)# interface ethernet 47 sonic(config if 47)# ip address 30 1 1 2/24 sonic(config)# interface ethernet 1 sonic(config if 1)# ip address 40 1 1 1/24 sonic(config)# interface loopback 0 sonic(config loif 0)# ip address 120 1 1 81/32 \# configure ospf neighbors and advertise routes sonic(config)# router ospf sonic(config router)# ospf router id 120 1 1 81 sonic(config router)# network 21 1 1 0/24 area 0 0 0 0 sonic(config router)# network 30 1 1 0/24 area 0 0 0 0 sonic(config router)# network 40 1 1 0/24 area 0 0 0 0 sonic(config router)# network 120 1 1 81/32 area 0 0 0 0 \# configure pim on the interface, enable multicast routing and forwarding sonic(config)# interface ethernet 11 sonic(config if 11)# multicast enable sonic(config if 11)# ip pim sonic(config)# interface ethernet 47 sonic(config if 47)# multicast enable sonic(config if 47)# ip pim sonic(config)# interface ethernet 1 sonic(config if 1)# multicast enable sonic(config if 1)# ip pim sonic(config)# interface loopback 0 sonic(config loif 0)# ip pim \# configure c bsr, specifying the ip address configure c rp, specifying the ip address, covered multicast group address, and priority sonic(config)# ip pim bsr candidate bsr source interface loopback 0 sonic(config)# ip pim bsr candidate rp source interface loopback 0 priority 99 sonic(config)# ip pim bsr candidate rp group 224 1 1 0/24 4 device d \# configure an ip address and loopback0 address for the interface sonic(config)# interface ethernet 49 sonic(config if 49)# ip address 41 1 1 2/24 sonic(config)# interface ethernet 50 sonic(config if 50)# ip address 40 1 1 2/24 sonic(config)# interface loopback 0 sonic(config loif 0)# ip address 120 1 1 122/32 \# configure an ip address for the service interface and enable igmp functionality sonic(config)# mcast snooping enable sonic(config)# vlan 100 sonic(config vlan 100)# igmp snooping enable sonic(config vlan 100)# igmp snooping version 3 sonic(config)# interface ethernet 1 sonic(config if 1)# switchport access vlan 100 sonic(config)# interface ethernet 2 sonic(config if 2)# switchport access vlan 100 sonic(config)# interface vlan 100 sonic(config vlanif 100)# ip address 50 1 1 1/24 sonic(config vlanif 100)# ip igmp \# configure ospf neighbors and advertise routes sonic(config)# router ospf sonic(config router)# ospf router id 120 1 1 122 sonic(config router)# network 40 1 1 0/24 area 0 0 0 0 sonic(config router)# network 41 1 1 0/24 area 0 0 0 0 sonic(config router)# network 50 1 1 0/24 area 0 0 0 0 sonic(config router)# network 120 1 1 122/32 area 0 0 0 0 \# configure pim on the interface, enable multicast routing and forwarding sonic(config)# interface ethernet 49 sonic(config if 49)# multicast enable sonic(config if 49)# ip pim sonic(config)# interface ethernet 50 sonic(config if 50)# multicast enable sonic(config if 50)# ip pim sonic(config)# interface loopback 0 sonic(config loif 0)# ip pim sonic(config)# interface vlan 100 sonic(config vlanif 100)# multicast enable sonic(config vlanif 100)# ip pim \# configure c‑bsr, specifying the ip address sonic(config)# ip pim bsr candidate bsr source interface loopback 0 verify configuration check the bsr election result and rp address on each device respectively \# device a sonic# show ip pim bsr pimv2 bootstrap router information current preferred bsr address 120 1 1 217 priority fragment tag state uptime 200 12463 bsr elected 20 08 29 sonic# sonic# show ip pim rp info rp address group/prefix list oif i am rp source 120 1 1 80 224 1 1 0/24 ethernet7 no bsr sonic# sonic# show ip pim bsrp info bsr address 120 1 1 217 group address 224 1 1 0/24 \ rp address priority holdtime hash (active) 120 1 1 80 98 151 1767032558 120 1 1 81 99 151 663517313 (pending) pending rp count 0 partial list is empty \# device b sonic# show ip pim bsr pimv2 bootstrap router information current preferred bsr address 120 1 1 217 priority fragment tag state uptime 200 12467 accept preferred 18 28 46 last bsm seen 00 00 47 sonic# sonic# show ip pim rp info rp address group/prefix list oif i am rp source 120 1 1 80 224 1 1 0/24 loopback0 yes bsr sonic# sonic# show ip pim bsrp info bsr address 120 1 1 217 group address 224 1 1 0/24 \ rp address priority holdtime hash (active) 120 1 1 80 98 151 1767032558 120 1 1 81 99 151 663517313 (pending) pending rp count 0 partial list is empty \# device c sonic# show ip pim bsr pimv2 bootstrap router information current preferred bsr address 120 1 1 217 priority fragment tag state uptime 200 12469 accept preferred 18 30 53 last bsm seen 00 00 55 sonic# sonic# show ip pim rp info rp address group/prefix list oif i am rp source 120 1 1 80 224 1 1 0/24 ethernet47 no bsr sonic# sonic# show ip pim bsrp info bsr address 120 1 1 217 group address 224 1 1 0/24 \ rp address priority holdtime hash (active) 120 1 1 80 98 151 1767032558 120 1 1 81 99 151 663517313 (pending) pending rp count 0 partial list is empty device d sonic# show ip pim bsr pimv2 bootstrap router information current preferred bsr address 120 1 1 217 priority fragment tag state uptime 200 12471 accept preferred 17 36 24 last bsm seen 00 00 21 sonic# sonic# show ip pim rp info rp address group/prefix list oif i am rp source 120 1 1 80 224 1 1 0/24 ethernet49 no bsr sonic# sonic# show ip pim bsrp info bsr address 120 1 1 217 group address 224 1 1 0/24 \ rp address priority holdtime hash (active) 120 1 1 80 98 151 1767032558 120 1 1 81 99 151 663517313 (pending) pending rp count 0 partial list is empty the dynamic rp network converges correctly, with devicea elected as the bsr and deviceb elected as the rp for the multicast address range 224 1 1 0/24 at this point, the pc can initiate on demand services within the 224 1 1 0/24 segment normally, and deviceb can establish multicast forwarding entries to guide data forwarding after deviceb fails, the dynamic rp convergence results on each device are as follows device a sonic# show ip pim bsr pimv2 bootstrap router information current preferred bsr address 120 1 1 217 priority fragment tag state uptime 200 12483 bsr elected 20 23 13 last bsm seen 00 00 16 sonic# sonic# show ip pim rp info rp address group/prefix list oif i am rp source 120 1 1 81 224 1 1 0/24 ethernet8 no bsr sonic# sonic# show ip pim bsrp info bsr address 120 1 1 217 group address 224 1 1 0/24 \ rp address priority holdtime hash (active) 120 1 1 81 99 151 663517313 (pending) pending rp count 0 partial list is empty device c sonic# show ip pim bsr pimv2 bootstrap router information current preferred bsr address 120 1 1 217 priority fragment tag state uptime 200 12484 accept preferred 18 42 11 last bsm seen 00 00 01 sonic# sonic# show ip pim rp info rp address group/prefix list oif i am rp source 120 1 1 81 224 1 1 0/24 loopback0 yes bsr sonic# sonic# show ip pim bsrp info bsr address 120 1 1 217 group address 224 1 1 0/24 \ rp address priority holdtime hash (active) 120 1 1 81 99 151 663517313 (pending) pending rp count 0 partial list is empty device d sonic# show ip pim bsr pimv2 bootstrap router information current preferred bsr address 120 1 1 217 priority fragment tag state uptime 200 12488 accept preferred 00 01 09 last bsm seen 00 00 09 sonic# sonic# show ip pim rp info rp address group/prefix list oif i am rp source 120 1 1 81 224 1 1 0/24 ethernet50 no bsr sonic# sonic# show ip pim bsrp info bsr address 120 1 1 217 group address 224 1 1 0/24 \ rp address priority holdtime hash (active) 120 1 1 81 99 151 663517313 (pending) pending rp count 0 partial list is empty the dynamic rp network has converged correctly, with devicec elected as the rp for the multicast address range 224 1 1 0/24 at this point, the pc can normally initiate on‑demand services within the 224 1 1 0/24 segment, and devicec can establish multicast forwarding entries to guide data forwarding
