Quick BGP Reference Guide - Part I
4 min read
In this series, I will provide a cheat sheet or summary of important BGP points and information for quick reference and review.
This is not intended to be a detailed explanation, but rather a review for those who are already familiar with it.
AS Ranges
Purpose | AS Range |
Reserved | 0, 65535 |
Public | 1-64495 |
Private | 64512-65535 |
BGP States
Idle | BGP process has been shutdown or is waiting for the next retry. |
Connect | BGP is waiting for the TCP connection to complete |
Active | TCP connection is ready, but no BGP messages have been sent yet. |
OpenSent | Open message has been sent but we haven’t received one yet from the neighbor |
OpenConfirm | Open message has been sent and received from the other side. |
Established | All parameters match, we have a working BGP peering and we can exchange update messages with routing information. |
Once you configure the neighbor IP address, BGP tries to reach that neighbor on destination TCP port 179.
When the TCP three-way handshake completes, BGP will send an open message. This message is similar to the hello packet that EIGRP and OSPF use.
When the open message has been sent and received and all other parameters match (like authentication), then the neighbors will reach the established state.
BGP Best Path Selection
A peer Autonomous System (AS) is what defines an external or internal route
The first criteria is that the NEXT_HOP is reachable, meaning that it is present in the routing table.
Preference | Path Attribute | Hint | Description | Preference |
0 | NEXT_HOP | N | Next hop needs to be reachable | If no route to NEXT_HOP exists, the prefix will not be used |
1 | WEIGHT | W | Cisco proprietary weight attribute (not a PA) Only locally significant; any prefix learned from neighbor weights 0. Can only influence local decisions | Higher is better (default is 32768). |
2 | LOCAL_PREFERENCE | L | Only relevant in own AS, can influence other iBGP neighbors | Higher is better (default is 100) |
3 | ORIGINATE | L | Routes are either locally injected or learned from a neighbor (iBGP / eBGP) | Locally injected (network, aggregate) over remotely learned (iBGP or eBGP) |
4 | AS PATH | A | The amount of hops, the length of the AS_PATH | Fewer hops are better |
5 | ORIGIN | O | The method with which routes were originally (or altered) advertised 0 (i) is internal, 1 (e) is external (absent), 2 (?) is redistributed (incomplete) | I > e > ? e is absent by default in IOS |
6 | MED | M | Multi-exit Discriminator. Used to influence direct neighbor (and only direct neighbor) or peers in own AS Often used by dual-homed ISPs to create active/passive connection Only used when all other attributes match (preference/origin / etc) | Lower is better; the default is 0 or missing in IOS. |
7 | NEIGHBOR TYPE | N | The neighbor type, eBGP or iBGP neighbors | Prefer eBGP over iBGP neighbor paths |
8 | IGP METRIC | I | BGP routes will receive a metric when NEXT_HOP is learned through an IGP (eigrp / ospf / static / …) protocol | Lower is better |
Order of preference:
• WEIGHT (highest)
• LOCAL_PREF (highest)
• Locally injected (network, aggregate) over remotely learned
• AS_PATH (shortest)
• ORIGIN (lowest) (0 over 1 over 2) 0 is internal, 1 is external (absent), 2 is redistributed (incomplete)
• MUTLI_EXIT-DISC / MED (lowest)
• eBGP over iBGP learned routes
• Lowest IGP cost/metric to the NEXT_HOP
Best-Path Tie Breakers (No Multipath)
• If both paths are external, prefer the older one
• If both paths are internal, prefer the lowest ROUTER_ID
• If ORIGINATOR_ID is the same, prefer one with the shorter CLUSTER_LIST
• Finally, prefer the one with the lowest neighbor's IP address
BGP Attributes
NEXT_HOP Attribute This is a well-known, mandatory, transitive attribute that must be present in all updates
• Is the peer IP-address if remotely learned
• 0.0.0.0 for routes advertised using the network or aggregate commands
• the IP next-hop for redistributed routes
• The next-hop must be reachable, meaning that it must be present in the routing table
• Remains unchanged in the same AS by default, but can (or should) be modified
• Is changed by default when forwarded between different AS. Will become the IP address of the router that passed on the route
Worth making it clear
You can choose the exit path… but you don’t make routing decisions for other autonomous systems.
Each autonomous system will only advertise the best path to your autonomous system. Your AS will only learn about the best path from other ASs. Only if their best path fails will you learn about the second-best path.