Octet

What is AS path prepending, and what are its limits?

Show the answer

Say this first

Prepending adds extra copies of my own ASN when I advertise to a neighbor, so that path looks longer and other networks prefer a different one. It is the usual way to make one ISP the backup for inbound traffic. Limits: it only matters where AS path length is the deciding step, so it loses to anyone's local preference; past about three prepends it rarely changes more; and a long prepended path is easier to beat with a shorter fake announcement.

Go deeper

Config

Cisco IOS
ip prefix-list OUR-PREFIXES seq 5 permit 203.0.113.0/24
!
route-map ISP2-OUT permit 10
 match ip address prefix-list OUR-PREFIXES
 set as-path prepend 64500 64500
!
router bgp 64500
 neighbor 198.51.100.1 route-map ISP2-OUT out

ISP2 receives the path 64500 64500 64500: two prepends plus the normal one added on eBGP.

Verifying

show ip bgp neighbors 198.51.100.1 advertised-routes on IOS shows the route as it sits in your table, not the prepended path. Check from the outside: a looking glass in ISP2 or elsewhere, or the peer's show ip bgp 203.0.113.0.

Rules of thumb

  • Prepend only your own ASN. Someone else's ASN in your path makes that AS reject your route as a loop.
  • Start with one or two prepends and measure. Long prepend chains mostly make the table bigger.
  • Inbound prepending also exists: set as-path prepend last-as 2 on a received route makes your own router like that path less. Local preference is the cleaner tool for that.

Traps

  • Prepending on the primary link instead of the backup.
  • Expecting advertised-routes on IOS to show the prepends.
How did you do?Book 4.1 Global Internet