Understanding BGP on Palo Alto Networks Firewalls

Border Gateway Protocol (BGP) is the standard exterior gateway protocol designed to exchange routing and reachability information among autonomous systems (AS) on the Internet. Palo Alto Networks firewalls implement BGP within their Virtual Router instances, allowing them to participate in complex routing environments. This document covers key BGP concepts as implemented on PAN-OS.

Core BGP Configuration

Peering: eBGP vs. iBGP

Route Advertisement and Filtering

Controlling which routes are learned and advertised is crucial. PAN-OS uses specific profiles and rules:

Note on Order: For incoming routes, Dampening (if configured) is applied first, followed by Import Rules. For outgoing routes, Export Rules determine what is sent.

Understanding the Impact of Changing Advertised MED

Modifying the MED (Multi-Exit Discriminator) value you send in your BGP advertisements is a specific technique used for traffic engineering. It's crucial to understand which direction of traffic flow it influences.

In Summary: Advertise MED to influence how others enter your network (Inbound). Use Local Preference (on received routes) to influence how you exit your network (Outbound).

Understanding the Impact of Setting Local Preference

Setting BGP Local Preference (LP) is the standard and most effective method used *within* an Autonomous System (AS) to control outbound path selection. It allows an administrator to define which exit point the entire AS should prefer for traffic destined for external networks.

In Summary: Set Local Preference (via Import Rules on received routes) to control how your AS exits towards external networks (Outbound). Use MED or AS Path Prepending (via Export Rules on advertised routes) to influence how others enter your network (Inbound).

Understanding the Impact of Setting BGP Weight

The BGP Weight attribute is a vendor-specific parameter (supported by Cisco, Palo Alto Networks, and others, but not part of the BGP standard RFCs) used to influence path selection on a single, local router . It provides a simple way to prefer one path over another *before* considering more standard BGP attributes.

In Summary: Use Weight for strong local outbound preference on a single router. Use Local Preference for consistent AS-wide outbound preference . Use MED/Prepending to influence inbound preference .

Common BGP Scenarios & Traffic Engineering

BGP provides numerous attributes that allow network administrators to influence routing decisions. Understanding these scenarios is key to managing traffic flow effectively.

Scenario: Influencing Outbound Traffic (Your Egress Choice)

Goal: Control which ISP or path your internal users take to reach external destinations.

Primary Tool: Local Preference (LP) . Set via Import Rules on routes learned from peers. Higher LP is preferred.

Mechanism: By assigning a higher LP value (e.g., 200) to routes learned from your preferred ISP (ISP-A) compared to the backup ISP (ISP-B, default 100), you tell all routers within your AS to use ISP-A as the exit point when both paths are available.

What to Look For: The question asks how to make *your network* prefer one path *out* over another. It involves comparing routes *received* from different peers.

Scenario: Influencing Inbound Traffic (Neighbor's Ingress Choice)

Goal: Control which of your links external networks use to send traffic *to* your network.

Primary Tools:

Mechanism (Prepend): You advertise your prefixes to the backup ISP (ISP-B) with your AS number repeated several times (e.g., 65000 65000 65000 ). External networks see this longer path and prefer the shorter path advertised via your primary ISP (ISP-A, e.g., 65000 ).

Mechanism (MED): Advertise your prefix to the same neighbor ISP over two links, setting MED 100 on the primary link and MED 200 on the backup link. The neighbor ISP (if they honor MED) will prefer the link where they received the lower MED.

What to Look For: The question asks how to make *other networks* prefer sending traffic *to you* via one link over another. It involves modifying attributes on routes you *advertise*. Look for keywords like "inbound," "attract," "less preferred entry point."

Scenario: Using BGP Communities for Policy

Goal: Tag routes with specific values to signal policy intentions to BGP peers (or for internal use).

Primary Tool: Community Attribute . Set via Export Rules , matched via Import/Export Rules.

Mechanism: You attach a specific community value (e.g., well-known like no-export FFFF:FF01, no-advertise FFFF:FF03, or custom values) to a route advertisement. The receiving peer, if configured to recognize that community, performs a specific action (e.g., does not advertise the route further to eBGP peers).

What to Look For: The question mentions tagging routes, signaling actions to peers, or preventing propagation based on agreed-upon signals.

Scenario: Conditional Route Advertisement

Goal: Advertise a prefix only if a specific condition is met, typically the existence of another route.

Primary Tool: Conditional Advertisement feature within Export Rules , using an "Exist Map".

Mechanism: You configure an Export Rule to advertise Prefix A. Within the rule, you enable Conditional Advertisement and point it to an "Exist Map" that matches Prefix B. The firewall checks its routing table (RIB); if Prefix B exists, Prefix A is advertised. If Prefix B is not present, Prefix A is withdrawn or not advertised.

What to Look For: The question states a requirement to advertise something *only if* something else is present (e.g., advertise my network only if I have a default route).

Scenario: Overriding BGP for Specific Traffic/Prefixes

Goal: Force traffic for a specific destination or traffic originating from the firewall itself down a path different from the BGP best path.

Primary Tools:

Mechanism (Static): A static route with AD 10 will always be preferred over an eBGP route (AD 20) or iBGP route (AD 200) for the same prefix, useful for forcing firewall-originated traffic.

Mechanism (Import LP): Make a specific prefix learned via a non-default path more attractive using a higher LP just for that prefix.

What to Look For: The question involves overriding the normal BGP decision, handling specific destinations differently, or controlling traffic *from the firewall*. Mention of Administrative Distance often points towards Static Routes.

BGP Peer Groups

Configuring multiple BGP peers, especially those with similar characteristics (like multiple peers within the same neighboring AS or multiple iBGP peers), can become repetitive. Peer Groups simplify this process significantly.

iBGP Scalability: Confederations vs. Route Reflectors

The iBGP split-horizon rule (routes learned from one iBGP peer are not advertised to another iBGP peer) necessitates a full mesh of connections between all iBGP speakers within an AS. This doesn't scale well in large networks. Two primary solutions exist:

BGP Multihop

By default, eBGP peers expect to be directly connected (sharing the same subnet), meaning the neighbor IP address should be reachable in one Layer 3 hop (TTL=1). iBGP does not have this direct connection requirement, but the TCP session still needs to establish.

Important: When using multihop, especially for iBGP peering between loopback interfaces, ensure you have underlying IGP (like OSPF) or static routes providing reachability between those loopback addresses.

BGP Attributes and Path Selection

BGP uses attributes carried within Update messages to learn about network reachability and select the best path when multiple paths to the same destination exist. Understanding the key attributes and the order they are evaluated in is fundamental.

BGP Best Path Selection Process

When a BGP router receives multiple paths for the same network prefix, it runs a deterministic algorithm to select a single "best" path to install in its routing table and advertise to peers. The process stops as soon as one path is determined to be better than the others based on the current step.

  1. Discard paths where the N ext-Hop is inaccessible (cannot be resolved in the RIB).
  2. Prefer highest W eight (Palo Alto specific, local significance).
  3. Prefer highest L ocal Preference (Highest is better, AS-wide).
  4. Prefer path locally O riginated (network, redistribute, aggregate).
  5. Prefer path with shortest A S_PATH length.
  6. Prefer path with lowest O rigin code (IGP < EGP < Incomplete).
  7. Prefer path with lowest M ED (Multi-Exit Discriminator) - requires comparison between paths from the same neighboring AS.
  8. Prefer E BGP paths over IBGP paths.
  9. Prefer path with the lowest I GP metric to the BGP next-hop router.
  10. (If ECMP is enabled and configured) Mark multiple paths as eligible for M ultipath load sharing if they are equal up to step 9.
  11. Prefer the oldest (most stable) E BGP path.
  12. Prefer path from the BGP peer with the lowest Router ID .
  13. Prefer path from the BGP peer with the lowest neighbor IP address.

Attribute Types: Transitive vs. Non-Transitive

BGP attributes carry information about routes, influencing path selection. They are categorized based on whether BGP routers are required to pass them along to other peers, especially if the router doesn't fully understand or implement the specific attribute. This is crucial for ensuring information propagates correctly across different Autonomous Systems.

Transitive Attributes

Non-Transitive Attributes

Significance: This distinction is fundamental to how BGP operates across the diverse implementations on the internet. Transitivity ensures essential path information (like AS_PATH) and widely used optional information (like Communities) can traverse ASes that might not have the latest BGP features, while non-transitivity prevents misunderstood or locally-relevant information (like MED) from propagating unnecessarily.

Key Takeaway: Steps higher in the list are more significant. A path chosen because it has a higher Local Preference (Step 3) will win, even if another path has a shorter AS_PATH (Step 5).

Route Selection Mnemonic

Remembering the order can be tricky. Here's a mnemonic (adapt or create your own!):

N o W ay L azy O ld A nts O ften M ake E xcellent I nternet M aps, E xcept R arely I n P aris!

( N ext-Hop, W eight, L ocal Pref, O riginated Locally, A S_PATH, O rigin Code, M ED, E BGP>IBGP, I GP Metric, M ultipath(ECMP), E BGP Age, R outer ID, Neighbor IP )

Operational Aspects

iBGP Specifics

Verification (CLI Commands)

Useful CLI commands for troubleshooting and verification:

Understanding these concepts, attributes, and the selection process provides a solid foundation for configuring, managing, and troubleshooting BGP on Palo Alto Networks firewalls.