Unlike IGP, BGP's operational model is quite different, IGPs operate within an autonomous system and EGPs operate between autonomous systems. BGP is used to exchange routing information for the Internet and is the protocol used mainly between Internet service providers (ISP) . On the other hand, BGP is also commonly used by enterprise who require redundancy and load balancing for the networks its advertising to the outside world, for enterprise customer there primary reason to employ BGP is to avoid single point of failures, should one ISP fail, the networks hosted by that enterprise will still be reachable from the secondary ISP.
There are four connection redundancy types commonly referenced in BGP, Single-homed, Dual-homed, Multi-homed and Dual-multi-homed.
There is no point in using BGP if a customer has only one exit point out of their network, only a single connection to the Internet or another autonomous system will achieve neither redundancy nor load balancing, one of the most common configuration with enterprise's and small ISP's is the multi homing configuration, keeping in mind what we discussed above, BGP can be configured in 3 different styles, default routes, partial routes and full routes.
So what are these default, partial and full routes? If an organization has determined that it will perform multi-homing with BGP, there are three ways to do this, default routes are used by customer who do not require BGP for path manipulation or do not wish to become a transit AS.
Second in line is the partial updates +default routes, meaning each ISP passes only a default route and provider-owned specific routes to the customers AS,
The last in line is the full routing table, the entire internet routing table will be exchanged by the ISP with the customers AS, this option is beneficial for enterprise/ ISP's who requires more granular control on path manipulation and bandwidth manipulation.
So far we have discussed the need/use of BGP and common deployment scenarios, now we will discuss BGP neighbor relationship formation and the algorithm it uses to formulate the best path.
BGP neighbor formation starts by two BGP speakers forming a TCP connection (using port 179). Each side sends an OPEN message. An OPEN message contains parameters needed for the BGP connection,
A KEEPALIVE message is then sent to confirm the connection. UPDATE messages are then sent between the BGP speakers to exchange routing information. UPDATE messages contain the path attributes used to make routing decisions.
It is important to understand that when BGP is running between routers in different AS it is called EBGP and BGP running between routers in the same AS it is called IBGP,
It is also important to note that IBGP implementation / configuration requirements differ depending on each customer needs, customers running a transit AS must make sure that all routers in a transit AS have complete knowledge of external routes; this can be done by re-distributing BGP routes into IGP (not recommended) or by configuring a full mesh IBGP network.
It’s time we discuss one important rule, BGP synchronization, the rule states that do not use or advertise a route learned via IBGP until the same route has been learned from IGP also!!
What this means is even if you had a full mesh IBGP topology, in which case you do not need IGP in the first place to re-distribute routes , if Synchronization is turned on, routes from IBGP peers will not be learned or advertise.
So in order to make a fully meshed IBGP topology work, you will need to disable BGP synchronization.
Synchronization was originally intended if there were a small enough number of BGP routes so that they could be redistributed into an IGP running in an autonomous system, IBGP would not be needed in every router in the transit path. However, synchronization would be needed to make sure that packets did not get lost.
So how do path attributes and router maps help in the Route-Selection Decision Process?
As we discussed earlier, update messages contain the path attributes used to make routing decisions, multiple paths might exist to reach a given network. The BGP selection process eliminates multiple paths until a single best path is left. However using default settings for path selection, BGP might cause uneven use of bandwidth; this is where router maps can be useful. In BGP, router maps are specifically used to control which routes are allowed to flow into and out of the BGP process, this is done by assigning a route map to a specific BGP session, in addition router maps can be used to manipulate path attributes as well as filtering routes,
Path attributes fall into four categories:
Well-known mandatory attributes
· AS-path
· Next hop
· Origin
Well-known discretionary attributes
· Local preference
· Atomic aggregate
Optional transitive attributes
· Aggregator
· Community
Optional non-transitive attribute
· Multiexit-discriminator (MED)
From the above we will discuss some key attributes that can be used to control traffic flow,
Weight:
Cisco Proprietary
Cisco Proprietary
The Next Hop Attribute
BGP uses the hop count method to calculate its paths, similar to RIP, the difference being instead of routers it uses autonomous systems as its hop counts. It uses the next hop attribute (which has the next hop IP address) to reach a destination, one important thing to note here is when a routes are passed between iBGP peers, next-hop processing is NOT done, meaning these routes will not populate in the routing table as they will not be considered “best routes” in the BGP table, this is another example where route maps are useful, you can configure “ip next-hop” setting in a route map which will prevent this issue.
Local Pref
Local pref are exchanged by BGP speakers between each other within its own AS, it is used to influence how traffic will flow from one AS to another when multiple paths exist, routes with higher local preferences are used by BGP speakers, if multiple routes have the same preference, it uses the route that was originated by the local router, a router map can be used to change local preference of paths for better load balancing should the need arise.
As Path
The AS-path identifies all autonomous that a route has traversed to reach a destination. it attaches its own AS number to the beginning of the AS_PATH when a BGP speaker forwards routing information to a peer in a separate AS, in the tie breaking process of best route selection, path with the shortest AS-Path is preferred.
Origin
It simply defines the origin of the path, there are 3 types, IGB, EGP and incomplete, incomplete means the route origin is unknown, In the tie breaking process, if length of the AS path is the same, it uses the path with the lowest origin code (IGP < EGP < incomplete).
MED
When there are multiple exit/entry points for the same neighboring AS, MED is used to, Unlike local preference, the MED is exchanged between AS, lower MED is given preference over higher one. In the tie breaking process, if all origin codes are the same, BGP prefers the path with the lowest MED.
Thanks
Huzeifa Bhai