Today…we learn about how to change path the packets travel in BGP environment, in IGP such as OSPF…we can modify the metric or even Administrative Distance (AD)
In BGP we call them Path Attributes…
Some say…Path Attributes in BGP is like Metric in IGP Analogy, Some say…Path Attribute is different at all
All we know is…He’s Called THE STIG !!!
The design we throughout the article is like this
Hey…in R1 and R2 we use network command, but in R3 we use redistribute connected ?!?
I just want to show you that both command function do the same effect…advertise route
But the difference is..Network command do advertise route that we exactly want to advertise
But in redistribute connected, ALL OF CONNECTED ROUTE will be advertised
So which is better ?! of course network command, redistribute make router do processing alot more
Remember, redistribute command is used when we want to “join” different routing protocols right ?!?
BGP Route Change with Path Attibute called “WEIGHT”
See the BGP Theory (warning: in Indonesian Language/Bahasa) for the list of BGP Path Attributes
When we see the picture above, AS 1 want to sent packet to AS 3…It send directly to AS 3 (22.214.171.124 – R3)
But lets change it, we want to sent packet to AS 2 first, and then to AS 3
- We using route-map for setting weight value
- Default Weight value is ZERO(0)..just check in show ip bgp, and the weight value is defined on Cisco Router only
- ALWAYS USE route-map in for weight (because we want to “weighten” the inbound interface which is affecting the outbound connection)
- And then clear ip bgp peering first to see the effect
Lets trace it
Done…the packet sent to R2 (126.96.36.199) first, and then to AS 3
Note: why do we have to input trace [ip] source [ip] ?!?
Because if we just trace without defining which interface ip we use, default interface to send is physical one first
Now lets check in R3…is there any route to 188.8.131.52 ?!?
Thats why we can’t ping/trace without mentioning the source ip, because when we configure BGP, we not advertising 184.108.40.206 (using network command) to BGP right ?!?
BGP Route Change with Path Attibute called “MED”, ” Local Pref”, and AS PATH”
It is the same like weight configuration, just differ in route-map
- In MED (Multi Exit Discriminator), the lowest one is preferred
- In Weight and Local Pref, the Heaviest value is preferred
Choosing best route via AS Path
- AS 1 send packet to AS 3 directly, from AS 1-to-AS 3 (1 -> 3), how do we change it to send via AS 1-to-AS 2-to-AS 3 (1 -> 2 -> 3) ?!?
- Prepend it !!! (make it longer)…the longer the path, the most unreliable to send packet
Lets see the example:
- from the value ?!? just look at the next hop AS path…after AS 1…to AS 3….isn’t it obvious it will choose the second path ?!?
- So thats why I’m typing prepend 3 3 3 3 3 (just to make that route longer to read literally, BGP doest read the VALUE of number for AS_PATH selection eventhough the next-hop AS Path is number 3)
Lets check it…
See…the best path to 220.127.116.11 now to R2 then to R3
But we see the 18.104.22.168 and 22.214.171.124 in the show ip bgp 126.96.36.199 also get the same effect, isn’t it dangerous ?!? yes..
Thats why we use another route-map for filtering which AS_PATH get the prepend
now only route 188.8.131.52 that get the prepend effect
Note for BGP MED and Local Pref:
When Local ISP choose the best path/route to another ISP, they use Local Pref
But when Another ISP want to send packet to Local ISP, local ISP can use MED to select which door/route that Allowed for Another ISP
You can say “traffic from Indonesia goes to Singapore first before entering China” (Local Pref, configured in Indonesia)
“but traffic from China to Indonesia only accepted if travel to Malaysia first before entering Indonesia” (MED, configured in Indonesia)
we can force to use MED by typing bgp always-compare-med and bgp deterministic-med in router bgp [as] sub-config
Choosing best route via Origin
when the next hop AS Path is same from all direction to destination, BGP choose Origin attribute
Origin means “where this AS Path originally came from”
take a look at this pic
just look at the origin status code…BGP prefer path from i-BGP > e-BGP > incomplete
take a look at the new design I draw here…
R1 want to send packet to 184.108.40.206 in R4
here is the initial configuration (just change the respectives IP in R2, R3, R4)
from show ip bgp, we know that if R1 want to send packet to 220.127.116.11, He had two options…using AS 2 Route…,or using AS 3 route
which way does R1 take ?!?
now we trace it…
why R1 choose AS 2 ?!? because of BGP behavior that cannot perform load balancing, the first one that enter R1 routing table…that is the primary route (I’m configuring AS 2 right after AS 1 configuration is done, thats why R1 choose AS 2)
now lets change the BGP Attribute called ORIGIN, lets change AS 2 route become “incomplete” (incomplete means this route came from something others than BGP, such as Redistribution)
- because AS 2 came from 18.104.22.168 (R2), I use route-map in this neighbor
- and to forbid anoher network get the “incomplete” status, i’m filtering them using ACL
let see the effect
done…now R1 route to 22.214.171.124 si via AS 3
remember the rules… i-bgp > e-bgp >incomplete (?)
let see if I change AS 2 path to e-bgp origin
it still chooes AS 3 over AS 2
BGP Route Selection Process in brief:
1. Weight (Cisco Only)
2. Local Preference
5. MED (if all of the above requirement is same value)
next…advanced BGP (Insya Allah)