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 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.
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:
AD for iBGP = 200, AD for eBGP = 20.
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:-
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).
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.
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.