BGP — AS-path prepending for egress path influence
- Routing
- Intermediate
- 10 min
- 3 steps
- Cisco IOS-style
Prepend AS 65001 to the AS_PATH of 192.168.1.0/24 advertised outbound to R2, making the path artificially longer so a future second R2-side neighbour (or R2's iBGP siblings) prefer the unprepended path.
Open this lab in your browser →
Free · no install · no account
Scenario
AS-path prepending is the classic egress-engineering tool: you can't reach into your neighbour's policy, but you can make your own advertisement *look* less attractive than another exit's by prepending your AS multiple times to the AS_PATH. Best-path selection (after weight, local-pref, origin) picks the shortest AS_PATH. Prepending grows the path. Where: `` Original: AS_PATH = [65001] (length 1) Prepended: AS_PATH = [65001 65001 65001] (length 3) ` In this lab R1 (AS 65001) advertises 192.168.1.0/24 to R2 (AS 65002). You'll add an outbound route-map that prepends 65001 twice. After commit, R2's BGP table should show AS_PATH 65001 65001 65001` for the prefix.
Topology
2 × router · Cisco IOS-style
R1— routerR2— router
What you will do
On
R1, defineroute-map PREPEND-R2 permit 10withset as-path prepend 65001 65001.Bind the route-map outbound on R2:
neighbor 10.0.12.2 route-map PREPEND-R2 out.Verify on R2:
show ip bgpshould show AS_PATH65001 65001 65001for192.168.1.0/24.
Open this lab in your browser →
More labs on this topic
- Syntax delta — static route (Extreme EXOS)Beginner · 4 min
- Syntax delta — static route (Cisco IOS)Beginner · 4 min
- Syntax delta — static route (Juniper Junos)Beginner · 5 min
- Syntax delta — static route (VyOS)Beginner · 5 min
- Static routes — fix hub-and-spokeBeginner · 12 min
- Static routes — egress-interface form (point-to-point)Beginner · 8 min
This lab in other languages
BGP — AS-Path-Prepending zur Beeinflussung des Egress-PfadsBGP — AS-path prepending para influir en la ruta de salidaBGP — AS-path prepending para influenciar o caminho de saídaBGP — AS-path prepending pour influencer le chemin de sortieBGP — egress path influence के लिए AS-path prependingBGP — 通过 AS-path prepend 影响出方向路径BGP — AS-path prepending per influenzare il percorso egressBGP — AS-path prepend によるエグレスパス影響BGP — egress 경로 영향용 AS-path prependingBGP — AS-path prepending для влияния на egress-путьBGP — egress yolunu etkilemek için AS-path prependingBGP — AS-path prepending để ảnh hưởng đường đi egress