AutoNetOps

Cover Image for Quick BGP Reference Guide - Part  I

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

PurposeAS Range
Reserved0, 65535
Public1-64495
Private64512-65535

BGP States

IdleBGP process has been shutdown or is waiting for the next retry.
ConnectBGP is waiting for the TCP connection to complete
ActiveTCP connection is ready, but no BGP messages have been sent yet.
OpenSentOpen message has been sent but we haven’t received one yet from the neighbor
OpenConfirmOpen message has been sent and received from the other side.
EstablishedAll parameters match, we have a working BGP peering and we can exchange update messages with routing information.
  1. Once you configure the neighbor IP address, BGP tries to reach that neighbor on destination TCP port 179.

  2. 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.

  3. 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.

PreferencePath AttributeHintDescriptionPreference
0NEXT_HOPNNext hop needs to be reachableIf no route to NEXT_HOP exists, the prefix will not be used
1WEIGHTWCisco proprietary weight attribute (not a PA) Only locally significant; any prefix learned from neighbor weights 0. Can only influence local decisionsHigher is better (default is 32768).
2LOCAL_PREFERENCELOnly relevant in own AS, can influence other iBGP neighborsHigher is better (default is 100)
3ORIGINATELRoutes are either locally injected or learned from a neighbor (iBGP / eBGP)Locally injected (network, aggregate) over remotely learned (iBGP or eBGP)
4AS PATHAThe amount of hops, the length of the AS_PATHFewer hops are better
5ORIGINOThe 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
6MEDMMulti-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.
7NEIGHBOR TYPENThe neighbor type, eBGP or iBGP neighborsPrefer eBGP over iBGP neighbor paths
8IGP METRICIBGP routes will receive a metric when NEXT_HOP is learned through an IGP (eigrp / ospf / static / …) protocolLower 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.

;