BGP and BGP Path Attributes –
Typically BGP is an EGP (exterior gateway protocol) category protocol that widely used to connect different AS routing domain.BGP is simple straightforward protocol but it become complex when networks grows and need expertise in BGP implementation while you working in enterprise network environment.
BGP runs over TCP protocol on port 179 and for this point-to-point BGP peer connection and relies on the inherent properties of TCP for session maintenance functions such as acknowledgment, retransmission, and sequencing. BGP Provide flexibility to choose best path over internet by implementing BGP algorithm called BGP Attributes.
BGP Path Attributes –
When we talk about BGP algorithm attributes is a dynamic part of BGP configuration and help in determining the paths to a remote network.
BGP path attributes also influence inbound/outbound traffic management control over the IP route which give control to administrator to help in selection best network route over the internet.
BGP operates several attributes to determine the best path to a destination, some important BGP attributes are described below.
📣 Border Gateway Protocol (BGP) routers normally receive multiple route to a destination. In BGP routing domain BGP attributes are tend to decide that which of the best path would be to install in the IP routing table ,which would be used to traffic forwarding.
BGP Path Categories –
Well-known mandatory – Well known mandatory attributes they must contain and bring in all BGP Update messages. If the attribute does not exist in the update, a notification error message will send and the result peering will be torn down.
Well-known discretionary – Well known discretionary attributes they may or may not be carry in an Update message.
Optional transitive – Optional transitive attributes should accept the Update from it peer even when the peer doesn’t support the attribute and transitive should pass the attribute on to its peers.
Optional non-transitive – Optional non-transitive path attributes disregard the Update if BGP process that does not recognize the attribute.so in this case updates doesn’t advertise the path to its other peers.
BGP Weight Attribute –
Weight attribute is a Cisco proprietary and can be used where only have cisco router in you networking domain. Weight attribute is designated for a best path selection process where highest weight is preferred.
The Weight attribute is also used to manipulate traffic going out of your Autonomous System but this attribute is local to the router on which it is configured and is not exchanged with any IBGP or EBGP peers.
➡ Weight is the first BGP attribute in the list of BGP attributes.
➡ Weight is Cisco proprietary, no available other vendor devices.
➡ Weight Influence the outbound traffic path.
➡ Weight attribute does not exchange between IBGP or EBGP peers.
➡ Weight Attribute Configure in local to the router.
➡ Weight Attribute default value is 32,768 by path router locally originates.
➡ Weight attribute default value is ZERO learn from other neighbors.
➡ Route prefer the path with the highest Weight learning.
Local Preference (LOCAL_PREF) –
BGP attribute LOCAL_PREF used to determine best exit path for an autonomous system. LOCAL_PREF is best BGP algorithm used to Influence the outbound traffic path towards each destination when there are multiple redundant paths via multiple router in an autonomous system.
LOCAL_PREF exchange the preference value with all IBGP routers in the autonomous system and BGP route with the highest local preference value is preferred. BGP LOCAL_PREF attribute is the second BGP attribute.
➡ BGP LOCAL_PREF Influence outbound traffic BGP path.
➡ BGP LOCAL_PREF support all vendor devices.
➡ BGP LOCAL_PREF exchange with all iBGP routers in an autonomous system.
➡ BGP LOCAL_PREF does not exchange between EBGP routers.
➡ BGP LOCAL_PREF is a well-known discretionary BGP attribute.
➡ BGP LOCAL_PREF Default value is 100.
➡ The path with the highest BGP LOCAL_PREF is preferred
BGP Attribute Origin –
BGP ORIGIN path attribute is a well-known mandatory attribute know as legacy attribute of BGP which shows the definition of route information in BGP routing table that how this route is learn from and ORIGIN as one factor in determining the preferred route when it has multiple routes to the same destination.
BGP ORIGIN path attribute specifies following origins as below –
i = the route was inserted into BGP via the interior routing protocol (IGP). Highest preference of the ORIGIN values.
e = the route was received from an external BGP peer (eBGP peer). The route is external to the local network. The second preferred EGP ORIGIN value to IGP.
? = Redistributed route from other source learned by some other means. Incomplete is the lowest-preferred ORIGIN value.
BGP Attribute AS_Path –
BGP AS_PATH is a well-known mandatory attribute that creating AS path map of routing by using AS numbers received from it EBGP neighbor. AS_PATH attribute is like a path-vector routing protocol like RIP protocol which calculate HOP (Here BGP consider one Autonomous System as Hop) to determine the best path to a destination.
BGP router adds it’s own AS number to the AS_PATH sequence when it advertise the update to a neighbor in another AS. AS_PATH attribute can be used to Influence the inbound traffic by manipulating AS path pre-pending.
AS_PATH attribute also provide loop free topology by using AS number in order to reach a destination by using shortest AS sequence path.
➡ BGP AS_PATH is a well-known mandatory attribute
➡ BGP prefers the shortest AS path to reach destination.
➡ BGP AS_PATH provide loop free topology by using AS factor.
➡ BGP AS_PATH can be manipulated by using AS path pre-pending command.
➡ BGP LOCAL_PREF Influence the inbound traffic.
BGP NEXT_HOP Attribute –
NEXT_HOP is a BGP well-known mandatory attribute that describe the next hp IP address of router to reach specific destination those listed in UPDATE message. It is pretty simple to know the EBGP next hop address since EBGP use direct connected peer IP as next hop to advertise updates and reaching to certain destination. By default EBGP neighbor does not change next-hop.
For EBGP, the next hop is always the IP address of the neighbor that can configure neighbor command specifies.
For IBGP the next hop scenario is bit different, IBGP router always relies EBGP router next-hop address is carried the update into the local AS and next hop does not change between iBGP peers. By default iBGP does not change next hop of external routes received from EBGP when it passes to another iBGP peer.
🔔 Let’s see the Example -:
In the above scenario R1 and R2 have iBGP neighborship and R2 and R3 eBGP neighborship.
R2 ‘Exit point’ would be R3 to reach an external Network.R2 sends next-hop attribute update to it IGBP neighbors i.e. R1
R1 will consider exit point to R3, R1 does not install such route because of does not know how to reach next-hop which is R3’s IP . Hence, route is marked as inaccessible.
So, you must use BGP Next hop self to change next hop value (to force change). On R2 if you add next hop self, R2 will use it’s IP as the next-hop when passing route to R1. Now since R1 has route to R2 (directly connected), it will install BGP route in table.
BGP MED Attribute
MED (MULTI_EXIT_DISC) is BGP attribute that used to manipulate the BGP path when there are multiple paths to a destination. BGP MED attribute is an optional nontransitive attribute, MED attributes precisely use to manipulate inbound path on external AS (inter-AS) connection in order to discriminate between multiple exit or entry points to the same AS.MED attribute prefer lower MED value in order to select optimal path.
The MULTI_EXIT_DISC attribute received from a neighboring AS via EBGP, must not be propagated to other external neighboring AS’s.
The purpose of the MED attribute is to select the best path when there are multiple connections path available between two Autonomous Systems in order to select optimal entry point into the local AS, if All other factors are being equal, the exit point with the lower metric SHOULD be preferred.
⚫ MED attributes used to determine best path for inbound traffic.
⚫ MED attribute is an optional nontransitive attribute
⚫ MED attributes value advertise to your neighbors AS router, learn how they should enter your AS.
⚫ MED attributes exchanged between autonomous systems.
⚫ MED attributes with lower value preferred path.
⚫ MED is propagated to all routers within the neighbor AS but not passed along any other autonomous systems.
🔔 Topology Brief –
AS 100 have R1,R2 and R3
AS 200 Have R4 (Remote client Network)
192.168.200.0/24 networks being advertised from behind R4.
EBGP connection Between Routers AS 100 and AS 200 – R1 to R4 (EBGP) and R2 to R4 (EBGP)
IBGP Connection Between (R1 ,R2 and R3)
Next Step – On R4 Configure MED value 25 toward R1 and MED value 50 Value toward R2. Hence, R4 will exchange MED value between R1 and R2.
After receiving MED value, AS 100 will prefer the lower metric coming from R4 (AS 200) and send the traffic to 192.168.200.0/100 through R1.