How to Configure BGP Weight Attribute

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

You have to learn the exact same prefix through BGP.

Hi Rene,

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

Regards,
Ajay

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).

1 Like

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

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).
1 Like

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

1 Like

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

Thanks Rene. its clear now.

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

Thanks,
Sid

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.

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?

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.

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

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

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.

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.

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

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,

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

Thanks Laz, But on the diagram we have loopbacks on both R2 and R3 of 2.2.2.0/24 so as per the Router Id election process surely the router id of both R2 and R3 should be 2.2.2.2 ?

Thanks