cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1281
Views
0
Helpful
4
Replies

BGP MED and Best Path Selection

tomas.grygier84
Level 1
Level 1

Hello guys,

I'm puzzled by example given at http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094431.shtml#bestpath

section: Example: BGP Best Path Selection.

Router R1#show ip bgp vpnv4 rd 1100:1001 10.30.116.0/23
BGP routing table entry for 1100:1001:10.30.116.0/23, version 26765275
Paths: (9 available, best #6, no table)
  Advertised to update-groups:
     1          2          3        
  (65001 64955 65003) 65089, (Received from a RR-client)
    172.16.254.226 (metric 20645) from 172.16.224.236 (172.16.224.236)
      Origin IGP, metric 0, localpref 100, valid, confed-internal
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/362
  (65008 64955 65003) 65089
    172.16.254.226 (metric 20645) from 10.131.123.71 (10.131.123.71)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/362
  (65001 64955 65003) 65089
    172.16.254.226 (metric 20645) from 172.16.216.253 (172.16.216.253)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/362
  (65001 64955 65003) 65089
    172.16.254.226 (metric 20645) from 172.16.216.252 (172.16.216.252)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/362
  (64955 65003) 65089
    172.16.254.226 (metric 20645) from 10.77.255.57 (10.77.255.57)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/362
  (64955 65003) 65089
    172.16.254.226 (metric 20645) from 10.57.255.11 (10.57.255.11)
      Origin IGP, metric 0, localpref 100, valid, confed-external, best
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/362

  (64955 65003) 65089
    172.16.254.226 (metric 20645) from 172.16.224.253 (172.16.224.253)
      Origin IGP, metric 0, localpref 100, valid, confed-internal
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/362
  (65003) 65089
    172.16.254.226 (metric 20645) from 172.16.254.234 (172.16.254.234)
      Origin IGP, metric 0, localpref 100, valid, confed-external
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/362
  65089, (Received from a RR-client)
    172.16.228.226 (metric 20645) from 172.16.228.226 (172.16.228.226)
      Origin IGP, metric 0, localpref 100, valid, confed-internal
      Extended Community: RT:1100:1001
      mpls labels in/out nolabel/278

Example claims that path 1 and 2 have different neigh AS's so MED is being ignored. Then for path 2 and 3 it claims that paths have same neigh AS's so comparing MED.

I agree with statement that 2 and 3 have same neigh AS because confed AS's are not taken into consideration but why it says that path 1 and 2 have different AS's? Any thoughts?

Comparing path 1 with path 2:
Both paths have reachable next hops
Both paths have a WEIGHT of 0
Both paths have a LOCAL_PREF of 100
Both paths are learned
Both paths have AS_PATH length 1
Both paths are of origin IGP
The paths have different neighbor AS's so ignoring MED   <--------
Both paths are internal

   (no distinction is made between confed-internal and confed-external)
Both paths have an IGP metric to the NEXT_HOP of 20645


Path 2 is better than path 1 because it has a lower Router-ID.

Comparing path 2 with path 3:
Both paths have reachable next hops
Both paths have a WEIGHT of 0
Both paths have a LOCAL_PREF of 100
Both paths are learned
Both paths have AS_PATH length 1
Both paths are of origin IGP
Both paths have the same neighbor AS, 65089, so comparing MED.
Both paths have a MED of 0

Both paths are confed-external
Both paths have an IGP metric to the NEXT_HOP of 20645


Path 2 is better than path 3 because it has a lower Router-ID.

Comparing path 2 with path 4:
Both paths have reachable next hops
Both paths have a WEIGHT of 0
Both paths have a LOCAL_PREF of 100
Both paths are learned
Both paths have AS_PATH length 1
Both paths are of origin IGP
Both paths have the same neighbor AS, 65089, so comparing MED.
Both paths have a MED of 0
Both paths are confed-external
Both paths have an IGP metric to the NEXT_HOP of 20645

Thanks in advance for an advise.

Tomas

4 Replies 4

blau grana
Level 7
Level 7

Hello Tomas,

quotation from blog.ine.com ->

Additionally by default MED is not compared between sub-autonomous  systems in a BGP confederation.  To enabled comparison between different  sub-ASes within a confederation use the bgp bestpath med confed router configuration command.

http://blog.ine.com/2011/10/12/understanding-bgp-med-and-bgp-deterministic-med/

Best Regards

Please rate all helpful posts and close solved questions

Best Regards Please rate all helpful posts and close solved questions

I completely agree with you but how would you explain what's written in Cisco example then.

They say that these 2 pathes have different neighboring AS's so MED is not compared.

  (65001 64955 65003) 65089, (Received from a RR-client)

    172.16.254.226 (metric 20645) from 172.16.224.236 (172.16.224.236)

      Origin IGP, metric 0, localpref 100, valid, confed-internal

      Extended Community: RT:1100:1001

      mpls labels in/out nolabel/362

  (65008 64955 65003) 65089

    172.16.254.226 (metric 20645) from 10.131.123.71 (10.131.123.71)

      Origin IGP, metric 0, localpref 100, valid, confed-external

      Extended Community: RT:1100:1001

      mpls labels in/out nolabel/362

But these 2 have the same neighboring AS and that's 65089 thus MED is taken into consideration.

(65008 64955 65003) 65089

    172.16.254.226 (metric 20645) from 10.131.123.71 (10.131.123.71)

      Origin IGP, metric 0, localpref 100, valid, confed-external

      Extended Community: RT:1100:1001

      mpls labels in/out nolabel/362

  (65001 64955 65003) 65089

    172.16.254.226 (metric 20645) from 172.16.216.253 (172.16.216.253)

      Origin IGP, metric 0, localpref 100, valid, confed-external

      Extended Community: RT:1100:1001

      mpls labels in/out nolabel/362

Regards,

Tomas

It would be great if some CCIE or "self-studying guru" could throw some light on this issue. I do not think that on official page will be mistake, but it is possible.

It would be great if they also include configuration or topology, not just BGP table.

Also it seems like BGP configuration is not default, best path was choosen by lowest router ID, but by default last route (#9) should be the best because it is oldest one.

Best Regards

Please rate all helpful posts and close solved questions

Best Regards Please rate all helpful posts and close solved questions

Hi,

IMHO, this looks like an error in the Cisco document.

Here is an output from my lab (nothing special configured, just weight attributes on some routers to create the AS_PATH necessary):

C1841-R3#sh ip bgp 192.168.100.0

BGP routing table entry for 192.168.100.0/24, version 10

Paths: (2 available, best #1, table default)

Advertised to update-groups:

10

(65008) 65098

192.168.11.7 from 192.168.21.5 (200.3.3.3)

Origin incomplete, metric 100, localpref 100, valid, confed-external, best

(65002) 65098, (Received from a RR-client)

192.168.11.7 from 192.168.22.1 (200.1.1.1)

Origin incomplete, metric 200, localpref 100, valid, confed-internal

After changing the MED value:

C1841-R3#sh ip bgp 192.168.100.0

BGP routing table entry for 192.168.100.0/24, version 11

Paths: (2 available, best #2, table default)

Advertised to update-groups:

11

(65008) 65098

192.168.11.7 from 192.168.21.5 (200.3.3.3)

Origin incomplete, metric 100, localpref 100, valid, confed-external

(65002) 65098, (Received from a RR-client)

192.168.11.7 from 192.168.22.1 (200.1.1.1)

Origin incomplete, metric 50, localpref 100, valid, confed-internal, best

     

So I believe in the original Cisco example MED is being compared between path 1 and 2 but due to the same value it does not choose the best path and next steps of the BGP best path selection algorithm have to follow.

Also looking into RFC 5065:

" MEDs of two routes SHOULD only be compared if the first autonomous

systems in the first AS_SEQUENCE in both routes are the same -- i.e.,

skip all the autonomous systems in the AS_CONFED_SET and

AS_CONFED_SEQUENCE. An implementation MAY provide the ability to

configure path selection such that MEDs of two routes are comparable

if the first autonomous systems in the AS_PATHs are the same,

regardless of AS_SEQUENCE or AS_CONFED_SEQUENCE in the AS_PATH.

An implementation MAY compare MEDs received from a Member-AS via

multiple paths. An implementation MAY compare MEDs from different

Member Autonomous Systems of the same confederation."

The later is the "bgp bestpath med confed" command case, I believe.

So IMHO, the Cisco document text should have been:

"Comparing path 1 with path 2:

...

Both paths have the same neighbor AS, 65089, so comparing MED.

Both paths have a MED of 0"

as it is in the "Comparing path 2 with path 3:" case.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: