BGP Weight Attribute




Before we start the lab let's see the BGP path selection process


If the path specifies a next hop that is inaccessible, drop the update.
•Prefer the path with the highest weight.
•If the weights are the same, prefer the path with the largest local preference.
•If the local preferences are the same, prefer the path that was originated by BGP running on this router.
•If no route was originated, prefer the route that has the shortest AS_path.
•If all paths have the same AS_path length, prefer the path with the lowest origin code (where IGP is lower than EGP, and EGP is lower than incomplete).
•If the origin codes are the same, prefer the path with the lowest MED attribute.
•If the paths have the same MED, prefer the external path over the internal path.
•If the paths are still the same, prefer the path through the closest IGP neighbor.
•Prefer the path with the lowest IP address, as specified by the BGP router ID.
I read this on CCIE Pursuit blog
We Love Oranges As Orange Means Pure Refreshment
1- Weight (higher is better)
2- Local Preference (higher is better)
3- Origin ( local originate)
4- As (shortest AS_Path)
5- Origin Code (lower where IGP<EGP<Incomplete)
6- MED (lower is better)
7- Paths ( External preferred over Internal)
8- Router-ID ( lowest)
Now Let’s see how we would use local preference  to influence our inbound traffic

weight is Cisco proprietary attribute so you don't see in other vendors routers
weight is checked first in Cisco routers for best path selection
higher value is preferred over lower ones
weight attribute is only local to the router it is configured on and never passed on to any other BGP neighbors
weight can be configured per neighbor or per prefix  to manipulate or outbound traffic for that neighbor or prefix
in the above topolgy, we have full mesh peers between the four routers
R1 and R2 are  in AS 100
R3 and R4 are in AS 200
R3 advertise these prefixes 3.3.0.0/24 and 3.3.1.0/24 into BGP 
R4 advertise these prefixes 4.4.0.0/24 and 4.4.1.0/24 into BGP 
Task 1:
using weight attribute configure R1 to use R4 to reach all prefixes generated into AS 200 
before we configure anything, let's check the BGP routing table on R1

image
As we can see R1 is using R3 to reach 3.3.0.0/24 and 3.3.1.0/24 and R4 to reach 4.4.0.0/24 and 4.4.1.0/24
so let’s what happens when we use weight attribute on R1
on R1
router bgp 100
neighbor 10.1.14.4 weight 1000
image
as we can see a weight of 1000 has been assigned to all routes received from R4
so what  about R2? was it affected be the weight assigned on R1
image
as we can see the weight values have not been passed on to R2 and from R2 perspective BGP routing table has not been affected
Task 2:
remove the configuration from previous task
using weight attribute, configure R1 to use R4 to reach 3.3.3.0/24 subnet, the configuration shouldn’t  affect any other routes originated from R3
To solve this task, we will match the prefix using extended list ( yes we can do that, but note the syntax of the access-list)
R1#sh access-lists 101
Extended IP access list 101
    10 permit ip 3.3.0.0 0.0.0.255 255.255.255.0 0.0.0.255 (1 match)
we then match the access-list with route-map
image

note you need to add another entry with higher sequence number otherwise all other routes not matched by access-list 101 will be denied since route-maps have implicit deny
we then apply the route-map inbound to that neighbor under BGP configuration of R1
router bgp 100
no synchronization
bgp log-neighbor-changes
neighbor 10.1.14.4 remote-as 200
neighbor 10.1.14.4 route-map WEIGHT_R3 in
now let’s check the BGP routing table on R1
image
as expected R1 is now assigning weight value of 1000 to the prefix 3.3.0.0/24 and using R4 to reach it while other prefixes like 3.3.1.0/24 was not affected













Comments

Popular posts from this blog

BPDU Filter vs BPDU Guard

OSPF–Point To Multipoint Non-Broadcast