BGP Quick notes

A transit AS is an AS that routes traffic from one external AS to another external AS


The “show ip bgp” command is used to display entries in the BGP routing table.


The AS-PATH attribute is used to prevent BGP routing loops. When receiving an BGP advertisement, the router checks the AS-PATH attribute, if it see it’s own AS number in the AS-Path then it is a routing loop so the router will not install this route in its BGP table.


Local preference is an indication to the AS about which path has preference to exit the AS in order to reach a certain network. A path with a higher local preference is preferred more. The default value for local preference is 100.Unlike the weight attribute, which is only relevant to the local router, local preference is an attribute that routers exchange in the same AS. The local preference is set with the “bgp default local-preference value” command.


MD5 Authentication: You can configure MD5 authentication between two
BGP peers, MD5 authentication must be configured with the same password on both BGP peers; otherwise, the connection between them will not be made. If a router has a password configured for a peer, but the other peer does not, a message No MD5 digest from…” will appear on the console while the routers attempt to establish a Multicast Source Discovery Protocol (MSDP) session between them. Similarly, if the two routers have different passwords configured, a message“Invalid MD5 digest from…” will appear on the screen.


Aggregate-Address command: When the aggregate-address command is used within BGP routing, the aggregated address is advertised, along with the more specific routes. The exception to this rule is through the use of the summary-only command. The “summary-only” keyword suppresses the more specific routes and announces only the summarized route.


The weight attribute is a special Cisco attribute that is used in the path selection process when there is more than one route to the same destination. The higher the weight value, the better the path. The default weight is 0.The weight attribute is local to the router and not propagated to other routers.


Below is the list of BGP states in order, from startup to peering:
1 – Idle: the initial state of a BGP connection. In this state, the BGP speaker is waiting for a BGP start event, generally either the establishment of a TCP connection or the re-establishment of a previous connection. Once the connection is established, BGP moves to the next state.
2 – Connect: In this state, BGP is waiting for the TCP connection to be formed. If the TCP connection completes, BGP will move to the OpenSent stage; if the connection cannot complete, BGP goes to Active
3 – Active: In the Active state, the BGP speaker is attempting to initiate a TCP session with the BGP speaker it wants to peer with. If this can be done, the BGP state goes to OpenSent state.
4 – OpenSent: the BGP speaker is waiting to receive an OPEN message from the remote BGP speaker
5 – OpenConfirm: Once the BGP speaker receives the OPEN message and no error is detected, the BGP speaker sends a KEEPALIVE message to the remote BGP speaker
6 – Established: All of the neighbor negotiations are complete. You will see a number (2 in this case), which tells us the number of prefixes the router has received from a neighbor or peer group.


Memorizing the BGP decision process steps is very useful and you should remember them. The table below lists the complete path selection process:
1. Weight (Bigger is better)
2. Local preference (Bigger is better)
3. Self originated (Locally injected is better than iBGP/eBGP learned)
4. AS-Path (Smaller is better)
5. Origin
6. MED (Smaller is better)
7. External (Prefer eBGP over iBGP)
8. IGP cost (Smaller is better)
9. EBGP Peering (Older is better)
10. Router- ID


There are 4 BGP attribute types:
Well-known Mandatory: recognized by all implementations of BGP and must appear in a BGP update message. If missing, a notification error will be generated.
Well-Known Discretionary: recognized by all implementations of BGP but may not be sent in the BGP update message (include LOCAL_PREF, ATOMIC_AGGREGATOR).
Optional Transitive: may or may not be recognized by all BGP implementations. Because the attribute is transitive, BGP accepts and advertises the attribute even if it is not recognized (include Community attribte).
Optional Nontransitive: may or may not be recognized by all BGP implementations. Whether or not the receiving BGP router recognizes the attribute, it is nontransitive and is not passed along to other BGP peers (include MED).


Which two conditions can cause BGP neighbor establishment to fail?
There is an access list blocking all TCP traffic between the two BGP neighbors.
The BGP neighbor is referencing an incorrect autonomous system number in its neighbor statement.


Use of Static Route in BGP: When two EBGP neighbors want to establish neighbor relationship without using the directly connected interfaces (for example, use loopback interface), they must tell each other how to reach their interfaces. A static route is the most simple way to do this, especially when they are in different ASs.
In BGP, “Connections established” is the number of times a TCP and BGP connection have been successfully established while “dropped” is the number of times that a valid session has failed or been taken down.