BGP Path Manipulation Using Local Preference and MED – Complete CCNP Guide

BGP Path Manipulation Using Local Preference and MED – Complete CCNP Guide
Networking ATN Campus November 17, 2026 27 views

BGP Path Manipulation Using Local Preference and MED – Complete CCNP Guide

In enterprise networking, a company may connect to multiple Internet Service Providers (ISPs) to improve redundancy, availability, and network performance. However, having multiple BGP connections does not automatically mean that traffic will use the preferred ISP.

BGP Path Manipulation allows network administrators to influence how BGP selects routes and chooses paths to reach external networks.

Two important BGP attributes used for path manipulation are Local Preference and Multi-Exit Discriminator (MED).

In this CCNP guide, you will learn how Local Preference and MED work, understand their differences, and configure both attributes using practical Cisco IOS examples.

1. What Is BGP Path Manipulation?

BGP Path Manipulation is the process of influencing BGP route selection by modifying path attributes.

When a BGP router receives multiple routes to the same destination, it evaluates different attributes to select its best path.

Common BGP path attributes include:

  • Weight
  • Local Preference
  • AS_PATH
  • Origin
  • MED
  • Next-Hop

Administrators can modify selected attributes to influence outbound or inbound traffic paths.

2. What Is Local Preference?

Local Preference (LOCAL_PREF) is a BGP path attribute used within an Autonomous System (AS) to influence which exit path routers prefer when sending traffic to external networks.

The basic rule is:

  • Higher Local Preference = More preferred path.
  • Lower Local Preference = Less preferred path.

The default Local Preference value on Cisco IOS is 100 when the attribute is not otherwise set for a locally considered path.

Local Preference is distributed to other routers through iBGP within the AS. It is not normally sent to eBGP neighbors.

3. Understanding Local Preference with an Example

Imagine an enterprise network connected to two ISPs.

                  ISP 1
                 AS 65002
                    |
                    |
               +---------+
               |         |
               |   R1    |
               | AS65001 |
               |         |
               +---------+
                    |
                    |
                  ISP 2
                 AS 65003

             Enterprise Network
                192.168.10.0/24

Suppose both ISPs advertise the same destination prefix to the enterprise network.

The enterprise wants to use ISP 1 as its preferred outbound path and ISP 2 as a backup path.

We can achieve this by assigning a higher Local Preference to routes learned from ISP 1.

ISPLocal PreferenceResult
ISP 1200Preferred path
ISP 2100Backup candidate

4. Configure Local Preference Using a Route Map

Let's configure a practical example using three routers:

                ISP 1
               AS 65002
             203.0.113.2/30
                   |
                   |
             203.0.113.1/30
                +------+
                |  R1  |
                |65001 |
                +------+
             203.0.113.5/30
                   |
                   |
             203.0.113.6/30
                ISP 2
               AS 65003

       Destination advertised by both ISPs:
                198.51.100.0/24

In this example, R1 is connected to two different ISPs. Both ISPs advertise 198.51.100.0/24. R1 should prefer ISP 1 for outbound traffic.

Step 1: Configure R1 Interfaces

enable
configure terminal

interface GigabitEthernet0/0
 description Connection-to-ISP1
 ip address 203.0.113.1 255.255.255.252
 no shutdown
exit

interface GigabitEthernet0/1
 description Connection-to-ISP2
 ip address 203.0.113.5 255.255.255.252
 no shutdown
exit

Step 2: Configure ISP 1

interface GigabitEthernet0/0
 ip address 203.0.113.2 255.255.255.252
 no shutdown
exit

interface Loopback0
 ip address 198.51.100.1 255.255.255.0
exit

router bgp 65002
 neighbor 203.0.113.1 remote-as 65001
 network 198.51.100.0 mask 255.255.255.0

Step 3: Configure ISP 2

interface GigabitEthernet0/0
 ip address 203.0.113.6 255.255.255.252
 no shutdown
exit

interface Loopback0
 ip address 198.51.100.1 255.255.255.0
exit

router bgp 65003
 neighbor 203.0.113.5 remote-as 65001
 network 198.51.100.0 mask 255.255.255.0

The two ISP routers are separate simulated networks. In a physical deployment, the destination prefix would represent a network reachable through both providers. Each ISP must have the advertised prefix in its own routing table before using the BGP network statement.

Step 4: Configure BGP on R1

router bgp 65001
 neighbor 203.0.113.2 remote-as 65002
 neighbor 203.0.113.6 remote-as 65003

Step 5: Configure Local Preference for ISP 1

Create a route map that sets Local Preference to 200 for routes received from ISP 1.

route-map ISP1-PREFERENCE permit 10
 set local-preference 200

router bgp 65001
 neighbor 203.0.113.2 route-map ISP1-PREFERENCE in

R1 assigns Local Preference 200 to routes received from ISP 1. Routes received from ISP 2 retain the default Local Preference of 100 in this example.

After applying the inbound policy, refresh the routes:

clear ip bgp 203.0.113.2 soft in

R1 should now prefer ISP 1 for the destination prefix, assuming no higher-priority BGP selection attribute or other routing-policy condition changes the result.

5. What Is MED?

Multi-Exit Discriminator (MED) is an optional non-transitive BGP attribute used to suggest a preferred entry point into an Autonomous System when another AS has multiple connections to it.

Unlike Local Preference, MED is generally used to influence how a neighboring AS chooses between multiple paths into the AS advertising the MED.

The basic rule is:

  • Lower MED = More preferred path.
  • Higher MED = Less preferred path.

For example, if an enterprise connects to the same ISP through two different links, it can advertise different MED values to suggest which link the ISP should prefer for traffic entering the enterprise.

6. Understanding MED with an Example

             ISP AS 65002
              /       \
             /         \
            /           \
       Link 1           Link 2
          |                |
          |                |
       +------+         +------+
       | R1   |---------| R2   |
       |      |         |      |
       +------+         +------+
              Enterprise AS 65001

       Enterprise advertises:
             192.168.10.0/24

Assume R1 and R2 are two enterprise edge routers connected to the same ISP AS. The enterprise wants the ISP to prefer Link 1 when sending traffic to 192.168.10.0/24.

Example MED values:

LinkMEDExpected Preference
Link 150Preferred
Link 2200Less preferred

Because lower MED is preferred, the ISP may choose Link 1 when comparing eligible routes.

Important: MED is a suggestion, not a command. The receiving AS controls its own routing policy and may ignore MED or compare it under different configuration rules.

7. Configure MED Using a Route Map

For this configuration, assume R1 and R2 belong to enterprise AS 65001 and connect to the same ISP AS 65002.

Example interface addressing:

  • R1 to ISP: 203.0.113.1/30 and 203.0.113.2/30.
  • R2 to ISP: 203.0.113.5/30 and 203.0.113.6/30.

Assume the enterprise routers already have the required internal routing and iBGP configuration to exchange the enterprise prefix and its BGP attributes.

Step 1: Configure MED on R1

R1 should advertise the enterprise prefix with MED 50.

route-map SET-MED-LOW permit 10
 set metric 50

router bgp 65001
 neighbor 203.0.113.2 remote-as 65002
 neighbor 203.0.113.2 route-map SET-MED-LOW out

Step 2: Configure MED on R2

R2 should advertise the same enterprise prefix with MED 200.

route-map SET-MED-HIGH permit 10
 set metric 200

router bgp 65001
 neighbor 203.0.113.6 remote-as 65002
 neighbor 203.0.113.6 route-map SET-MED-HIGH out

These policies attach different MED values to the advertised routes. The ISP can compare them when its BGP policy permits MED comparison.

8. Local Preference vs MED

Local Preference and MED are both BGP path attributes, but they influence different traffic directions and are used by different autonomous systems.

FeatureLocal PreferenceMED
Full NameLocal PreferenceMulti-Exit Discriminator
PurposeInfluences preferred exit pathSuggests preferred entry path
Preferred ValueHigher is betterLower is better
ScopeWithin an AS through iBGPAdvertised to neighboring AS
Attribute TypeWell-known discretionaryOptional non-transitive
Typical UseOutbound traffic engineeringInbound traffic engineering suggestion

9. Understanding Outbound and Inbound Traffic Engineering

It is important to understand the difference between controlling outgoing traffic and influencing incoming traffic.

Outbound Traffic Engineering

Outbound traffic engineering controls how your network sends traffic to external destinations.

Common methods include:

  • Local Preference
  • Weight (Cisco-specific)
  • AS_PATH manipulation in some routing designs

For example, setting Local Preference to 200 for ISP 1 can make your AS prefer ISP 1 when sending traffic to destinations reachable through both providers.

Inbound Traffic Engineering

Inbound traffic engineering attempts to influence how external networks send traffic into your network.

Common techniques include:

  • MED
  • AS_PATH Prepending
  • More-specific prefix advertisements

For example, advertising a lower MED on one link can suggest that a neighboring AS use that link to reach your network.

However, the neighboring AS may apply its own Local Preference, Weight, or other policies before considering MED.

10. Understanding MED Comparison Rules

MED comparison is not always performed between every possible BGP path.

By default, Cisco BGP commonly compares MED values between paths received from the same neighboring AS. The bgp always-compare-med command can change this behavior, but it should be used only when the network design and administrative policy support consistent MED interpretation.

Example:

router bgp 65002
 bgp always-compare-med

This command enables MED comparison across paths from different neighboring autonomous systems. Use it carefully because different ASes may assign MED values using different policies.

11. Verify Local Preference and MED

Use these commands to inspect BGP paths and attributes.

show ip bgp
show ip bgp 198.51.100.0
show ip bgp summary
show ip route bgp
show route-map
show ip protocols

In the BGP table, look for:

  • LocPrf: Displays the Local Preference value.
  • Metric: Displays the MED value.
  • Next Hop: Shows the next-hop address.
  • Best Path: The path marked with > is the selected best path.

Remember that the BGP table may display different values depending on whether the route is locally originated, received through eBGP, or learned through iBGP.

12. Common Troubleshooting Scenarios

ProblemPossible CauseSolution
ISP 2 is still preferredLocal Preference policy is not applied or another selection attribute takes precedenceCheck route-map attachment and BGP path attributes
MED does not influence ISP selectionISP ignores MED or does not compare the pathsCheck the receiving AS policy and MED comparison rules
Local Preference is not visible as expectedRoute was not processed with the intended inbound policyVerify route-map and refresh routes
MED value is missingNo MED was set or advertised for that pathCheck route-map configuration and advertised routes
Traffic uses an unexpected ISPOther BGP attributes or local routing policy influence selectionInspect the complete BGP best-path decision

13. Best Practices for BGP Path Manipulation

  • Use Local Preference to define preferred outbound paths within your AS.
  • Use MED to suggest a preferred inbound entry point to a neighboring AS.
  • Document routing policies before changing production BGP configurations.
  • Use route maps carefully and verify their direction.
  • Do not assume that an external ISP will follow your MED settings.
  • Monitor BGP routing changes after applying policies.
  • Test changes in a lab before applying them to production networks.

14. Frequently Asked Questions

1. What is Local Preference in BGP?

Local Preference is a BGP attribute used within an autonomous system to select a preferred exit path. A higher value is preferred.

2. What is MED in BGP?

MED is an optional non-transitive BGP attribute used to suggest which entry point a neighboring autonomous system should use to reach an advertised network. A lower value is preferred when the paths are compared.

3. What is the default Local Preference value?

On Cisco IOS, the default Local Preference value is generally 100 when no other policy changes it.

4. Which is better for outbound traffic engineering: Local Preference or MED?

Local Preference is commonly used for outbound traffic engineering because it influences path selection within your own autonomous system.

5. Can MED force another ISP to use a specific link?

No. MED is a suggestion. The neighboring ISP controls its own BGP policies and may ignore or override the advertised MED.

6. What is the difference between Local Preference and Weight?

Both influence outbound path selection. Weight is Cisco-specific and local to a router, while Local Preference is exchanged within an AS through iBGP.

15. Practical CCNP Lab Challenge

Build an enterprise network connected to two ISPs and complete the following tasks:

  1. Configure eBGP between the enterprise and both ISP routers.
  2. Advertise the same destination prefix from both ISPs.
  3. Configure Local Preference 200 for ISP 1.
  4. Verify that the enterprise router prefers ISP 1 for the destination.
  5. Build a second scenario with two enterprise edge routers connected to the same ISP AS.
  6. Advertise the same enterprise prefix with MED 50 on one link and MED 200 on the other.
  7. Inspect the MED values received by the ISP.
  8. Test how MED comparison changes when the paths come from different neighboring ASes.
  9. Record the selected BGP best path after each configuration change.

Conclusion

BGP Path Manipulation is essential for controlling traffic flow in networks connected to multiple service providers. Local Preference helps an autonomous system choose its preferred outbound path, while MED allows an autonomous system to suggest a preferred inbound entry point to a neighboring network.

Understanding these attributes, their differences, and their configuration using route maps is an important step toward mastering advanced BGP routing for CCNP-level networking.

???? Advance Your Networking Career with ATN Campus

Want to master BGP, advanced routing, and enterprise network engineering? Visit ATN Campus and develop practical networking skills through structured learning and hands-on labs.

???? Learn Networking.
???? Master Advanced Routing & Switching.
???? Practice with Real Labs.
???? Prepare for CCNP Certifications.
???? Build Your IT Career with ATN Campus.
Document ATN CAMPUS