Study guide

11.3 BGP Attributes & Junos Path Selection Algorithm

JNCIS-ENT Enterprise Routing and Switching Study Guide 2026 Exam

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Exam Overview & Junos Enterprise Fundamentals

1.1 JNCIS-ENT Exam Logistics & Blueprint Breakdown 1.2 Junos CLI, Enterprise Platforms & Interface Families 1.3 Layer 2 Bridging Mechanics & Packet Forwarding

2 Chapter 2: VLANs & Inter-VLAN Routing

2.1 VLAN Segmentation and 802.1Q Tags 2.2 Access, Trunk, Native and Voice VLANs 2.3 IRB Architecture and Interface Families 2.4 IRB Configuration and Packet Walk 2.5 VLAN Configuration, Verification & Troubleshooting

3 Chapter 3: Spanning Tree Protocols

3.1 Layer 2 Loops and Root Bridge Election 3.2 STP Costs, Port Roles, States and BPDUs 3.3 RSTP Rapid Convergence & Link Types 3.4 MSTP Architecture & Spanning Tree Operations

4 Chapter 4: Layer 2 Security & Feature Protection

4.1 Edge BPDU and Root Protection 4.2 Loop Protection and Diagnostic States 4.3 Port Security, MAC Limiting & Persistent MAC Learning 4.4 DHCP Snooping, Dynamic ARP Inspection (DAI) & IP Source Guard 4.5 Layer 2 Firewall Filters: Types, Order and Actions

5 Chapter 5: Advanced Layer 2 Features & Storm Control

5.1 Storm Control & Broadcast/Multicast Suppression 5.2 MACsec Link Security and Key Agreement 5.3 LLDP and LLDP-MED Operations & Verification

6 Chapter 6: Protocol-Independent Routing & Load Balancing

6.1 Static, Aggregate, and Generated Routes 6.2 Routing Instances and RIB Groups 6.3 Junos Load Balancing & Filter-Based Forwarding (FBF) 6.4 Martian Routes and Route Acceptance

7 Chapter 7: Junos Routing Policy & Firewall Filters

7.1 Routing Policy Framework & Term Evaluation 7.2 Prefix Lists & Route Filters 7.3 Firewall Filters & Policers

8 Chapter 8: Open Shortest Path First (OSPF) Operation

8.1 OSPF Architecture & Neighbor Adjacency Formation 8.2 OSPF Areas & LSA Types 8.3 OSPFv2 & OSPFv3 Configuration and Verification

9 Chapter 9: Advanced OSPF Features & Routing Policies

9.1 OSPF Special Area Types 9.2 Route Summarization & OSPF Authentication 9.3 OSPF Diagnostics & Common Failure Scenarios

10 Chapter 10: Intermediate System to Intermediate System (IS-IS)

10.1 IS-IS Encapsulation and NET Identity 10.2 IS-IS Levels, Areas and Default Routing 10.3 IS-IS PDU Families and Neighbor Exchange 10.4 IS-IS Database Synchronization and DIS 10.5 IS-IS Configuration, Metrics & Troubleshooting

11 Chapter 11: Border Gateway Protocol (BGP)

11.1 BGP Roles, AS Numbers and TCP Transport 11.2 EBGP/IBGP Sessions, State Machine and Messages 11.3 BGP Attributes & Junos Path Selection Algorithm 11.4 BGP Configuration & Policy Implementation 11.5 BGP Scaling with Route Reflection & Diagnostics

12 Chapter 12: IP Tunneling & High Availability

12.1 GRE & IP-IP Tunneling Architecture 12.2 Link Aggregation (LAG/LACP) & Redundant Trunk Groups (RTG) 12.3 Virtual Chassis Roles and Elections 12.4 Virtual Chassis Links, Splits and Provisioning 12.5 Routing Engine Redundancy: GRES, NSR, NSB and GR 12.6 BFD Detection and VRRP Gateway Redundancy 12.7 Unified ISSU: Requirements and Verification

11.3 BGP Attributes & Junos Path Selection Algorithm

Key Takeaways Explain This Topic AI

BGP path attributes are categorized into four standardized classes: Well-known Mandatory, Well-known Discretionary, Optional Transitive, and Optional Non-Transitive.

Well-known mandatory attributes must be recognized by all BGP implementations and included in every route update: AS_PATH, NEXT_HOP, and ORIGIN.

Local Preference is a well-known discretionary attribute carried only within an AS (default value 100 in Junos) used to influence outbound enterprise traffic exit points.

Multi-Exit Discriminator (MED) is an optional non-transitive attribute used to convey exit link preference to an adjacent neighboring AS; Junos compares MED only among paths from the same AS by default.

Check usable next hop and route preference first; then compare Local Preference, AS path, origin, MED, EBGP/IBGP, IGP next-hop cost, stability, router/originator ID, cluster-list length and peer address.

Last updated: October 2026

BGP Attributes & Junos Path Selection Algorithm

Unlike Interior Gateway Protocols that compute shortest paths using scalar link metrics (such as OSPF cost or IS-IS metric), BGP determines optimal routes through a rich, multi-tiered collection of Path Attributes . Each BGP Update message advertising a prefix carries a payload of attributes describing the path's origin, history, administrative preference, and transit constraints.

When a Junos routing device receives multiple candidate paths to the exact same destination prefix, it executes the Junos BGP Path Selection Algorithm . This ordered mechanism evaluates eligibility, preference and attributes to choose a best route submitted to the Junos master routing table ( inet.0 ).

1. Classification of BGP Path Attributes

RFC 4271 divides BGP path attributes into four distinct architectural categories based on whether an attribute must be supported by all implementations and whether it must be propagated across autonomous system boundaries: +---------------------------------------------------------------------------------------------------+

  • | BGP PATH ATTRIBUTE CLASSIFICATION MATRIX |
  • +-----------------------+---------------------------------------+-----------------------------------+
  • | Category | Definition & Handling Requirement | Standard Attributes |
  • +-----------------------+---------------------------------------+-----------------------------------+
  • | Well-Known Mandatory | Must be recognized by all BGP | - AS_PATH |
  • | | implementations; MUST be present in | - NEXT_HOP |
  • | | every BGP Update advertising an NLRI. | - ORIGIN |
  • +-----------------------+---------------------------------------+-----------------------------------+
  • | Well-Known | Must be recognized by all BGP | - LOCAL_PREF |
  • | Discretionary | implementations; MAY be included in | - ATOMIC_AGGREGATE |
  • | | an Update at sender's discretion. | |
  • +-----------------------+---------------------------------------+-----------------------------------+
  • | Optional Transitive | May or may not be recognized by an | - COMMUNITY |
  • | | implementation; if unrecognized, MUST | - AGGREGATOR |
  • | | be accepted and forwarded to peers. | |
  • +-----------------------+---------------------------------------+-----------------------------------+
  • | Optional | May or may not be recognized by an | - MULTI_EXIT_DISC (MED / Metric) |
  • | Non-Transitive | implementation; if unrecognized, MUST | - ORIGINATOR_ID |
  • | | be quietly discarded and NOT passed. | - CLUSTER_LIST |
  • +-----------------------+---------------------------------------+-----------------------------------+
  • 2. In-Depth Attribute Analysis
  • Well-Known Mandatory Attributes

AS_PATH : An ordered list of Autonomous System numbers that the route advertisement has traversed. Whenever an EBGP router advertises a route to an external peer, it prepends its own local ASN to the sequence. The AS_PATH serves two essential functions:

Loop Detection : If a router receives an Update containing its own local ASN anywhere in the AS_PATH , the route is rejected.

Metric / Path Length : Paths traversing fewer autonomous systems are preferred over longer paths.

The attribute contains segments: AS_SEQUENCE (ordered list of traversed ASNs) and AS_SET (unordered set resulting from route summarization; an AS_SET counts as exactly 1 AS in path length calculations regardless of how many ASNs it contains).

NEXT_HOP : The IP address of the next-hop router used to forward transit packets toward the destination prefix. In EBGP, this is typically the IP address of the peer's interface. In IBGP, the external next-hop is preserved unchanged across the internal network.

ORIGIN : Identifies how the route was initially introduced into BGP. It carries one of three standardized values:

IGP (Value 0) : The route has IGP origin. Junos export of local routes commonly assigns this origin; Junos does not use an IOS-style BGP network statement. Represented as IGP or i in routing tables.

EGP (Value 1) : The prefix was learned via the legacy Exterior Gateway Protocol (RFC 904). Historical; rarely observed in production.

Incomplete (Value 2) : The origin is unspecified/incomplete. Do not infer this value solely because a Junos export policy redistributed a static route; inspect the actual attribute or set it explicitly. Represented as Incomplete or ? in routing tables. Tiebreaker hierarchy : IGP is preferred over EGP , which is preferred over Incomplete ( IGP < EGP < Incomplete ).

Well-Known Discretionary Attributes

LOCAL_PREF (Local Preference) : A 32-bit unsigned integer value used to indicate the degree of preference for a route within an Autonomous System. It is distributed exclusively within IBGP sessions and is stripped before routes are advertised to EBGP peers.

Junos Default : 100 .

Evaluation : Higher is preferred . An enterprise administrator uses Local Preference on ingress border routers to select the primary outbound ISP for egress traffic.

ATOMIC_AGGREGATE : Informs downstream BGP speakers that an upstream router generated an aggregate route that caused path attribute details (such as specific ASNs) to be omitted.

Optional Attributes

COMMUNITY (Optional Transitive) : A 32-bit numerical tag appended to routes to facilitate traffic grouping, filtering, and automated policy application across administrative domains.

MULTI_EXIT_DISC (MED / Metric - Optional Non-Transitive) : A 32-bit value advertised by an autonomous system to convey its preferred ingress link to a neighboring AS when multiple connections exist between the same two autonomous systems.

Evaluation : Lower is preferred .

Propagation : Transmitted to an external peer, but that peer cannot re-transmit the MED value to third-party autonomous systems.

Junos Default Rule : Junos OS only compares MED values between routes received from the exact same neighboring Autonomous System . If two competing paths originate from different ASNs, Junos skips MED evaluation and proceeds to the next tiebreaker.

3. Junos Route Selection and BGP Tie-Breakers

First verify a usable next hop and compare Junos route preference (lower wins). BGP normally has preference 170 for both EBGP and IBGP, but a policy can change it. Equal default preference is why the attribute sequence matters; it is not a reason to omit preference when a scenario explicitly changes it.

For eligible BGP paths with equal route preference and without optional AIGP or other path-selection changes, the common sequence is:

  • Comparison Preferred value
  • Local Preference Higher; default 100
  • AS-path length Shorter; an AS_SET counts as one, confederation segments as zero
  • Origin IGP before EGP before Incomplete
  • MED Lower; normally compare only paths with the same neighboring AS
  • External versus internal BGP EBGP before IBGP
  • IGP cost to BGP next hop Lower
  • External-path stability Prefer the older/current active EBGP path when the rule applies
  • Router ID Lower; substitute ORIGINATOR_ID when present
  • Cluster list Shorter; absent list has length zero
  • Peer address Lower

Juniper’s complete RPD procedure additionally covers optional AIGP, strictly internal/local routes and primary-versus-secondary routes. These are not new universal steps to insert blindly into every basic BGP question. Start with the inputs actually supplied and identify the earliest comparison that differs.

Worked Attribute Decisions

Two reachable paths have equal preference 170. Path A has Local Preference 100 and AS path length 2. Path B has Local Preference 200 and AS path length 4. Path B wins because Local Preference is examined before AS path. A longer path does not overturn an earlier preference decision.

If both instead have Local Preference 100, compare AS path next. Each extra prepended AS in an AS_SEQUENCE increases its length; an AS_SET counts as one even if it contains several ASNs. Neither metric is an IGP hop count. For equal AS paths, IGP origin beats Incomplete; origin describes the route attribute rather than the current transport protocol.

MED Scope and Overrides

When two paths come from the same neighboring AS, a lower MED can choose the preferred entry into that AS. Paths from different neighboring ASs normally skip this comparison. set protocols bgp path-selection always-compare-med changes that behavior. A missing MED is treated as zero by the documented Junos procedure. The cisco-non-deterministic option changes ordering/grouping of comparisons; it is not the switch that disables the older-EBGP-path rule.

The stability preference has explicit exceptions, including path-selection external-router-id , identical peer router IDs, confederation peers, or neither path being the current active path. Use external-router-id when deliberately bypassing that stability preference; do not describe the rule as choosing the “lowest age,” which misleadingly suggests the newest path.

Route Reflection and Multipath

An unresolved next hop renders a path hidden regardless of a desirable Local Preference. Inspect show route hidden extensive and verify next-hop reachability before changing attributes. Hidden and inactive are different: an inactive route may be valid but lose to another route.

For reflected paths, compare originator IDs in place of peer router IDs, then cluster-list length before peer IP address. Otherwise, a router could select the wrong route in an exam scenario with identical originator IDs and different reflection paths. Equal-cost forwarding also requires applicable BGP multipath and forwarding installation; two received paths are not automatic proof that both carry traffic.

Official references checked 2026-10-18: Junos BGP defaults and selection .

Loading diagram... Junos BGP Path Selection Algorithm Decision Logic