In the previous lesson, locally originated routes and the shortest AS-PATH settled the choice. When those tie too, BGP reads the Origin code.
After Weight, Local Preference, locally originated routes, and AS-PATH length, BGP evaluates the next attribute:
Lowest Origin code wins.
The Origin attribute tells BGP how a prefix entered the BGP table in the first place. When all higher attributes are equal, Origin becomes the tiebreaker.
What is Origin?
Origin is a well-known mandatory attribute carried in every BGP update.
It can take only three values:
Figure 1 – BGP Origin Types
IGP (i) — The prefix was injected into BGP using a network statement.
EGP (e) — The prefix came from the legacy EGP protocol. You will almost never see this in production.
Incomplete (?) — The prefix was injected through redistribution from another protocol (OSPF, EIGRP, static, connected).
When BGP compares two paths with the same Weight, Local Preference, Originate, and AS-PATH, it picks the one with the lowest Origin code:
R1# show bgp ipv4 unicast BGP table version is 5, local router ID is 10.0.23.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.0.34.0/30 10.0.23.2 0 0 300 i * i 10.0.34.0/30 10.0.24.2 0 100 0 300 ?IGP (i) is preferred over EGP (e), which is preferred over Incomplete (?).
You read the Origin in the last column of the BGP table, right after the AS-PATH.Answer the question below
A prefix injected into BGP with the redistribute command has which Origin code?
The Scenario
The topology below reuses the same setup as the AS-PATH lesson, with one critical difference in how each side advertises the prefix 10.0.34.0/30.

Figure 2 – Two paths with different Origin types
R3 advertises the prefix toward R1 using a
networkstatement, so the prefix arrives with Origin i.
R4 advertises the same prefix toward R2 usingredistribute connected, so the prefix arrives with Origin ?.From R1's point of view, both paths share:
Equal Weight (
0)Equal Local Preference (
100)Equal AS-PATH (
300, length 1)
The only attribute that differs is the Origin.
Verifying the Result
Check the BGP table on R1:
R1# show bgp ipv4 unicast BGP table version is 5, local router ID is 10.0.23.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.0.34.0/30 10.0.23.2 0 0 300 i * i 10.0.34.0/30 10.0.24.2 0 100 0 300 ?Two paths exist for 10.0.34.0/30:
The eBGP path via R3 carries Origin i (IGP)
The iBGP path via R2 carries Origin ? (Incomplete)
The best-path marker
*>is on the path with Origin i, because IGP is preferred over Incomplete when every higher attribute is equal.
Figure 3 – Lowest Origin wins
R1 forwards traffic for 10.0.34.0/30 through Link 1.
In real-world networks, the Origin tiebreaker rarely fires on its own.
By the time BGP reaches Origin, Weight, Local Preference, and AS-PATH have usually already picked a winner.
But on the CCNP ENCOR exam, you must know the order of preference.Answer the question below
Which Origin value is preferred: i, e, or ?
After Origin, BGP evaluates:
Lowest MED wins.
MED stands for Multi-Exit Discriminator.
It is the only BGP attribute that lets you suggest how traffic should enter your AS.What is MED?
MED is the mirror image of Local Preference.
Local Preference controls how traffic leaves your AS, while MED controls how it enters.It is a non-transitive optional attribute, advertised to eBGP neighbors but not propagated further.
The default value is0, and unlike every other attribute in the algorithm, the lowest value wins.Answer the question below
Does MED influence how traffic enters or leaves your AS?
The Scenario
AS 300 wants traffic from AS 200 to enter through Link 1 (R3).
To do this, R3 advertises10.0.34.0/30with MED50, while R4 keeps the default MED100.
Figure 4 – Lowest MED wins, traffic enters AS 300 via Link 1
On R3, set the MED with a route-map applied outbound:
R3# conf t R3(config)# route-map LOW_MED permit 10 R3(config-route-map)# set metric 50 R3(config-route-map)# exit R3(config)# router bgp 300 R3(config-router)# neighbor 10.0.23.1 route-map LOW_MED out R3(config-router)# endOn R1, the MED appears in the Metric column:
R1# show bgp ipv4 unicast BGP table version is 7, local router ID is 10.0.23.1 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter, x best-external, a additional-path, c RIB-compressed, t secondary path, Origin codes: i - IGP, e - EGP, ? - incomplete RPKI validation codes: V valid, I invalid, N Not found Network Next Hop Metric LocPrf Weight Path *> 10.0.34.0/30 10.0.23.2 50 0 300 i * i 10.0.34.0/30 10.0.24.2 100 100 0 300 iThe path with MED
50wins, so traffic enters AS 300 through Link 1.The Same-AS Restriction
By default, BGP only compares MED between paths from the same neighboring AS.
To override this, use
bgp always-compare-medinside the BGP process.Answer the question below
For the MED attribute, does the highest or lowest value win?
If Weight, Local Preference, Originate, AS-PATH, Origin, and MED are all equal, BGP applies a simple rule:
Prefer eBGP over iBGP.
Why eBGP Wins
An eBGP path takes the prefix directly out of your AS.
An iBGP path forces traffic to first cross your own AS to reach a different border router, then exit.BGP prefers eBGP because it is the shortest path out of the AS.
Already in Action
You already saw this rule fire in the Local Preference and AS-PATH lessons, where the eBGP path won the tie before any other tiebreaker was reached.
Answer the question below
When all higher attributes are equal, BGP prefers eBGP or iBGP?
Lowest Neighbor Router ID
If two paths are still tied, BGP uses the BGP Router ID of the neighbor that advertised each path:
Lowest neighbor Router ID wins.
Each router elects its Router ID at startup using this order:
The
bgp router-idvalue if manually configuredOtherwise, the highest IP among Loopback interfaces
Otherwise, the highest IP among physical interfaces
If two neighbors have the same Router ID, BGP falls back to the lowest neighbor IP address.
In practice, a best-path decision rarely reaches this last step.
Every other attribute has already eliminated one of the candidates.Answer the question below
At the last step, BGP prefers the path from the neighbor with the lowest or highest Router ID?