In unicast routing and forwarding, unicast packets are transmitted along a point-to-point path. Routers only need to know the destination address of a packet to find the outbound interface. In multicast routing and forwarding, however, routers cannot know the location of a specific receiver because the destination address of a multicast packet identifies a group of receivers. Because routers can find out the source of a multicast packet based on the source address, they can check the source addresses of multicast packets to ensure correct forwarding paths. The process of checking the forwarding path based on the source address is a reverse path forwarding (RPF) check.
When a router receives a multicast packet, it searches the unicast routing table for the route to the source address of the packet. After finding the route, the router checks whether the outbound interface for the route is the same as the inbound interface of the multicast packet. If they are the same, the router considers that the multicast packet has been received from a correct interface. This ensures correct forwarding paths for multicast packets.
The correct interface is called an RPF interface.
In addition to unicast routes, RPF checks can also be performed using Multiprotocol Border Gateway Protocol (MBGP) routes and static multicast routes. If a router has all these routes, it performs an RPF check on a multicast packet in the following way:
The router selects an optimal route from each of the unicast routing table, MBGP routing table, and multicast static routing table according to the source address of the multicast packet. The outbound interfaces of the unicast and MBGP routes are RPF interfaces, and the next hops of those routes are the RPF neighbors. The RPF interface and RPF neighbor of the multicast static route have been specified when the route is manually configured.
The router selects one of the three routes as the RPF route according to the following rules:
The router compares the inbound interface of the packet with the RPF interface of the selected RPF route. If the inbound interface is the same as the RPF interface, the router considers that the packet has arrived on the correct path from the source and forwards the packet downstream. If the inbound interface is different from the RPF interface, the packet fails the RPF check. The router considers that the packet is received from an incorrect interface and drops the packet.
Multicast routing protocols determine upstream and downstream neighbors and create multicast routing entries based on unicast routes, MBGP routes, and multicast static routes. The RPF check mechanism enables multicast data streams to be transmitted along the multicast distribution tree and prevents loops on forwarding paths.
If a router searches the unicast routing table to perform an RPF check on every multicast data packet received, many system resources are consumed. To save system resources, a router first searches for the matching (S, G) entry after receiving a data packet sent from a source to a group.