cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
715
Views
4
Helpful
16
Replies

The purpose of BGP cost community

Sam-CCNP
Level 1
Level 1

Hi,

I'm confused as to the reason for the existence of the BGP Cost community.

Surely what it does can be achieved by using path attributes. E.g. weight, if you only want to influence a single router, or local preference if you want to affect the entire AS.

I just do not understand in what scenarios you would want to use it when other options are available.

Thanks in advance for the help.

Sam

1 Accepted Solution

Accepted Solutions

Hi @Sam-CCNP ,

Sorry for initially misreading the question.

If you use pre-bestpath for the point of insertion then doesn't it behave exactly like weight or local-preference?

It actually takes precedence over weight and local preference, making sure that a lower cost is always preferred.  Also bear in mind that weight is Cisco proprietary, is not advertised in BGP updates and therefore only used for local selection.

The BGP cost community is used by default when eigrp is used a a PE-CE routing protocol.  Without the cost community (with pre best path point of insertion) the locally redistributed eigrp routes would have with a weight of 32768 and would always be preferred over routes received from the MPLS VPN core via BGP VPNv4. The EIGRP remote routes would therefore never be considered regardless of their cost. 

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

View solution in original post

16 Replies 16

Harold Ritter
Spotlight
Spotlight

Hi @Sam-CCNP ,

The BGP community attribute is a simple way to tag a route or a group of routes. This community can later be acted upon by routers in local or remote autonomous systems. It simplifies the BGP routing policy as different policies can be applied to communities instead of individual routes.

There is wide variety of scenarios where the community attribute can be useful.

The mutual redistribution scenario is one of them. You could for instance redistribute IGP routes in BGP and tag the redistributed routes with a specific community. When redistributing BGP prefixes back in the IGP, you would check the community and reject the prefixes matching the community previously set. You would use a tag on the IGP side to achieve the same.

Here's another scenario. Some ISPs allow you to influence the routing policy apply to the prefixes they received from you based on predetermined community values. They normally publish the said community values and the respective expected behaviors on their web site.

Those are just two scenarios, although many more are possible.

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Hi Harold,

Thanks for responding.

It's specifically the cost community that I am confused by the existence of, not communities in general.

If you use pre-bestpath for the point of insertion then doesn't it behave exactly like weight or local-preference? The igp option I now understand, because the tie breakers after IGP metric offer a 'less easy' way to control which path is selected.

Your previous answer here made sense: https://community.cisco.com/t5/routing/bgp-cost-community-and-point-of-insertion/td-p/1065542.

Thanks.

Sam

Hi @Sam-CCNP ,

Sorry for initially misreading the question.

If you use pre-bestpath for the point of insertion then doesn't it behave exactly like weight or local-preference?

It actually takes precedence over weight and local preference, making sure that a lower cost is always preferred.  Also bear in mind that weight is Cisco proprietary, is not advertised in BGP updates and therefore only used for local selection.

The BGP cost community is used by default when eigrp is used a a PE-CE routing protocol.  Without the cost community (with pre best path point of insertion) the locally redistributed eigrp routes would have with a weight of 32768 and would always be preferred over routes received from the MPLS VPN core via BGP VPNv4. The EIGRP remote routes would therefore never be considered regardless of their cost. 

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Hi @Harold Ritter ,

On the surface, if the cost community is not included as an NLRI path attribute it would appear to have the same affect as weight, and if it is included (using neighbor send-community extended) it would act like local-preference. Both of which are #1 and #2 on the best patch algorithm anyway.

I am not familiar with MPLS VPN BGP (yet) and but you brief explanation appears to justify its existence and I will look into it.

Thanks very much for the explanation.

Sam

Cost community not use directly (not directly use as best path criteria)' you need Route-map to influence the path.

MHM

 

Hi @MHM Cisco World ,

I am not sure what you are referring to, but the cost community is taken in consideration and included in the BGP best path selection process by default depending on the OS. With IOS, the default behavior can be disabled with the following command; "bgp bestpath cost-community ignore".

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

LP and weight and AS-path ...etc. all mandatory attribute is by defualt add.

Cost community need route-map to push this vlaue to other peers.

MHM

Hi @MHM Cisco World 

The cost community is added automatically when eigrp is used as a PE-CE protocol.

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Hi @Sam-CCNP ,

On the surface, if the cost community is not included as an NLRI path attribute it would appear to have the same affect   > as weight

The intent behind the cost community was to actually have something that could override the weight for the scenario I mentioned where eigrp is used as a PE-CE protocol.

You are very welcome and thanks for the feedback.

Regards,
Harold Ritter, CCIE #4168 (EI, SP)

Friend 

Now I know what yoh confuse about 

Let explain 

PE1 connect to PE2 and PE3 via ibgp

PE2 and PE3 advertise same prefix with same path (all same LP AS ...etc.)

PE1 use IGP metric as tie breaker' this IGP is cost between PE1 and PE2/3

But what if PE2 or PE3 have better cost to prefix itself? 

Here cost community come 

It make BGP add cost between BGP peer to prefix into Path att. Make other peer use it to select best path.

So there are two IGP metric (cost)

One between PE's

Other between PE and prefix 

MHM

sdroy
Level 1
Level 1

The BGP Cost Community exists to provide a more granular and flexible way to influence route selection within an autonomous system (AS). Unlike path attributes like weight or local preference, which apply broadly to routes or routers, the BGP Cost Community allows you to assign specific cost values to individual routes. This feature is particularly useful in scenarios where you need to customize route preferences across multiple iBGP peers or confederation members without affecting eBGP peers. It can also help in complex network topologies, such as MPLS VPNs with backdoor links, where fine-tuned control over route selection is essential...

Shuvodip Roy

What you meaning cost community? Can you more elaborate

MHM

Hello
This bgp extended community attribute can be used for bestpath path selection
An example of using this feature would be when you wish to change the route path of a particular prefix/network that bgp has already chosen.

When applied cost community determines 3 values.

  • Point of insertion (POI)  - indicates where the community cost will be compared in the bgp best section process
    it defaults between the igp metric and nexthop (step8) but this can be changed to be either IGP or pre-bestpath 
    My understanding here is settling IGP is the same a not specifying any POI and Pre-bestpath POI apply s the  community cost to be compared as the first step of the bgp best path selection
     
  • Community ID = determines the path preference,  lower numeric ID number preferred , if a tie it refers  to community cost
  • Community cost = determines the path preference,  lower numeric ID number preferred, no number defaults to 2,147,483,7647 

See attached..


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Again dont mention me in your reply.

MHM

Review Cisco Networking for a $25 gift card