cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
6439
Views
7
Helpful
14
Replies

why "bgp bestpath med missing-as-worst" command does not produce the desired result?

huangpo2005
Level 1
Level 1

Dear all,can anyone tell me why "bgp bestpath med missing-as-worst"  command does not produce the desired result?
And I use GNS3 to do this lab,IOS Version : 12.4(3)
Tks...

Top:
           192.168.12.0/24       192.168.23.0/24
RA(f0/0)-----------(f0/0)RB(s2/0)------------(s2/0)RC
[AS1]                    [AS2]                    [AS3]

Configuration:
*RA*:
A(config-router)#do sh run | b r b
router bgp 1
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 192.168.12.2 remote-as 2
neighbor 192.168.12.2 route-map setmed out
no auto-summary

ip route 1.1.1.0 255.255.255.0 Null0

route-map setmed permit 10
set metric 20

*RB*:
B(config-router)#do sh run | b r b
router bgp 2
no synchronization
bgp always-compare-med
bgp log-neighbor-changes
bgp bestpath med missing-as-worst
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.23.3 remote-as 3
no auto-summary

*RC*:
C(config-router)#do sh run | b r b
router bgp 3
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 192.168.23.2 remote-as 2
no auto-summary

ip route 1.1.1.0 255.255.255.0 Null0


But when I inspect RB's bgp table,it like bellow:

B(config-router)#do sh ip bgp
BGP table version is 2, local router ID is 192.168.23.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.23.3             0                          0  3 i
*                          192.168.12.1            20                         0  1 i

The prefix is assigned a MED value of 0,but it also the best path when i use "bgp bestpath med missing-as-worst" under bgp config mode.... :-(

1 Accepted Solution

Accepted Solutions

Please have a look at the following discussion about setting of MEDs towards an eBGP neighbor:

https://supportforums.cisco.com/thread/343397?tstart=0

Note that BGP MED is set to 0 even if the injected BGP route comes from a connected route.

The first time I came across this MED sending behavior was 5-6 years ago in a service provider image. Routes were injected into BGP with 'network' command and were validated either via OSPF routes or statics to null0. Involuntary sending of MEDs was messing up with the load-balancing between 2 links of our incoming traffic from the same upstream service provider.

Note also that if a route is learned via iBGP, border router removes MED before advertising route to an eBGP peer (i.e. the above comments apply when a route is injected locally into the BGP of a border router and then sent to an eBGP peer).

I don't know what is causing the problem you reported in your latest post. Does this issue last for long or does it change after a while?

p.s. sorry, I edited post because I said 'iBGP' instead of 'eBGP' at some point.

View solution in original post

14 Replies 14

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Haungpo,

you may need to clear the BGP session on RB to see changes in effect

Hope to help

Giuseppe

Mohamed Sobair
Level 7
Level 7

Hi,

From This neigbor  (192.168.23.3) , network 1.1.1.0 should be assigned high metric value. could you please clear the BGP table and come back if its showing the same output.

HTH

Mohamed

huangpo2005
Level 1
Level 1

Thanks!

When after me used the  "bgp bestpath med missing-as-worst" command,I do both "soft"&"hard"  reset the bgp session!  The result was also show like above……

Mohamed Sobair
Level 7
Level 7

Hi,

Strange output indeed,

On Router 1, remove the route-map  with a med of 20 sent to router 2, check the output (BGP table) from router 2 after removing the MED.

HTH

Mohamed

New configuration:

Router(config-router)#do sh run | b r b
RA:

router bgp 1
no synchronization
bgp log-neighbor-changes
network 1.1.1.0 mask 255.255.255.0
neighbor 192.168.12.2 remote-as 2
no auto-summary
ip route 1.1.1.0 255.255.255.0 Null0

RB's bgp table:

Router(config-router)#do sh ip bgp
BGP table version is 2, local router ID is 192.168.23.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*  1.1.1.0/24       192.168.23.3             0                0        3 i
*>                      192.168.12.1             0                0        1 i

Now,BGP select the next hop with lowest RID to the destination!

TKS,Best regards!

Mohamed Sobair
Level 7
Level 7

Let me check it and come back to you later,

Mohamed

Mohamed Sobair
Level 7
Level 7

Hi,

I have labed it up, Although it should produce the desired reult, but its not !!!!

some one might help here,,,

HTH

Mohamed

Hello,

It seems that the recent BGP implementations send a metric of 0 for routes that do not have their metric set explicitely. Have you tried to capture and analyze the traffic on the links between routers? I am sure you will see that actually both R1 and R3 send the route with the MULTI_EXIT_DISC despite only one of them is explicitely configured to do so. I have labbed it up quickly and I have arrived at the same confusion as you until I tried to have a closer look what is going on between the BGP peers.

This makes it logical - one router advertises the network with some higher metric, according to your route-map, the other advertises it with 0. Of course the 0 is more preferred.

Can you have a look at the BGP communication?

Best regards,

Peter

huangpo2005
Level 1
Level 1

Tks all of you!

huangpo2005
Level 1
Level 1

That I found a interesting question:
when I use the "hard" reset on RA(Notice that  not on RB&RC  ),and then show RB's bgp table like bellow:
B(config-router)#do sh ip bgp
BGP table version is 5, local router ID is 192.168.23.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*  1.1.1.0/24       192.168.12.1             0              0         1 i
*>                      192.168.23.3            20             0         3 i
But when i do the same on RB(or RC) latter,RB's bgp table is resume again!

Please have a look at the following discussion about setting of MEDs towards an eBGP neighbor:

https://supportforums.cisco.com/thread/343397?tstart=0

Note that BGP MED is set to 0 even if the injected BGP route comes from a connected route.

The first time I came across this MED sending behavior was 5-6 years ago in a service provider image. Routes were injected into BGP with 'network' command and were validated either via OSPF routes or statics to null0. Involuntary sending of MEDs was messing up with the load-balancing between 2 links of our incoming traffic from the same upstream service provider.

Note also that if a route is learned via iBGP, border router removes MED before advertising route to an eBGP peer (i.e. the above comments apply when a route is injected locally into the BGP of a border router and then sent to an eBGP peer).

I don't know what is causing the problem you reported in your latest post. Does this issue last for long or does it change after a while?

p.s. sorry, I edited post because I said 'iBGP' instead of 'eBGP' at some point.

Tks,marikakis !You are right……

That I use the configuration bellow after your post:

B(config-router)#do sh run | b r b
router bgp 2
no synchronization
bgp always-compare-med
bgp log-neighbor-changes
bgp bestpath med missing-as-worst
neighbor 192.168.12.1 remote-as 1
neighbor 192.168.12.1 route-map setmed1 in
neighbor 192.168.23.3 remote-as 3
neighbor 192.168.23.3 route-map setmed2 in
no auto-summary

route-map setmed2 permit 10
set metric 10

route-map setmed1 permit 10
set metric 0

RB's bgp table is :

B(config-router)#do sh ip bgp
BGP table version is 4, local router ID is 192.168.23.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.23.3            10             0       3 i
*                        192.168.12.1    4294967295        0       1 i

I'v learn more from this discussion! Tks very much,everyone!

H.P.

Best regards!

I know this post is old but I wanted to point out that bgp bestpath med missing-as-worst only sets missing MEDs to infinity.

If show ip bgp displays

   Network          Next Hop            Metric LocPrf Weight Path

*  1.1.1.0/24       192.168.12.1             0              0         1 i

*>                      192.168.23.3            20             0         3 i

Then missing-as-worst accomplishes nothing.  It won't set 0 to infinity

But if it displays

   Network          Next Hop            Metric LocPrf Weight Path

*  1.1.1.0/24       192.168.12.1                            0         1 i

*>                      192.168.23.3            20             0         3 i

then you have a missing MED and you get this

   Network          Next Hop            Metric LocPrf Weight Path

*> 1.1.1.0/24       192.168.23.3            10             0       3 i

*                        192.168.12.1    4294967295        0       1 i

Hard to find info on this behavior so I wanted to post this

Oussama
Level 1
Level 1

This is an expected behavior , The MED is forwarded to the next AS only and not beyond that , therefor if the route originate from a directly attached AS you will see the med ( 0 or an other value ) , if the route originate from an AS that is not directly attached and your neighbor is not configured to forward or manipulate the MED in this case the med will be missing and that is where this command will set the value to 4294967295.

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: