Learn how BGP Local Preference works in the path selection process. This step-by-step guide explains its role, configuration, and real-world examples to influence outbound traffic routing.
In the previous blog, we explored the first BGP path selection attribute — Weight. Now, it’s time to move on to the second attribute in the decision process: Local Preference.
When working with BGP (Border Gateway Protocol), one of the key challenges is determining which path your network should take when multiple routes exist to the same destination. Unlike protocols such as OSPF or EIGRP that rely on metrics like cost or hop count, BGP makes its decisions using a series of attributes. Among these, Local Preference (LOCAL_PREF) is one of the most powerful and widely used.
In this guide, we’ll explain what Local Preference is, why it matters, and how it works. We’ll also walk through a practical example so that by the end, you’ll not only understand the concept but also know how to apply it effectively to control outbound traffic in your network.
What is Local Preference in BGP?
Local Preference (often shortened to Local Pref) is a BGP attribute used inside an Autonomous System (AS) to tell routers which path they should prefer when sending traffic out of the AS.
Think of it this way:
- Imagine your office has two exits to the main road.
- One exit leads to a smooth highway, while the other leads to a bumpy road.
- Local Preference is like putting a sign in the office lobby that says:
“Always use Exit A (highway) unless it’s closed. Exit B is the backup.”
That’s exactly how Local Preference works. It’s a priority system: the higher the value, the more preferred that route is.
Key Characteristics of Local Preference
Here are some important things to remember:
- Local to an AS
- Local Preference values are shared only within your AS.
- They are not advertised to other ASes, so only your routers will see them.
- Higher Wins
- Among multiple available routes, the one with the highest Local Preference is always chosen as the outbound path.
- Default Value
- If you don’t configure anything, most routers set Local Preference to 100.
Why Do We Use Local Preference?
The main reason is outbound traffic engineering — controlling how your network exits to the outside world.
Picture this scenario:
- Your AS is connected to two Internet Service Providers (ISP1 and ISP2).
- Both ISPs advertise routes to the same external destinations.
Without Local Preference, your routers may rely on other attributes like AS Path length, which can lead to unpredictable choices.
But with Local Preference, you gain control:
- Want ISP1 to be the primary exit? Give its routes a higher Local Preference.
- Want ISP2 to act as a backup? Leave its routes at the default (lower) value.
This way, your outbound traffic follows a clear and predictable pattern.
Example: How Local Preference Works
Let’s walk through a simple setup.
Your network (AS 65000) has two border routers:
- R1 → ISP1
- R2 → ISP2
Both ISPs advertise the same prefix: 8.8.8.8/32 (Google DNS).
Case 1: No Local Preference Set
- R1 and R2 both see the route with Local Preference = 100.
- Since they tie, the routers move on to the next BGP attribute (like AS Path or MED) to decide.
Case 2: Setting Local Preference
- On R1 (routes from ISP1), configure Local Preference = 200.
- On R2 (routes from ISP2), leave it at the default = 100.
- Result: Every router in AS 65000 prefers the path through ISP1 to reach 8.8.8.8.
So, effectively, you’ve told your AS:
“Use ISP1 unless it goes down. Then switch to ISP2.”
In the next example, we’ll simplify things by using a single ISP (AS 200). This scenario will help us quickly walk through the configuration and make the concept easier to understand and remember.
Example:

Understanding the Topology
In the diagram below, we have two Autonomous Systems (AS):
- AS 100 contains Router R1.
- AS 200 contains Routers R2, R3, and R4.
Connectivity Overview
- R1 (AS 100) establishes eBGP sessions with R2 and R3 (AS 200).
- Within AS 200, R2, R3, and R4 run iBGP sessions among themselves.
IP Addressing
The IP subnets used between the routers are clearly labeled in the diagram:
- R1 ↔ R2: 12.1.1.0/24
- R1 ↔ R3: 13.1.1.0/24
- R2 ↔ R4: 24.1.1.0/24
- R3 ↔ R4: 34.1.1.0/24
Additionally, R1 is advertising its loopback 1.1.1.1/32 into BGP. Configuration –
conf t
interface g1/0
no shutdown
ip address 12.1.1.1 255.255.255.0
interface g2/0
no shutdown
ip address 13.1.1.1 255.255.255.0
interface loopback 0
ip address 1.1.1.1 255.255.255.255
router bgp 100
neighbor 12.1.1.2 remote-as 200
neighbor 13.1.1.3 remote-as 200
network 1.1.1.1 mask 255.255.255.255
redistribute connected
conf t
interface g1/0
no shutdown
ip address 12.1.1.2 255.255.255.0
interface g2/0
no shutdown
ip address 24.1.1.2 255.255.255.0
router bgp 200
neighbor 12.1.1.1 remote-as 100
neighbor 24.1.1.4 remote-as 200
neighbor 24.1.1.4 next-hop-self
redistribute connected
conf t
interface g1/0
no shutdown
ip address 34.1.1.3 255.255.255.0
interface g2/0
no shutdown
ip address 13.1.1.3 255.255.255.0
router bgp 200
neighbor 34.1.1.4 remote-as 200
neighbor 13.1.1.1 remote-as 100
neighbor 34.1.1.4 next-hop-self
redistribute connected
conf t
interface g1/0
no shutdown
ip address 34.1.1.4 255.255.255.0
interface g2/0
no shutdown
ip address 24.1.1.4 255.255.255.0
router bgp 200
neighbor 24.1.1.2 remote-as 200
neighbor 34.1.1.3 remote-as 200
Verifying the Setup
Once the configuration was completed, we confirmed that both eBGP and iBGP sessions were successfully established. Router R1 is now advertising its loopback address 1.1.1.1/32 to both eBGP peers (R2 and R3).


Our Objective
The goal here is to influence the outbound traffic flow using the BGP Local Preference attribute.
From the perspective of Router R4, there are two possible paths to reach the prefix 1.1.1.1:
- One path via R2
- Another path via R3
When we initially checked the BGP table on R4, we observed that—by default—the best path to 1.1.1.1 was selected through R2.

In the snapshot below, you can see that the Local Preference value is set to 100, which is the default. This means that when R2 and R3 receive the prefix 1.1.1.1 from R1, they automatically assign it the default Local Preference of 100. Afterwards, both routers advertise this prefix to their iBGP peer, R4.


Changing the Outbound Path with Local Preference
Our objective is to make R4 prefer the path through R3 when reaching the prefix 1.1.1.1.
To accomplish this, we configure a higher Local Preference on R3.
Configuration Approach
- On R3, we first create a prefix list to match the advertised network (1.1.1.1/32).
- Next, we define a route-map where we set the Local Preference to a higher value.
- Finally, this route-map is applied inbound on the eBGP session with R1.
Why “Inbound” Direction?
This is where many engineers get confused. If our goal is to influence outbound traffic, why do we apply the Local Preference in the inbound direction on R3’s session with R1?
Here’s the logic:
- R1 advertises the prefix 1.1.1.1 to both R2 and R3.
- When R2 and R3 receive this prefix, they apply their Local Preference values immediately (default is 100, unless modified).
- Since we configured a higher Local Preference on R3, it will advertise the prefix to its iBGP peer R4 with this higher value.
- Remember, Local Preference is propagated within the AS. This means R4 learns that the path via R3 has a higher Local Preference compared to the one via R2.
From R4’s perspective, this results in choosing the R3 path as the preferred outbound route to reach 1.1.1.1.
(Refer to the snapshot below to see the configuration steps and verification.)


In the snapshot below, you can see that the Local Preference value has been updated from the default 100 to 150 on R2 and 200 on R3. Since the higher value is always preferred, the path through R3 (Local Preference 200) is selected as the best route.


Real-Life Use Cases
- Primary/Backup ISP Setup
- Use one ISP as the main connection and the other as a backup.
- Load Sharing
- Assign higher Local Preference for certain prefixes to ISP1, and for others to ISP2.
- Example: send cloud traffic to ISP1 and streaming traffic to ISP2.
- Traffic Engineering for Cost Control
- If one ISP charges less, you can direct most traffic there by setting higher Local Preference.
Summary
BGP Local Preference is one of the most important tools for controlling outbound traffic. By assigning higher values to preferred routes, you ensure that traffic exits your AS through the link you want.
To summarize:
- Higher value = higher priority.
- Works only within an AS.
- Default is 100.
Think of Local Preference as a traffic director inside your AS, pointing routers to the best exit door. With it, you gain stability, predictability, and control over your outbound routing decisions.