How to Configure BGP Weight Attribute

This topic is to discuss the following lesson:

1 Like

In AS 2 you have named but nowwhere you have configured jim…you have configured JACK …in the second Diagram consisting of 3 routers you have named them James , jim , john…should i assume jim as Jack?..Excellent explanation by the way …

Thanks Master.

Rene,
Great lesson however, I have questions if we have two ISPs and we would like to route traffic out through ISP-1. It means we need to set up a higher weight on the ISP-1 peering with us and setup a lower weight on the second ISP-2?
How can we make sure traffic goes out ISP-1 and comes back in using ISP-2?
Thanks

Hamood

Hi Hamood,

That’s right, you can use weight to select the path but this is only for the local router. If you want to influence your entire AS then you’ll have to use local preference:

https://networklessons.com/bgp/how-to-configure-bgp-local-preference-attribute/

To influence how traffic enters our AS we have a couple of methods, the first one is MED:

https://networklessons.com/bgp/how-to-configure-bgp-med-attribute/

This is only useful when you are multihomed to a single ISP. These two methods will help if you are multihomed to different ISPs:

https://networklessons.com/bgp/how-to-configure-bgp-as-path-prepending/

https://networklessons.com/bgp/bgp-communities-explained/

Hope this helps!

Rene

Hi Renee,
Great lesson but I would like to make one suggestion. I find it easier to follow when you name routers R1, R2, R3 instead of using name like Jack, Jon, James etc. I find names harder to keep straight in my head. Just my opinion.

Thanks for all the cool Lessons.

1 Like

Hi Brian,

I totally agree, this was one of my older articles. Nowadays I always use numbers for devices…R1,R2, SW1,SW2, ASA1, ASA2, etc.

Rene

1 Like

Dear Rene,

By using Weight, we are telling traffic to go out from our specified local router, but what about the traffic that will come in towards our local router? Will it use that same path i.e. a path with higher weight for our inbound traffic ?

Also explain what attribute should be used for Inbound/Outbound traffic and both.

Thx

Hi Muhammad,

Weight is only for the local router, for traffic that enters our AS we use MED and for traffic that exits our AS we use local preference. Take a look at these posts:

https://networklessons.com/bgp/how-to-configure-bgp-med-attribute/

https://networklessons.com/bgp/how-to-configure-bgp-local-preference-attribute/

Rene

Hi Ajith,

I just changed the pictures and names of the routers, it should be correct now.

Rene

Hi Rene,
I have seen some articles regarding to how bgp attributes influence the traffic. There is a table for summary.
For influence the traffic out of the AS we use local preference inbound, is it possible for you to summary which attribute should be inbound and which should be outbound?
I assume the table should be like this? Correct me if I am wrong
attribute inbound(config) influencetraffic
local preference inbound outbound
Med outbound inbound
As prepend outbound inbound
and so on

Hi Jie,

Let me give you an overview:

  • Local preference: is propagated throughout the local AS so typically used inbound when we receive eBGP prefixes.
  • MED: sent to neighbor ASes so used outbound.
  • AS Path prepend: normally sent to neighbor ASes so used outbound.

Rene

Hi Rene,

Off topic, I don’t see topic conditional advertisement. Will you be adding this in future?

thanks in advance.

KR
Zeeshan

Hi Zeeshan,

For sure, I’ll add it to my list.

Rene

Nicholas,
I don’t think this is possible. By default, Weight has a value of 0. Additionally, it is significant only to the local router. This means that a non-zero weight has to be set explicitly on the router in question, so its a little odd to have Cisco then ignore this value. This is why I suspect this isn’t possible.

It might be possible to write a Route-Map that considers the AS-Path and then assigns a weight based on that, but strictly speaking that isn’t what you are asking since Weight is still determining the best path.

Hi Rene , To influence outgoing route we are using Weight and Local Preference . Aside from the fact that Weight is Cisco proprietary , what else would weight differ to local preference in terms of route propagation within the Autonomous System?

Venus,
One key difference between Weight and Local Preference is that Weight is only locally significant to the router. This means that its value is not carried within advertisements to any other neighbor. For this reason, it is rarely used in practice.

Local Preference is shared among all other routers within the same AS, so it is much more useful for outbound path selection (you only have to configured once–at the route’s ingress point to your AS).

1 Like

Just to be clear, longest path still wins right? I assume this only comes into play if we have two paths to the exact same prefix.

Hi William,

Weight is the first attribute that is used to determine the best path. Here’s a nice way to remember the attributes, something I found on a blog a long time ago:

“We Love Oranges AS Oranges Mean Pure Refreshment”

W Weight (Highest)
L LOCAL_PREF (Highest)
O Originate (local) routes that are advertise through the “network” command or redistributed from an IGP.
AS AS_PATH (shortest)
O ORIGIN Code (IGP > EGP > Incomplete)
M MED (lowest)
P Paths (External > Internal)
R RID (lowest)

Rene

1 Like

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.