How to Configure BGP Weight Attribute

(William K) #22

I get that, but just to be clear… the BGP metrics only come into place if we say have two routes to 192.168.2.0/24.

If we have 192.168.0.0/16 and 192.168.2.0/24 both learned via BGP we will always choose the more specific route.

0 Likes

(Rene Molenaar) #23

Yep that’s right. Those are two different prefixes…

You have to learn the exact same prefix through BGP.

0 Likes

(Ajay Krishna M) #24

Hi Rene,

can you please clarify which Attributes are used for inbound and outbound traffic control.

Regards,
Ajay

0 Likes

(Andrew P) #25

Ajay,
Only AS Path and MED can be used to influence inbound traffic flows from a neighboring AS. Realistically, MED is rarely used (because it is low on the decision tree, and its reach is limited to just your neighbor), so inbound traffic engineering is accomplished via AS-Path pre-pending.

Everything else is in the list controls how traffic leaves your AS (so outbound).

0 Likes

(Ajay Krishna M) #26

So for outbound which is the best attribute we can use.

0 Likes

(Andrew P) #27

The best outbound attribute to use is probably Local Preference. Even though this is considered after Weight, it is a better choice for two reasons:

  1. It is not Cisco proprietary (which Weight is)
  2. It is communicated to all members of your same AS (whereas Weight is locally significant only on the router where it is set).
0 Likes

(Abhishek D) #28

Hi Rene, Great article. i really enjoyed learning this.

what is the use of this :

  1. “route-map SETWEIGHT permit 20” as we are not matching anything with this.

  2. and why we applied route-map inbound and not outbound ?

thankyou

0 Likes

(Rene Molenaar) #29

Hi Abhishek,

The first route-map statement is used to set the weight. The second one is a permit statement without any match parameters, which means everything is matched. This allows us to receive all prefixes without changing their attributes.

Weight is a local value, it is not advertised to any other routers so that’s why you have to change it inbound.

Rene

0 Likes

(Abhishek D) #30

Thanks Rene. its clear now.

0 Likes

(Siddardha A) #31

Hi Rene,
Sorry if its a stupid question. You configured same loopback IP on R2 and R3, wont it cause any error.

Thanks,
Sid

0 Likes

(Andrew P) #32

Siddardha,
In this case it will not because these are loopbacks. In fact using the same IP address on loopback addresses is common practice when doing something called Anycast Routing.

Imagine a scenario where several routers perform the same function (it doesn’t matter what it is). With Anycast, you would have each of these routers use a loopback dedicated for this function, and set all of them to use the same IP address on that loopback. Finally, once you advertise that IP address, you have accomplished two things:

  1. You have redundancy in case the router, or its corresponding network has a problem
  2. You have improved efficiency because someone wanting to use that service will automatically route to the “closest” router to them that is providing it.

By the way, there is a network lesson on how Anycast can be used in regards to Rendezvous-Points if you want to see an example of this.

0 Likes

(Kirti G) #33

Hi rene, this is my que i m asking since i had joined these classes. Appreciate the way u r teaching from basics of networking. I m working for a service provider for internet services but never apply weight attribute in cisco devices, so can we say that our ISP customers are using this?

0 Likes

(Andrew P) #34

Kirti,
I am not sure what you are asking with “can we say that our ISP customers are using this?” If you are asking whether it is possible for you, as the ISP, to detect whether a customer is using a Weight attribute, then the answer is no. Weight has meaning only on the local Cisco router, and its value is not transmitted to any other router. If I have misunderstood your question, please ask it again in a different way.

0 Likes

(Georgi T) #35

Hey Rene
first of thank you for this great post .it was really helpful . I do have a question for you
so what if I had 2 prefixes in R1 and I wanted to advertise one of them with through R2 and other one with R3 .how would you configure the router ?
this was actually a job interview question .

I would be appreciate if you could help me with that

thanks again

0 Likes

(Rene Molenaar) #36

Hello Georgi,

This is easy to achieve with route-maps attached to neighbors:

R1(config)#router bgp 1
R1(config-router)#neighbor 192.168.12.2 remote-as 2
R1(config-router)#neighbor 192.168.13.3 remote-as 3
R1(config-router)#neighbor 192.168.12.2 route-map ADVERTISE_TO_R2 out
R1(config-router)#neighbor 192.168.13.3 route-map ADVERTISE_TO_R3 out

R1(config)#route-map ADVERTISE_TO_R2 permit 10
R1(config-route-map)#match ip address L0

R1(config)#route-map ADVERTISE_TO_R3 permit 10
R1(config-route-map)#match ip address L1

R1_L0 and R1_L1 are access-lists. You can also create a route-map that denies some prefixes and permits everything else.

Rene

0 Likes

(Sean C) #37

I want to deny redistribution to the same networks that I’m weighting. Can I use the same ACL on two diffrent route-maps or do the names have to be unique? Thanks.

0 Likes

(Andrew P) #38

Sean,
Technically, you can absolutely reference the same ACL in multiple route-maps. Personally, I don’t do this, but only for easy of management. For example, if I were doing redistribution, I would have a route-map for that, named something like RM_REDIST that would reference an ACL dedicated for that purpose, named something like ACL_REDIST. This way, it is easy to figure out what components go together.

Again, there is no technical prohibition from doing what you are saying, though.

0 Likes

(Shantel - Networklessons.com) split this topic #39

19 posts were merged into an existing topic: How to Configure BGP Weight Attribute

0 Likes

(Lee M) #40

Hi Rene, Just a quick question, In Bgp Weight attribute lab you said that R1 will reach 2.2.2.0 /24 network through R2 because of the router ID attribute, If it was the router id than surely R1 would have sent traffic to 2.2.2.0/24 via R3 as R1 Router id is 192.168.13.1, … Please advise,

0 Likes

(Lazaros Agapides) #41

Hello Lee

If the weight attribute is not configured, then the router ID attribute is used to determine which path will be chosen. The Router ID attribute is the highest IP address on an active interface of the router with loopback addresses taking preference. So the router IDs of this network are:

R1: 192.168.13.1
R2: 192.168.12.2
R3: 192.168.13.3

Now BGP will always prefer the route that comes from the BGP router with the lowest router ID. Between R2 and R3, R2 has the lowest router ID, thus traffic will be sent via the R2 router.

I hope this has been helpful!

Laz

0 Likes