Top 31 Border Gateway Protocol (BGP) Interview Questions You Must Prepare 19.Mar.2024

Till now we all believe that BGP is having only a single routing table where it used to store the routes and process for the best path calculation. But we all are mistaken here actually BGP maintains three table one for storing incoming routes from neighbours, one for sending the routes to neighbours and one for installing the routes where you actually find the routes with next-hop address. The tables are given below:-

  • Adj-RIB-in
  • Adj-RIB-out
  • Loc-RIB

Adj-RIB-in stores the unprocessed information received from its peers. Here the best path selection occurs as per BGP attributes and after conformation path is entered into the local bgp table i.e Loc-RIB. From the local RIB table it conform the next-hop address if it reachable by IGP then the route is entered into the main routing table. 

Label switching is a discrete mechanism from IP forwarding; here LSR regulates what label function needs to be performed, such as Push, Pop, or Swap, to process a packet throughout the MPLS backbone using label switching.

Push: Add a label
Pop: Remove a label
Swap: Exchange/ replace a label

The router looks up the BGP route and the next hop to reach a destination in the remote AS. Then the router looks up the route to reach the next hop. In this way router has to perform lookup twice to reach to a destination, this process is called recursive lookup.

  1. Idle - The BGP process is either administratively down or waiting for the the next retry attempt.
  2. Connect - The BGP process is waiting for the TCP connection to be completed. If it is successful, it will continue to the OpenSent state. In case it fails, it will continue to the Active state.
  3. Active - BGP will try another TCP three-way handshake to establish a connection with the remote BGP neighbor. If it is successful, it will move to the OpenSent state.
  4. Opensent - The TCP connection exists, and a BGP Open message has been sent to the peer, but the matching Open message has not yet been received from the other router.
  5. Openconfirm - An Open message has been both sent to and received from the other router. Next step is to receive a BGP Keepalive message (to confirm that all neighbor-related parameters match) or a BGP Notification message (to learn that there is some mismatch in neighbor parameters).
  6. Established - All neighbor parameters matched, the neighbor relationship has been established and the peers can now exchange Update messages

This is one of the most common questions asked during the MPLS interviews, so this question must be prepared for before facing the interview. Here you should start wering by introducing MPLS.

Multiprotocol label switching (MPLS) offer a mechanism to process packets on the basis of labels. It is a data forwarding service that provides high-end network communications from one network node to the next on the basis of labels rather than routing table lookups. Routing table lookup for each packet makes communication sluggish but MPLS uses LFIB/forwarding table to process label from one node to another.

The main benefits of using MPLS are:

  • QoS integration: supports multiple levels of QoS, to manage latency, jitter and packet loss for various types of traffic (voice, video, email, bulk file trfers, etc.)
  • Fast convergence: label-based switching, no need to look up routing tables
  • Scalability to IP VPNs
  • Low network congestion using MPLS TE
  • Reliable and secure

Border Gateway Protocol advertises, learns and chooses the best paths inside the global Internet. When two ISPs connect, they typically use BGP to exchange routing information. Enterprises also sometimes uses BGP to exchange routing information with ISPs, allowing the Enterprise routers to learn Internet routes. when we have multiple Internet connections and we want to influence some packets to take one path and some packets to take another we use BGP.

BGP uses two mechanism to prevent loops:-

  1. When a router learns routes from an iBGP peer, that router does not advertise the same routes to another iBGP peer.
  2. By using AS_PATH - When advertising to an eBGP peer, a BGP router adds its own ASN to the AS_PATH. If a BGP router receives an update and the route advertisement lists an AS_PATH with its own ASN, the router ignores that route.

Note - A BGP router does not add its ASN when advertising to an iBGP peer.

The Local Preference attribute is to influence your own AS how to get or exit to another AS. MED is to influence other AS how to enter your own AS.

The weight attribute is a Cisco proprietary attribute that is used in the path selection process when there is more than one route to the same destination. A path with the Higher weight value is preferred. The default value for weight is @The weight attribute is local to the router and is not propagated to any BGP peers. Weight attribute is set by a router when receiving Updates influencing that one router’s route for a prefix.

# neighbor neighbor-ip shutdown

# no neighbor neighbor-ip shutdown (to enable it again)

In BGP, route learned from an iBGP neighbor will not be advertised to another iBGP neighbor. To overcome this situation route reflector is used. It acts as a route reflector server and makes IBGP neighbors as route reflector clients enabling route advertisements between them.

The difference between two is almost like RIB and FIB, as RIB uses FIB to forward traffic. Label Information Base (LIB) is a table where prefix to label bindings are built and stored in the control plane and can be seen with “show mpls ldp bindings.” Label Forwarding Information Base (LFIB) is another MPLS table used to forward label packets throughout the MPLS network and build in the data plane. To check LFIB, run “show mpls forwarding-table.” The lookups are in fact done in the LFIB, not the LIB.

If CEF is disabled, MPLS will not work, as it uses LFIB to forward labeled packets and LFIB built from the FIB table.

In iBGP, neighborship is formed between routers within the same AS (autonomous system) whereas in eBGP, neighborship is formed between routers within different AS.

BGP has multiple path attributes to influencing traffic flow. In the most common practice we do manipulate incoming traffic using AS-Path prepending and MED (multi-exit discriminator). And, to influence outgoing traffic, weight and local preference are the best choices.

BGP recursive lookup involves the router looking up the BGP route and BGP next hop to reach a destination in the remote AS. Then the router will look up the route into IGP to reach the BGP next hop. This mechanism is known as BGP recursive lookup.

BGP site of origin (SoO) is a loop prevention technique in the MPLS backbone environment. BGP SoO is associated with a CE-neighbor; that’s why whenever the PE router advertise a prefix to a CE neighbor, it check the SoO of the prefix with the SoO of the BGP neighbor to avoid loops.

Route distinguisher (RD) is used to distinguish identical routes in different VRFs, whereas route target (RT) is used to share routes between them. Route target also specifies which prefixes get imported or exported on the PE router.

No, we can’t assign same RD to multiple customers on a PE router because the main purpose of defining RD is limited to provide uniqueness in different VRFs.

BGP communities are commonly used to control route policies in the BGP environment and used as flags in order to mark it over the set of network prefixes. BGP communities’ information can be shared with a neighbor by using the command “neighbor x.x.x.x send-community standard | extended | both” and can be applied using route-maps to a defined neighbor. Some well-known BGP communities are:

Local-AS: Share the prefixes with iBGP-confederation peers only.

No-Advertise: Do not share the prefixes with anyone.

No-Export: Do not share the prefixes with another Global AS, share within the Public-AS only.

Internet: Share the prefixes with all.

BGP supports a wide variety of Path Attributes. BGP use these path attributes to examine the competing BGP paths (routes) in BGP table to choose the best path(route).

  1. Next Hop - It lists the next-hop IP address used to reach a prefix. If Next hop is reachable? If no route to reach Next Hop, router cannot use this route.
  2. Weight - It is a numeric value set by a router when receiving updates to influence the route for a prefix. It is not advertised to any BGP peers. Bigger is preferred
  3. Local Preference - It is a numeric value set and communicated within a single AS for the purpose of choosing best route for all routers in that AS to reach a certain network. Bigger is preferred
  4. Locally injected routes - Locally injected routes (routes injected using network command) are better than iBGP/eBGP learned.
  5. AS Path - It is the number of ASNs in the AS Path. Smaller is preferred.
  6. Origin - Preferred I over E & E over ?. It implies that the route was injected into BGP as I (IGP), E (EGP) or ? (incomplete information).
  7. Multi-Exit Discriminator (MED) - Allows an AS to tell a neighboring AS the best path to forward packets into the first AS. Smaller is preferred.
  8. Neighbor type - eBGP is preferred over iBGP.
  9. IGP metric - Route with nearest IGP neighbor (lowest IGP metric) is preferred.
  10. @eBGP route - Oldest (longest known) route is preferred.
  11. Neighbor Router ID - Lowest is preferred.
  12. Neighbor IP address - Lowest is preferred.

In case of hard reset the local router brings down the neighborship, brings down the underlying TCP connection and all the BGP table entries learned from that neighbor are removed. #clear ip bgp * In case of soft reset, the router does not bring down the BGP neighborship or the underlying TCP connection. However, the local router resends outgoing Updates and reprocesses incoming Updates adjusting the BGP table based on the current configuration. #clear ip bgp * soft command is used for soft reset.

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. By default value for local preference is 100 and can be changed manually. Unlike the weight attribute, which is only relevant to the local router, local preference attribute is communicated throughout a single AS for the purpose of influencing the choice of best path to exit the AS.

BGP does not require neighbors to be attached to the same subnet. Instead, BGP routers use a TCP connection between the routers to pass BGP messages allowing neighboring routers to be on the same or different subnet.

The purpose of MED is to influence how other autonomous systems enters into your AS to reach a certain prefix. BGP MED is an attribute which is not propagated throughout the whole network but just to adjacent AS. The lower the MED the more the path will be preferred.

Address-family VPNv4 is used to trport VRF traffic, which is quite heavier (96 bits) than normal IPv4 packets, and address-family IPv4 is used to trport traditional 32-bit IPv4 packets. When we deploy L3VPN, we need VPNv4 peering between the PEs to take the VRF routes (labeled with RD, RT) to the corresponding destination PE router.

  1. Open - It is Used to establish a neighbor relationship and exchange parameters, including autonomous system number and authentication values.
  2. Keepalive - It is Sent periodically to maintain the neighbor relationship. If the Keepalive message is not received within the negotiated Hold timer than BGP neighborship will be turned down.
  3. Update - It exchanges Path Attributes and the associated prefix/length (NLRI) that use those attributes.
  4. Notification - It is Used to report BGP error. It results in a reset of neighbor relationship.

Any Trport over MPLS (AToM) enables service providers to deliver Layer 2 connectivity over a MPLS backbone to connect different clients’ sites with existing data link layer (Layer 2) networks. BGP-VPN or VRF is not required to configure AToM; to form AToM connectivity we do use xconnect (cross connect) peering with unique VC-ID to distinguish multiple clients.

This happens when we configure BGP on a router that has non-IP interfaces, meaning that if a router’s interfaces are not configured with any IP address, then BGP cannot get the router-id. In that case, BGP assumes 0.0.0.0 as router-id.

If BGP peer is in idle state, then it could be due to physical connectivity failure or the neighbor is not defined properly with respective AS. In connect state, BGP tries to establish a TCP session over port number 179; if it fails to establish the connection, then it goes to active state, where it tries again to establish a TCP connection. By using “debug ip bgp” and “debug ip tcp tractions” commands, we can learn the exact cause of TCP connection failure. Lack of the “update-source” or “ebgp-multihop” command can also be a reason of neighbor active state.

This rule states, “Network prefixes learned from an iBGP peer will not be shared with another iBGP peer” to prevent routing loops. BGP uses the AS_PATH attribute to avoid routing loops, which me a route will not be accepted if the AS_PATH contains the same AS number of the router where it is receiving. Route-reflector and confederation techniques are used to share iBGP learned networks with another iBGP neighbor.

BGP uses TCP port 179 for the connection.