Unicast Reverse Path Forwarding

uRPF is the multicast RPF lookup pointed at unicast, for the opposite reason: not where to forward, but whether to accept. It does a reverse lookup in the forwarding table to check a packet arrived on the best return path to its source, and discards it if not. Strict mode suits a customer interface; on a multihomed router it drops honest asymmetric traffic, which loose mode accepts.

In Daveth Pro (Network)6 min video · lab: Security

By , founder of Daveth · Updated

Opening frame of the video walkthrough of Unicast Reverse Path Forwarding

Watch this lesson

6 min · Video walkthrough

In Daveth Pro (Network)

The full 6 min walkthrough is in Daveth Pro (Network). See what the plan opens

Upcoming practical lab

Lab C13: Security

What the lab covers

What this page answers

What is Unicast Reverse Path Forwarding?

An input feature that does a reverse lookup in the forwarding table to check that a packet arrived on the best return path to its source address, discarding packets whose source is not valid, which limits spoofed addresses. Read it in “Strict, where you know what should arrive”

Why does strict uRPF drop legitimate traffic on a multihomed router?

An honest packet can arrive through a different link from the one the router would use to return traffic to its source. Strict mode cannot tell that from an attack and drops it. Read it in “So put it on the uplinks too”

What does uRPF loose mode do?

It removes the requirement that the packet arrive on the specific interface toward the source, so traffic is accepted if the source is reachable at all; configured with ip verify unicast source reachable-via any. Read it in “One requirement, removed”

You already know this check

In 1.6.b it was a forwarding mechanism. A multicast router looks the source up in the unicast routing table and checks which interface the packet arrived on.

This is the same lookup, pointed at unicast, for the opposite reason. Multicast asks it where do I forward this? uRPF asks it should I accept this at all?

Unicast RPF does a reverse lookup in the forwarding table to check if any packet received at the interface of a device arrives on the best return path (or return route) to the source of the packet.

Computed from this page's model, not device output. The reverse lookup, on one router.

source          best return path      arrived on  among them?
198.51.100.10   Gi0/0/2               Gi0/0/2     yes
192.0.2.77      Gi0/0/1               Gi0/0/2     no
192.0.2.10      Gi0/0/1               Gi0/0/0     no
198.18.7.1      Gi0/0/0 + Gi0/0/1     Gi0/0/1     yes
10.1.1.1        Gi0/0/0 (default)     Gi0/0/0     yes
240.7.7.7       Gi0/0/0 (default)     Gi0/0/0     yes
203.0.113.5     Null0                 Gi0/0/0     no
2001:db8:c::10  Gi0/0/2               Gi0/0/2     yes
2001:db8:2::99  Gi0/0/1               Gi0/0/2     no
2001:db8:2::10  Gi0/0/1               Gi0/0/0     no
fd00::1         Gi0/0/0 (default)     Gi0/0/0     yes

One thing the name does to people, so get it out of the way. Nothing is sent backwards here. The lookup runs backwards on the map; the packet keeps going forwards, or it is dropped. What gets reversed is the question, not the traffic.

Every row of that table was already in this router before anybody thought about spoofing. The feature is a second use of it: a lookup the router was doing anyway, asked again with source and destination swapped.

Strict, where you know what should arrive

The Unicast Reverse Path Forwarding feature limits the malicious traffic on a network. This feature enables devices to verify the reachability of the source address in packets that are being forwarded and limit the appearance of spoofed or malformed addresses on a network. If the source IP address is not valid, Unicast Reverse Path Forwarding (RPF) discards the packet.
Unicast RPF is an input function and is applied only on the input interface of a device at the upstream end of a connection. Unicast RPF depends on the forwarding table, so if forwarding is not enabled globally on a device, the check will not work on it.

Two keywords, and the difference between them is one word:

Examines incoming packets to determine whether the source address is in the FIB and permits the packet only if the source is reachable through the interface on which the packet was received (sometimes referred to as strict mode). Examines incoming packets to determine whether the source address is in the Forwarding Information Base (FIB) and permits the packet if the source is reachable through any interface (sometimes referred to as loose mode).

Say those two out loud and the difference stops being a wording puzzle. Strict is the router saying: I would send a reply to you back out of that door, so why did you come in through this one? Loose only asks whether there is any way back to you at all. It is not interested in which door.

And be honest about how much either one proves. A route back to the source is a clue, not a signed letter from the source. Anybody who puts a believable address in a packet passes this check. It thins out the lazy lies. It does not catch a liar who did the homework, and it is not authentication however it is sold to you.

That's rx and then any. Start where this router knows exactly what's legitimate: the interface facing the customer LAN, whose only correct sources are 198.51.100.0/24 and 2001:db8:c::/64.

EDGE# configure terminal
EDGE(config)# interface GigabitEthernet0/0/2
EDGE(config-if)# ip verify unicast source reachable-via rx
EDGE(config-if)# ipv6 verify unicast source reachable-via rx
EDGE(config-if)# end

Computed from this page's model, not device output. IPv4: every packet, and what the router did with it.

source         on       returns via           verdict    why
198.51.100.10  Gi0/0/2  Gi0/0/2               forwarded  passed
192.0.2.77     Gi0/0/2  Gi0/0/1               DROPPED    wrong interface
192.0.2.10     Gi0/0/0  Gi0/0/1               forwarded  urpf off
198.18.7.1     Gi0/0/1  Gi0/0/0 + Gi0/0/1     forwarded  urpf off
10.1.1.1       Gi0/0/0  Gi0/0/0 (default)     forwarded  urpf off
240.7.7.7      Gi0/0/0  Gi0/0/0 (default)     forwarded  urpf off
203.0.113.5    Gi0/0/0  Null0                 forwarded  urpf off

Computed from this page's model, not device output. IPv6: every packet, and what the router did with it.

source          on       returns via           verdict    why
2001:db8:c::10  Gi0/0/2  Gi0/0/2               forwarded  passed
2001:db8:2::99  Gi0/0/2  Gi0/0/1               DROPPED    wrong interface
2001:db8:2::10  Gi0/0/0  Gi0/0/1               forwarded  urpf off
fd00::1         Gi0/0/0  Gi0/0/0 (default)     forwarded  urpf off

What would you run to see it? The ACL support chapter's verification step is show cef interface, and its sample is an IPv6 interface:

This course's output, drawn in the layout of the ACL support chapter's IPv6 sample, without the sample's address, neighbor discovery and ICMP lines. The interface and the counts are this scenario's.

EDGE# show cef interface GigabitEthernet0/0/2
 GigabitEthernet0/0/2 is up, line protocol is up
  Input features: Verify Unicast Reverse-Path
 IPv6 verify source reachable-via rx
   0 verification drop(s) (process), 1 (CEF)
! The customer's forged IPv6 packet. Which column a drop lands in is this page's reading: a CEF-switched drop in (CEF).
   0 suppressed verification drop(s) (process), 0 (CEF)

Proves: that uRPF is an input feature on this interface, the mode (rx or any), the ACL if there is one, and how many packets failed here, dropped or suppressed.
Does not prove: which packets they were, or whether they were really forged. A counter has no source addresses in it. For those you need an ACL entry with log.

No IPv4 version of this display was read, so the IPv4 counters on this page are a derived reading, not device output. Counts on this page accumulate: the same packets arrive again at every configuration change, the way traffic keeps arriving.

So put it on the uplinks too

It worked on the customer interface. This router is multihomed, so spoofed traffic really does arrive on its uplinks. Strict goes on both.

And this is where strict starts costing you, so go in with your eyes open. A packet can be completely honest and still arrive through the wrong door, because the return path took another road. Strict mode has no way to tell that apart from an attack, and on a multihomed edge that is not a rare event.

EDGE# configure terminal
EDGE(config)# interface GigabitEthernet0/0/0
EDGE(config-if)# ip verify unicast source reachable-via rx
EDGE(config-if)# ipv6 verify unicast source reachable-via rx
EDGE(config-if)# interface GigabitEthernet0/0/1
EDGE(config-if)# ip verify unicast source reachable-via rx
EDGE(config-if)# ipv6 verify unicast source reachable-via rx
EDGE(config-if)# end

Computed from this page's model, not device output. IPv4: every packet, and what the router did with it.

source         on       returns via           verdict    why
198.51.100.10  Gi0/0/2  Gi0/0/2               forwarded  passed
192.0.2.77     Gi0/0/2  Gi0/0/1               DROPPED    wrong interface
192.0.2.10     Gi0/0/0  Gi0/0/1               DROPPED    wrong interface
198.18.7.1     Gi0/0/1  Gi0/0/0 + Gi0/0/1     forwarded  passed
10.1.1.1       Gi0/0/0  Gi0/0/0 (default)     DROPPED    only the default route
240.7.7.7      Gi0/0/0  Gi0/0/0 (default)     DROPPED    only the default route
203.0.113.5    Gi0/0/0  Null0                 DROPPED    null-routed source

And a legitimate flow disappeared. 192.0.2.0/24 is reached through ISP-B; its traffic arrives from ISP-A. The chapter saw this coming:

We recommend that you do not apply Unicast RPF where there is a chance of asymmetric routing, unless you configure access control lists (ACLs) to allow the device to accept incoming packets.

One transit source survived on purpose. 198.18.0.0/15 has two equal-cost return paths, one through each provider, and With Unicast RPF, all equal-cost “best” return paths are considered valid.

Computed from this page's model, not device output. The two mistakes a filter can make.

source          forged?  verdict    so this is
198.51.100.10   no       forwarded  correct
192.0.2.77      yes      DROPPED    correct
192.0.2.10      no       DROPPED    a legitimate flow lost
198.18.7.1      no       forwarded  correct
10.1.1.1        yes      DROPPED    correct
240.7.7.7       yes      DROPPED    correct
203.0.113.5     yes      DROPPED    correct
2001:db8:c::10  no       forwarded  correct
2001:db8:2::99  yes      DROPPED    correct
2001:db8:2::10  no       DROPPED    a legitimate flow lost
fd00::1         yes      DROPPED    correct

How would anybody notice? Not from a log: no ACL, so no ACL logging occurs. From the counter. Gi0/0/0's drop count climbs, and the chapter says what that count is for: Statistics on the number of packets that Unicast RPF drops help to identify the interface that is the entry point of the attack. Here the entry point is a partner, and 2 legitimate flows are in that count.

One requirement, removed

Loose mode removes the match requirement on the specific ingress interface, allowing Unicast RPF to loose-check packets. This mechanism is especially relevant for Internet Service Providers (ISPs), specifically on routers that have multiple links to multiple ISPs.
EDGE# configure terminal
EDGE(config)# interface GigabitEthernet0/0/0
EDGE(config-if)# ip verify unicast source reachable-via any
EDGE(config-if)# ipv6 verify unicast source reachable-via any
EDGE(config-if)# interface GigabitEthernet0/0/1
EDGE(config-if)# ip verify unicast source reachable-via any
EDGE(config-if)# ipv6 verify unicast source reachable-via any
EDGE(config-if)# end

Computed from this page's model, not device output. IPv4: every packet, and what the router did with it.

source         on       returns via           verdict    why
198.51.100.10  Gi0/0/2  Gi0/0/2               forwarded  passed
192.0.2.77     Gi0/0/2  Gi0/0/1               DROPPED    wrong interface
192.0.2.10     Gi0/0/0  Gi0/0/1               forwarded  passed
198.18.7.1     Gi0/0/1  Gi0/0/0 + Gi0/0/1     forwarded  passed
10.1.1.1       Gi0/0/0  Gi0/0/0 (default)     DROPPED    only the default route
240.7.7.7      Gi0/0/0  Gi0/0/0 (default)     DROPPED    only the default route
203.0.113.5    Gi0/0/0  Null0                 DROPPED    null-routed source

The partner is forwarded again, and the customer's forgery is still dropped on its own interface. Loose mode isn't strict mode with the safety off:

Loose mode allows Unicast RPF to automatically detect and drop packets such as the following: IETF RFC 1918 source addresses. Other Documenting Special Use Addresses (DUSA) that should not appear in the source. Unallocated addresses that have not been allocated by the Regional Internet Registries (RIRs). Source addresses that are routed to a null interface on the router.