Free — no signup required

BGP Attribute: Local Preference (Local Pref)

2 min read

"My Network, My Exit Rules"

Local Preference controls how traffic leaves your Autonomous System. It is a value assigned by network engineers to incoming route advertisements, telling all routers inside the AS which exit path to prefer for outbound traffic.

The Rule: Higher Local Preference Wins.

Consider an ISP with two upstream transit providers: a cheap commodity provider and an expensive premium provider with better latency guarantees.

Route to 0.0.0.0/0 via Cheap Provider  → Local Pref = 200
Route to 0.0.0.0/0 via Premium Provider → Local Pref = 100

Every iBGP router inside the ISP sees both options and picks the one with Local Pref 200 — the cheap provider — for all outbound traffic by default. If the cheap provider goes down, the route disappears and traffic automatically fails over to the premium provider (Local Pref 100).

This is how ISPs implement traffic engineering policies without manually configuring every router. The policy is encoded in the Local Pref value and distributed automatically via iBGP.

Critical scoping rule: Local Preference is only exchanged between routers within the same AS (iBGP). It is stripped from route advertisements before they are sent to external peers (eBGP). Your neighbors never see your Local Pref values — it's an internal implementation detail.

Interview Tip

A common interview question: "How do you control which upstream provider carries your outbound traffic?" The answer is Local Preference. Set a higher Local Pref on routes learned from your preferred provider. Follow-up: "What about inbound traffic?" That's where AS-Path prepending and MED come in — Local Pref has no effect on how external networks route traffic to you.

Key Point: Local Preference is the primary tool for controlling egress traffic. It is internal to an AS and invisible to external peers.

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free