Palo Alto Networks firewalls follow a specific sequence to select the best BGP route:
For a detailed explanation, refer to the Palo Alto Networks Knowledge Base article: What is the BGP Best Path Selection Process?
To help remember the BGP best path selection process in PAN-OS, you can use the following mnemonic:
N ever W alk L azily, O r A ll O ranges M ight E scape I nto R ivers.
Administrators can manipulate BGP attributes to influence route selection:
BGP communities are tags that can be attached to routes to signal routing preferences to peers:
AS:NN
) used to group routes for policy decisions.
no-export
: Do not advertise this route to eBGP peers (stays within the current AS or confederation).
no-advertise
: Do not advertise this route to any peer (eBGP or iBGP).
local-as
(or
no-export-subconfed
): Do not advertise this route outside the local AS, not even to other sub-ASes within a BGP confederation.
By tagging routes with specific communities, administrators can influence how upstream providers handle their traffic, affecting both inbound and outbound routing decisions.
Below are common BGP use cases for traffic engineering with conceptual sequence diagrams represented using Mermaid JS. These diagrams illustrate the flow of advertisements and decision-making.
Scenario: Your AS (AS65000) has two connections to the internet via ISP A (AS100) and ISP B (AS200). You want all outbound traffic to prefer the link through ISP A. If ISP A's link fails, traffic should use ISP B.
Method: Set a higher Local Preference on routes learned from ISP A on your border routers connecting to ISP A. Local Preference is shared among iBGP peers within your AS.
Diagram: Influencing Outbound Traffic with Local Preference
Scenario: Your AS (AS65000) has two links to the same ISP (AS100). You want the ISP to prefer sending traffic to your AS via Link 1 instead of Link 2.
Method: Advertise your prefixes to ISP A with a lower MED value over Link 1 and a higher MED value over Link 2. The ISP must agree to honor MEDs.
Diagram: Influencing Inbound Traffic with MED
Scenario: Your AS (AS65000) is multi-homed to ISP A (AS100) and ISP B (AS200). You want to make the path through ISP B less attractive for inbound traffic, effectively making ISP A the primary for incoming routes.
Method: When advertising your prefixes to ISP B, prepend your own AS number multiple times. This makes the AS Path appear longer and thus less preferable.
Diagram: Influencing Inbound Traffic with AS Path Prepending
Scenario: Your AS (AS65000) advertises a specific prefix to a partner AS (AS700). You want the partner AS to use this route but not advertise it to any of its other eBGP peers.
Method: Attach the `no-export` well-known community to the prefix when advertising it to AS700.
Diagram: Using `no-export` Community
Scenario: Your AS (AS65000) uses BGP internally. For a specific prefix (e.g., a management network), you want to ensure it's advertised to all iBGP peers within AS65000 but never leaves AS65000, even to eBGP peers or other sub-ASes in a confederation.
Method:
Attach the `local-as` (also known as `no-export-subconfed`) well-known community to the prefix.
Note: The original HTML used
local-as
. Standard BGP often refers to this as
NO_EXPORT_SUBCONFED
. In PAN-OS, this is typically handled by the `no-export` for eBGP peers and confederation boundaries unless more specific confederation policies are in play. `local-as` is more stringent, ensuring it doesn't leave the originating AS at all, even to confederation peers. For simplicity, we'll illustrate its general intent to keep routes very local.
Diagram: Using `local-as` Community
To configure BGP communities in Palo Alto Networks firewalls:
Network > Virtual Routers
and select your virtual router.
BGP
, configure the necessary
Import
and
Export
rules.
Export
rule, under the
Action
tab, set the desired community attributes (e.g., "no-export", or custom values like "65000:100").
Set Community
section.
Note: Multiple community attributes can be added primarily to routes that are being redistributed into BGP. For more details, refer to the Knowledge Base article: Add Multiple Community Attribute to BGP routes .
To filter BGP routes based on community attributes:
Network > Routing > Routing Profiles > Filters
and select
Community Lists
.
For detailed steps, refer to the documentation: Configure a Filter Community List .
Based on publicly available information and common BGP topics, PCNSE exam questions related to BGP might cover areas like:
show routing protocol bgp ...
).
BGP path attributes are pieces of information that describe a route and are used in the BGP best path selection process. They are categorized based on whether they are well-known or optional, and whether they are transitive or non-transitive.
Well-known attributes are expected to be recognized by all BGP implementations.
Optional attributes may not be recognized by all BGP implementations.
The transitivity of an attribute determines its scope and how it propagates through the BGP network:
All well-known attributes are inherently transitive (their transitive bit is set to 1).
BGP Communities are optional transitive attributes that act like "tags" attached to BGP routes. This allows for more flexible and scalable traffic engineering and policy enforcement.
ISP_AS:70
might mean "set Local Preference to 70", while
ISP_AS:120
means "set Local Preference to 120". This influences which of the customer's links the ISP prefers for traffic destined to the customer.
65001:XXX
might mean "prepend once to AS XXX".
35133:0:174
meaning "do not export to AS174") or to blackhole traffic for a specific prefix (often used in DDoS mitigation).
NO_EXPORT
:
Prevents the route from being advertised to any eBGP peer outside the local AS (or confederation).
NO_ADVERTISE
:
Prevents the route from being advertised to any BGP peer (iBGP or eBGP).
LOCAL_AS
(or
NO_EXPORT_SUBCONFED
):
Prevents the route from being advertised outside the local AS, including to other sub-confederations in a BGP confederation scenario. (Note: `LOCAL_AS` is often more restrictive, keeping it within the originating AS only).
The effectiveness of influencing an ISP's traffic engineering using communities depends entirely on the ISP offering such a service and documenting the community values and their corresponding actions.
Always refer to the latest PCNSE blueprint and study materials from Palo Alto Networks for the most accurate exam topic coverage.
Troubleshooting BGP involves checking configuration, neighbor states, route advertisements, received routes, path selection, and underlying connectivity. Palo Alto Networks firewalls provide a range of CLI commands for this. Remember to execute commands within the correct Virtual Router (VR) context if you are not using the default VR.
Common Convention:
Replace placeholders like
,
,
,
, and
with your actual configuration values.
First, ensure the BGP configuration is correct and loaded.
show config running xpath /config/devices/entry[@name='localhost.localdomain']/network/virtual-router/entry[@name='
']/protocol/bgp
Displays the BGP section of the running configuration for the specified virtual router. Useful for a quick review.
show routing protocol bgp config vr
Shows how the system has interpreted and loaded the BGP configuration. Good for verifying settings like Router ID, AS number, peer details, and policies.
Verify if BGP sessions are established and stable.
show routing protocol bgp summary vr
Provides a quick overview of all BGP peers, their state (Idle, Connect, Active, OpenSent, OpenConfirm, Established), uptime, and prefix counts (PrefRcvd). 'Established' is the desired state.
show routing protocol bgp peer vr
Gives extensive details for each peer, including state, timers, configured options, error codes (if any), capabilities negotiated, and counters for messages sent/received.
show routing protocol bgp peer-group
peer
vr
Focuses on a single peer, showing all the detailed information from the previous command but filtered for easier reading. Replace
with the name defined in your BGP config.
Examine the BGP Routing Information Base (RIB) tables.
show routing protocol bgp rib-in peer
vr
Shows all routes received from a specific neighbor *before* any inbound policy/filtering is applied. Crucial to see what the neighbor is actually sending.
show routing protocol bgp rib-in peer
prefix
vr
Filters the Adj-RIB-In for a specific prefix, showing its attributes (AS_PATH, NEXT_HOP, MED, LOCAL_PREF, Community, etc.) as received.
show routing protocol bgp rib-out peer
vr
Shows all routes being advertised to a specific neighbor *after* outbound policy/filtering has been applied. Useful to verify your export policies.
show routing protocol bgp rib-out peer
prefix
vr
Filters the Adj-RIB-Out for a specific prefix, showing its attributes as sent to the neighbor.
show routing protocol bgp loc-rib vr
Shows the BGP routes that have passed inbound policies and are candidates for the main routing table. This includes routes from all peers and locally originated routes.
show routing protocol bgp loc-rib prefix
vr
Shows details for a specific prefix in the Loc-RIB, including all available paths considered by BGP and indicating which one was selected as the best path ('*' symbol) based on the BGP path selection process. This is key for troubleshooting path selection issues.
Verify if the best BGP routes are installed in the firewall's main RIB.
show routing route vr
Displays the entire IP routing table for the VR. Look for flags indicating the protocol (e.g., 'B' for BGP).
show routing route type bgp vr
Filters the routing table to show only routes learned via BGP that were selected as best and installed.
show routing route destination
vr
Checks the routing table for a specific destination prefix to see which route is currently active.
Ensure basic IP reachability to the BGP neighbor.
ping vr
host
Tests L3 connectivity to the BGP peer's IP address using the correct VR context.
traceroute vr
host
Helps identify routing issues along the path to the neighbor.
Warning: Debugging can significantly impact CPU performance. Use it sparingly in production, only when necessary, and disable it immediately after troubleshooting.
debug routing basic on debug
debug routing bgp ?
List available BGP debug options. Common choices include:
debug routing bgp all on debug
(Very verbose, use as last resort)
debug routing bgp errors on debug
(Logs BGP protocol errors)
debug routing bgp events on debug
(Logs state machine transitions, connection attempts)
debug routing bgp keepalives on debug
(Logs keepalive messages)
debug routing bgp notification on debug
(Logs sent/received notification messages - indicates errors)
debug routing bgp updates on debug
(Logs sent/received update messages - can be very verbose)
debug routing bgp state on debug
(Focuses on state changes)
debug routing bgp route on debug
(Logs route processing/installation)
Example:
debug routing bgp events on debug
less mp-log routed.log
View the routing process log file. Use spacebar to page down, 'q' to quit.
tail follow yes mp-log routed.log
Follow the log file in real-time (Ctrl+C to stop).
debug routing bgp all off debug
debug routing basic off debug
Ensure you turn off ALL debugs you enabled.
Warning: Packet captures can also impact performance, especially with broad filters or high traffic rates. Use specific filters and disable captures promptly.
Used to inspect the raw BGP packets being exchanged (TCP Port 179).
debug dataplane packet-diag set filter match source 192.168.1.1 destination-port 179 protocol 6
debug dataplane packet-diag set filter match destination 192.168.1.1 source-port 179 protocol 6
This sets up two potential match conditions for traffic *to* or *from* the neighbor on TCP port 179 (BGP). Adjust IPs and add interface filters if needed using `ingress-interface
debug dataplane packet-diag set capture stage receive file rx_bgp.pcap
debug dataplane packet-diag set capture stage transmit file tx_bgp.pcap
debug dataplane packet-diag set capture stage drop file drop_bgp.pcap
Captures packets at different processing points. 'receive' (entering interface), 'transmit' (leaving interface), 'drop' (dropped by firewall).
debug dataplane packet-diag set capture on
debug dataplane packet-diag show settings
debug dataplane packet-diag set capture off
Use an SCP client to copy the .pcap files from the firewall (usually located in `/opt/pancfg/mgmt/debug/` or similar, path might vary) or use TFTP/SCP export commands:
scp export debug-pcap from mp-log rx_bgp.pcap to
@
:
tftp export debug-pcap from mp-log rx_bgp.pcap to
Analyze the pcap files using Wireshark.
Used to force route re-advertisement or reset a stuck session.
clear routing protocol bgp peer
soft in vr
Requests the neighbor to resend its full RIB without tearing down the TCP session. Requires route-refresh capability negotiation.
clear routing protocol bgp peer
soft out vr
Resends the local router's full RIB to the neighbor without tearing down the TCP session.
clear routing protocol bgp peer
vr
Tears down the BGP session (including the TCP connection) and attempts to re-establish it. More disruptive than a soft reset.
High CPU or memory usage can impact routing protocol performance.
show system resources follow
Monitors CPU and memory usage in real-time. Look for high utilization in the `routed` (routing) process on the management plane or high dataplane CPU if captures/debugs are running. (Ctrl+C to stop).