<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/use-as-path-prepending-to-influence-incoming-traffic-flow-bgp-labs-q9ekg6su8" -->

---
title: Use AS-Path Prepending to Influence Incoming Traffic...
description: A hands-on BGP lab exercise demonstrating AS-path prepending to influence incoming traffic flow when connected to multiple upstream autonomous systems. The lab...
canonical: https://daily.dev/posts/use-as-path-prepending-to-influence-incoming-traffic-flow-bgp-labs-q9ekg6su8
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Use AS-Path Prepending to Influence Incoming Traffic Flow « BGP Labs | daily.dev
og:description: A hands-on BGP lab exercise demonstrating AS-path prepending to influence incoming traffic flow when connected to multiple upstream autonomous systems. The lab...
og:url: https://daily.dev/posts/use-as-path-prepending-to-influence-incoming-traffic-flow-bgp-labs-q9ekg6su8
og:image: https://api.daily.dev/og/posts/Q9eKG6Su8.png
og:image:alt: Use AS-Path Prepending to Influence Incoming Traffic Flow « BGP Labs
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Use AS-Path Prepending to Influence Incoming Traffic Flow « BGP Labs

**[ipSpace.net Blog](https://daily.dev/sources/ipspace)** · 6 min read · 0 upvotes · 0 comments

## Summary

A hands-on BGP lab exercise demonstrating AS-path prepending to influence incoming traffic flow when connected to multiple upstream autonomous systems. The lab walks through configuring a route map with AS-path prepending on outgoing BGP updates sent to a second upstream provider (X2), so that X2 prefers the transit path through X1 rather than the direct EBGP link. Includes BGP table verification using FRRouting commands, warnings about prepending only your own AS number, and validation steps using netlab.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.ipspace.net/2023/11/bgp-labs-as-path-prepending>

## Questions this post answers

### How do I use AS-path prepending to make an upstream provider prefer a transit path over a direct EBGP link?

Configure a route map that prepends your own AS number multiple times to outgoing BGP updates sent to the upstream peer you want to deprioritize. If the competing path has two AS numbers, prepend your AS at least twice so the direct path becomes longer than the transit path. Apply the route map as an outbound policy on the relevant BGP neighbor, then use 'clear ip bgp * soft out' to trigger resending of updates.

_Network engineers tuning BGP multihoming policies track lab exercises and real-world configs on daily.dev._

### Why should I only prepend my own AS number and not someone else's AS number in BGP?

Prepending AS numbers other than your own can cause routing policy violations and potentially disrupt routing for the AS whose number you insert. BGP AS-path prepending is intended to artificially lengthen your own AS's path to influence route selection, and inserting foreign AS numbers is considered a misconfiguration that can have unintended network-wide consequences.

_Staying current on BGP best practices and common misconfigurations is easier when daily.dev surfaces the right networking content for you._

## Similar posts on daily.dev

- [Enforcing the First AS in BGP AS\_PATHs](https://daily.dev/posts/enforcing-the-first-as-in-bgp-as-paths-yx1xiadkj) · Cloudflare · 0 upvotes · 0 comments
- [ASPA: making Internet routing more secure](https://daily.dev/posts/aspa-making-internet-routing-more-secure-r19ceuyg1) · Cloudflare · 0 upvotes · 0 comments
- [BGP ORIGIN attribute manipulation and its impact on the Internet](https://daily.dev/posts/bgp-origin-attribute-manipulation-and-its-impact-on-the-internet-fpdysqlcf) · Cloudflare · 2 upvotes · 0 comments

---

Tags: [#bgp](https://daily.dev/tags/bgp)

[View this post on daily.dev](https://daily.dev/posts/use-as-path-prepending-to-influence-incoming-traffic-flow-bgp-labs-q9ekg6su8)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Use AS-Path Prepending to Influence Incoming Traffic Flow « BGP Labs","url":"https://daily.dev/posts/use-as-path-prepending-to-influence-incoming-traffic-flow-bgp-labs-q9ekg6su8","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/use-as-path-prepending-to-influence-incoming-traffic-flow-bgp-labs-q9ekg6su8"},"datePublished":"2026-08-11T08:55:29.380Z","dateModified":"2026-08-11T09:06:14.527Z","description":"A hands-on BGP lab exercise demonstrating AS-path prepending to influence incoming traffic flow when connected to multiple upstream autonomous systems. The lab...","image":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","thumbnailUrl":"https://media.daily.dev/image/upload/s--ZrL_HSsR--/f_auto/v1722860399/public/Placeholder%2006","isAccessibleForFree":true,"articleSection":"ipSpace.net Blog","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"ipSpace.net Blog","logo":"https://media.daily.dev/image/upload/s--xS7E82MT--/f_auto,q_auto/v1786438303/logos/ipspace?_a=BAMAMicg0","url":"https://daily.dev/sources/ipspace"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/use-as-path-prepending-to-influence-incoming-traffic-flow-bgp-labs-q9ekg6su8","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"bgp","timeRequired":"PT6M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"ipSpace.net Blog","item":"https://daily.dev/sources/ipspace"},{"@type":"ListItem","position":3,"name":"Use AS-Path Prepending to Influence Incoming Traffic Flow « BGP Labs"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/use-as-path-prepending-to-influence-incoming-traffic-flow-bgp-labs-q9ekg6su8#faq","mainEntity":[{"@type":"Question","name":"How do I use AS-path prepending to make an upstream provider prefer a transit path over a direct EBGP link?","acceptedAnswer":{"@type":"Answer","text":"Configure a route map that prepends your own AS number multiple times to outgoing BGP updates sent to the upstream peer you want to deprioritize. If the competing path has two AS numbers, prepend your AS at least twice so the direct path becomes longer than the transit path. Apply the route map as an outbound policy on the relevant BGP neighbor, then use 'clear ip bgp * soft out' to trigger resending of updates. Network engineers tuning BGP multihoming policies track lab exercises and real-world configs on daily.dev."}},{"@type":"Question","name":"Why should I only prepend my own AS number and not someone else's AS number in BGP?","acceptedAnswer":{"@type":"Answer","text":"Prepending AS numbers other than your own can cause routing policy violations and potentially disrupt routing for the AS whose number you insert. BGP AS-path prepending is intended to artificially lengthen your own AS's path to influence route selection, and inserting foreign AS numbers is considered a misconfiguration that can have unintended network-wide consequences. Staying current on BGP best practices and common misconfigurations is easier when daily.dev surfaces the right networking content for you."}}]}
```

