0% found this document useful (0 votes)
187 views10 pages

BGP Commands Cheat Sheet

This document is a comprehensive cheat sheet for BGP commands, covering basic configuration, neighbor verification, route verification, path selection, filtering, and troubleshooting. It includes commands for managing BGP sessions, route manipulation, and advanced troubleshooting techniques, as well as best practices for filtering routes using prefix lists, AS-path, route maps, and distribute lists. The cheat sheet serves as a quick reference for network professionals dealing with BGP configurations and issues.

Uploaded by

Md
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views10 pages

BGP Commands Cheat Sheet

This document is a comprehensive cheat sheet for BGP commands, covering basic configuration, neighbor verification, route verification, path selection, filtering, and troubleshooting. It includes commands for managing BGP sessions, route manipulation, and advanced troubleshooting techniques, as well as best practices for filtering routes using prefix lists, AS-path, route maps, and distribute lists. The cheat sheet serves as a quick reference for network professionals dealing with BGP configurations and issues.

Uploaded by

Md
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

2/12/25, 1:25 AM BGP Commands Cheat Sheet

1. Basic BGP Configuration


Command Purpose

router bgp <ASN> Enables BGP and sets the local AS number

neighbor <IP> remote-as <ASN> Establishes a BGP neighbor

network <prefix> mask <subnet> Advertises a network in BGP

redistribute <protocol> Redistributes routes from another protocol (OSPF, EIGRP, etc.) into BGP

2. BGP Neighbor Verification & Troubleshooting


Command Purpose

show ip bgp summary Displays BGP neighbor status and session states

show ip bgp neighbors Shows detailed neighbor information

clear ip bgp * Resets all BGP sessions (use carefully)

clear ip bgp <neighbor-IP> Resets a specific BGP session

debug ip bgp Debugs BGP events (use cautiously)

3. BGP Route Verification


Command Purpose

show ip bgp Displays the entire BGP table

show ip bgp <network> Checks BGP routes for a specific network

show ip bgp neighbors <neighbor-IP> advertised- Displays routes advertised to a neighbor


routes

show ip bgp neighbors <neighbor-IP> received-routes Displays routes received from a neighbor

show ip bgp neighbors <neighbor-IP> routes Displays the BGP table entries received from a
neighbor

4. BGP Path Selection & Route Manipulation

https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 1/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

Command Purpose

neighbor <IP> weight <value> Assigns a weight to influence outbound traffic

neighbor <IP> route-map <name> in/out Applies a route map to influence incoming/outgoing routes

neighbor <IP> next-hop-self Sets the router as the next-hop for advertised routes

neighbor <IP> send-community Enables community attribute propagation

bgp bestpath as-path ignore Ignores AS-path length for path selection

5. BGP Filtering & Route Control


Command Purpose

neighbor <IP> prefix-list <name> in/out Filters prefixes received/sent to a neighbor

neighbor <IP> distribute-list <ACL> in/out Filters routes using an ACL

neighbor <IP> filter-list <AS_PATH> in/out Filters routes based on AS-path

6. BGP Route Aggregation


Command Purpose

aggregate-address <network> <mask> summary-only Advertises a summarized route without specifics

aggregate-address <network> <mask> Advertises a summarized route while keeping specifics

7. BGP Local Preference & MED


Command Purpose

bgp default local-preference <value> Sets the default local preference (higher = preferred)

neighbor <IP> route-map <name> in Modifies MED (Multi-Exit Discriminator) to influence inbound traffic

8. BGP Route Reflector & Confederation

https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 2/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

Command Purpose

neighbor <IP> route-reflector-client Configures a router as a route reflector for a client

bgp confederation identifier <ASN> Configures the confederation AS

bgp confederation peers <ASN> Defines sub-AS members of the confederation

This cheat sheet covers essential BGP commands and their uses. Let me know if you need more details!

BGP advanced commands cheat sheet for troubleshooting for


breck fix.

Advanced BGP Troubleshooting Cheat Sheet (Break-Fix)


This cheat sheet covers advanced BGP troubleshooting commands for resolving connectivity issues,
session failures, and route problems.

1. Checking BGP Neighbor Status


Command Purpose

show ip bgp summary Displays BGP neighbor states, prefixes, and hold timers.

show ip bgp neighbors <neighbor- Shows detailed BGP neighbor information, including capabilities and
IP> messages exchanged.

show ip bgp neighbors <neighbor-IP> Checks the FSM (Finite State Machine) state of a neighbor. Should
state be Established if operational.

show ip bgp neighbors <neighbor-IP> Checks keepalive and hold timer values for mismatches.
timers

show ip bgp neighbors <neighbor-IP> Verifies TCP connection issues (useful for checking MTU mismatches).
transport

Fixing BGP Neighbor Issues:


If neighbor is stuck in Idle → Check if neighbor <IP> remote-as <ASN> is correctly configured.

If neighbor is stuck in Active → Check TCP port 179 connectivity ( telnet <neighbor-IP> 179 ).

https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 3/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

If neighbor keeps flapping → Investigate high CPU, unstable links, or interface errors ( show
interfaces <interface> ).

2. Checking BGP Routes


Command Purpose

show ip bgp Displays the full BGP table.

show ip bgp <prefix> Checks if a specific prefix is learned via BGP.

show ip bgp neighbors <neighbor-IP> Displays all routes received from a neighbor (needs soft-
received-routes reconfiguration inbound enabled).

show ip bgp neighbors <neighbor-IP> Displays routes sent to a neighbor.


advertised-routes

show ip bgp rib-failure Shows routes that failed to install into the routing table.

show ip route bgp Displays BGP-learned routes installed in the RIB.

show bgp all dampening parameters Checks if routes are suppressed due to route dampening.

Fixing BGP Route Issues:


If a route is missing → Check if it is being filtered by route-maps, prefix-lists, or AS-path filters.

If a route is not installed in the routing table → Check show ip bgp rib-failure .

If MED or local preference is incorrect → Check show ip bgp <prefix> and look for attributes
influencing path selection.

3. Clearing & Resetting BGP Sessions


Command Purpose

clear ip bgp <neighbor-IP> Soft reset of a specific BGP session.

clear ip bgp * Clears all BGP sessions (use carefully).

clear ip bgp <neighbor-IP> soft Performs a soft reset (recommended over hard reset).

clear ip bgp <neighbor-IP> out Clears only outbound advertisements.

Fixing Route Propagation Issues:


Use soft reset ( clear ip bgp <neighbor-IP> soft ) to refresh routes without impacting the session.

https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 4/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

If routes are being filtered, check show ip bgp neighbors <neighbor-IP> advertised-
routes and received-routes .

4. Debugging BGP
Command Purpose

debug ip bgp events Shows BGP state changes in real-time.

debug ip bgp updates Displays route updates sent/received by the router.

debug ip bgp keepalives Monitors keepalive messages (useful for session drops).

debug ip bgp dampening Checks route dampening behavior.

Fixing Session Drops or Route Flapping:


If sessions are dropping → Use debug ip bgp events to check for hold timer expirations.

If updates are missing → Use debug ip bgp updates to verify if prefixes are being sent/received.

If dampening is suppressing routes → Use show bgp all dampening parameters and disable
dampening if necessary.

5. Checking TCP & MTU Issues


Command Purpose

show tcp brief Checks active TCP sessions, including BGP (port 179).

show ip bgp neighbors <neighbor-IP> transport Displays TCP-related settings like MSS and MTU.

ping <neighbor-IP> df-bit size <MTU> Checks MTU mismatches (DF-bit prevents fragmentation).

Fixing TCP & MTU Issues:


If BGP is stuck in Active → Check show tcp brief to see if a TCP session is established.

If MTU mismatch is suspected → Use ping <neighbor-IP> df-bit size <MTU> and adjust MTU
settings if needed.

6. Checking BGP Policy & Route Filtering


https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 5/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

Command Purpose

show ip bgp neighbors <neighbor-IP> Checks if any policy is applied (route-map, prefix-list, AS-path
policy filter).

show ip bgp filter-list Displays AS-path filtering rules.

show ip bgp prefix-list Shows configured prefix-lists.

show route-map <name> Checks applied route maps and match/permit/deny conditions.

Fixing Route Filtering Issues:


If a route is not advertised → Check outbound filters ( show ip bgp neighbors <neighbor-IP>
advertised-routes ).

If a route is not received → Check inbound filters ( show ip bgp neighbors <neighbor-IP>
received-routes ).

7. Checking BGP Path Selection Issues


Command Purpose

show ip bgp <prefix> Shows available BGP paths and attributes.

show ip bgp paths Displays all paths received for each prefix.

show ip bgp bestpath Explains why a specific route was chosen as the best path.

show ip bgp attribute-info Provides attribute values influencing BGP selection.

Fixing Incorrect Path Selection:


If the wrong path is selected → Check weight, local preference, AS-path, MED in show ip bgp
<prefix> .

If ECMP (Equal Cost Multi-Path) is needed → Ensure maximum-paths <value> is configured under
BGP.

Final Notes
✅ Use soft clear ( clear ip bgp <neighbor-IP> soft ) instead of hard resets.
✅ Use debugging commands cautiously in production (can cause high CPU load).
✅ Check route filtering policies if routes are missing or not propagating.
✅ Monitor TCP and MTU settings if sessions fail to establish.
https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 6/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

This cheat sheet covers key break-fix BGP troubleshooting commands. Let me know if you need more
details!

BGP commands using filter

BGP Commands Using Filters (Prefix, Route-Map, AS-Path, and Distribute-


List)
BGP filtering is essential for controlling route advertisement and acceptance. Here are the key filtering
methods with commands and use cases.

1. Prefix List Filtering (Blocking or Allowing Specific Prefixes)


Create a Prefix-List

bash Copy Edit

ip prefix-list <prefix-list-name> seq <sequence-number> permit|deny <network> <mask-


length>

Example:

bash Copy Edit

ip prefix-list BLOCK_SUBNET seq 10 deny 10.10.10.0/24 ip prefix-list BLOCK_SUBNET seq 20


permit 0.0.0.0/0 le 32

🔹 Purpose: Blocks 10.10.10.0/24 but allows all other prefixes.

Apply Prefix-List to a BGP Neighbor

bash Copy Edit

router bgp <ASN> neighbor <neighbor-IP> prefix-list <prefix-list-name> in|out

Example:

bash Copy Edit

router bgp 65000 neighbor 192.168.1.1 prefix-list BLOCK_SUBNET out

https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 7/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

🔹 Purpose: Prevents 10.10.10.0/24 from being advertised to 192.168.1.1.

2. AS-Path Filtering (Controlling Routes Based on AS-PATH)


Create an AS-Path Access List
bash Copy Edit

ip as-path access-list <list-number> permit|deny <regex>

Example:

bash Copy Edit

ip as-path access-list 10 deny _65001$ ip as-path access-list 10 permit .* # Allow all


other routes

🔹 Purpose: Blocks routes originating from AS 65001.

Apply AS-Path Filter to BGP Neighbor


bash Copy Edit

router bgp <ASN> neighbor <neighbor-IP> filter-list <as-path-list-number> in|out

Example:

bash Copy Edit

router bgp 65000 neighbor 192.168.1.1 filter-list 10 in

🔹 Purpose: Blocks inbound routes learned from AS 65001.

3. Route-Map Filtering (Advanced Filtering with Conditions)


Create a Route Map

bash Copy Edit

https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 8/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

route-map <route-map-name> permit|deny <sequence-number> match <criteria> set


<modification>

Example:

bash Copy Edit

route-map BLOCK_PREFIX permit 10 match ip address prefix-list BLOCK_SUBNET

🔹 Purpose: Matches prefixes in BLOCK_SUBNET prefix-list.

Apply Route Map to BGP Neighbor

bash Copy Edit

router bgp <ASN> neighbor <neighbor-IP> route-map <route-map-name> in|out

Example:

bash Copy Edit

router bgp 65000 neighbor 192.168.1.1 route-map BLOCK_PREFIX out

🔹 Purpose: Prevents blocked prefixes from being advertised to 192.168.1.1.

4. Distribute-List Filtering (Using ACL for BGP Filtering)


Create an ACL

bash Copy Edit

access-list <acl-number> permit|deny <network> <wildcard-mask>

Example:

bash Copy Edit

access-list 10 deny 10.10.10.0 0.0.0.255 access-list 10 permit any

🔹 Purpose: Blocks 10.10.10.0/24 but allows everything else.

Apply Distribute-List to BGP Neighbor

bash Copy Edit

https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 9/10
2/12/25, 1:25 AM BGP Commands Cheat Sheet

router bgp <ASN> neighbor <neighbor-IP> distribute-list <acl-number> in|out

Example:

bash Copy Edit

router bgp 65000 neighbor 192.168.1.1 distribute-list 10 out

🔹 Purpose: Blocks 10.10.10.0/24 from being advertised.

Verification Commands
Command Purpose

show ip prefix-list Displays all configured prefix lists.

show ip as-path access-list Shows configured AS-path lists.

show ip route-map Displays all route-maps.

show ip bgp neighbor <IP> advertised-routes Checks which routes are advertised to a neighbor.

show ip bgp neighbor <IP> received-routes Checks routes received from a neighbor.

Best Practices for BGP Filtering


✅ Use prefix-lists for direct filtering of subnets.
✅ Use AS-path filters to control routes from specific ASNs.
✅ Use route-maps for complex filtering (match, set, and modify).
✅ Use distribute-lists for quick ACL-based filtering.
This covers BGP filtering using prefix lists, AS-path, route maps, and distribute lists. Let me know if
you need more details!

https://chatgpt.com/share/67a5f973-c768-800f-a17c-e02a14553b17 10/10

You might also like