Understanding BGP AS_PATH, Split Horizon, and Route Reflectors

BGP Path Attributes – AS_PATH, Split Horizon, and Route Reflector

One of the key features that makes BGP different from other routing protocols is its use of path attributes. These attributes are attached to BGP route advertisements and provide important information that routers use to make decisions – not just for best path selection, but also for routing policies, loop prevention, and more.


What Are Path Attributes?

In BGP, every route that is advertised carries a set of values called path attributes. These attributes describe specific properties of the route, and BGP uses them for:

  • Selecting the best path among multiple options
  • Preventing routing loops
  • Tagging or grouping networks
  • Defining the next-hop router
  • Controlling how routes are propagated

This is different from protocols like OSPF, EIGRP, or RIP, where decisions are typically based on a single metric (like hop count, bandwidth, or delay). Since BGP uses multiple attributes for different functions, the term “path attribute” is used instead of just “metric.”


AS_PATH Attribute

One of the most important and commonly used path attributes in BGP is the AS_PATH attribute.

This attribute lists the Autonomous Systems (AS) that a route has passed through. Each time a route is advertised from one AS to another (in an eBGP session), the router prepends its own AS number to the beginning of the AS_PATH.

Diagram showing three routers: R1 in AS100, R2 in AS200, and R3 in AS300. R1 advertises network 10.0.0.0/24 to R2 with AS_PATH 100. R2 forwards it to R3, updating the AS_PATH to 200 100.
BGP AS_PATH formation across eBGP peers: AS100 → AS200 → AS300

In the above figure, we have three routers:

  • R1 belongs to AS100
  • R2 belongs to AS200
  • R3 belongs to AS300

Let’s say R1 is originating a route for the network 10.0.0.0/8. When R1 advertises this route to R2 over an eBGP session, it includes its own AS number in the update. So the AS_PATH becomes 100.

Now, when R2 receives this update and advertises it further to R3 (again over eBGP), it prepends its own AS to the beginning of the AS_PATH. So the AS_PATH becomes 200 100.

This way, every time a BGP update crosses an AS boundary, the sending router adds its AS number to the path. The receiving router can clearly see how the route has travelled, and use this information for best path selection or loop prevention


How AS_PATH Is Used

1. Shortest Path Selection

If a router receives multiple paths to reach the same destination, BGP uses the AS_PATH length as one of the first criteria in its best path selection process.

The path with the shortest AS_PATH (i.e., the fewest AS numbers) is generally preferred.

2. Loop Prevention

AS_PATH also helps BGP avoid routing loops.

When a router receives a BGP update, it checks whether its own AS number is already present in the AS_PATH. If it is, the route is discarded – because that means the route has looped back to the same AS.

This loop prevention works well across different autonomous systems (eBGP).


AS_PATH in iBGP

Within the same AS, routers may form iBGP sessions to share BGP routes internally.

In iBGP, the AS_PATH is not updated. That means when one iBGP peer advertises a route to another, it does not add its AS number to the AS_PATH – because both routers belong to the same AS.

This behavior avoids unnecessarily growing the AS_PATH, but it also introduces a new challenge: loop detection inside the AS becomes impossible using AS_PATH alone.


Split Horizon Rule in iBGP

To avoid potential loops inside an AS, BGP enforces the split horizon rule for iBGP:

A router must not advertise a route learned from one iBGP peer to another iBGP peer.

This prevents the same route from bouncing around endlessly between routers inside the AS.

But it also creates a limitation – routes learned through iBGP don’t get forwarded to other routers automatically like they do in protocols such as OSPF or EIGRP.


Full Mesh Requirement in iBGP

Because of the split horizon rule, every BGP router in the AS must form a direct iBGP session with every other BGP router, so that all routes are properly shared.

This is called full mesh iBGP.
It works fine in small networks, but as the number of routers increases, it becomes difficult to scale.

For n routers, the number of iBGP sessions required is:

n(n – 1)/2

Clearly, this doesn’t scale well.


Route Reflector – A Scalable Solution

To avoid the complexity of full mesh iBGP, BGP offers a feature called the Route Reflector (RR).

A Route Reflector is a router that can:

  • Receive routes from iBGP peers (called clients)
  • Forward those routes to other iBGP clients

This bypasses the split horizon rule – but only for the Route Reflector.

Instead of every router peering with every other router, all clients just peer with the RR. The RR then handles the distribution of routes.

Note: Route Reflectors are not elected automatically. They must be manually configured by the network administrator. This is different from protocols like OSPF where DR/BDR elections happen automatically.


Recap

  • Path attributes carry extra information with BGP routes – used for decision-making, policies, and loop prevention.
  • AS_PATH lists the AS numbers a route has passed through and is used for:
    • Choosing the shortest AS path
    • Avoiding loops in eBGP
  • iBGP does not update AS_PATH, so BGP uses split horizon to prevent loops.
  • Split horizon creates the need for full mesh iBGP.
  • To avoid full mesh, BGP allows the use of Route Reflectors, which simplify iBGP design by redistributing routes to clients.


We’d love to hear your feedback and suggestions about this article. Feel free to reach out to us using the WhatsApp number below.

Sajith Achipra has been a trainer and testing consultant at Zframez Technologies since 2009. With 15+ years of experience, he specializes in networking, Python, development, and testing. He conducts online courses to help students and professionals enhance their skills. You can reach him on WhatsApp at +91 8884 884 844 for your training and testing requirements.