[c-nsp] Set BGP metric based on nexthop IGP metric

"Rolf Hanßen" nsp at rhanssen.de
Fri Jun 5 10:54:11 EDT 2015


I need a hint regarding a OSPF/BGP setup on some C6500.
I have BGP configured between the loopback IPs of several routers.
Lets say router a and router b advertise x.x.x.x/24 (connected network) to
router c (and d, e...).

Router c now has 2 BGP routes with same attributes (except the nexthop)
and takes the oldest one as far as I see.
sh ip bgp x.x.x.x/24:
    a.a.a.a (metric 20) from a.a.a.a (a.a.a.a)
      Origin IGP, metric 0, localpref 1000, valid, external, best
    b.b.b.b (metric 20) from b.b.b.b (b.b.b.b)
      Origin IGP, metric 0, localpref 1000, valid, external

sh ip route a.a.a.a:
Routing entry for a.a.a.a/32
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward
metric 2000

sh ip route b.b.b.b:
Routing entry for b.b.b.b/32
  Known via "ospf 1", distance 110, metric 20, type extern 2, forward
metric 1000

I would like to know how to bind/link the BGP metric to the forward metric
value and not to 20.
I would like to archieve that the BGP route is equal to the closest router
according to OSPF.
I always thought this would be default behaviour.

My problem with random picking of the route also is that this can cause a
routing loop in some simple cases:
c chooses the route from b and d chooses it from a.
-> loop between c and d.

All I could find that sounds like a solutions is "set metric-type" in the
route map, but this seams to be for route-redistribution only.
I guess anything in the route-map would not help anyway because it is not
processed if something in IGP occurs.

Having the route in OSPF either does not help because the EBGP route is
prefered over the OSPF route (higher administrative distance).
Changing to IBGP isn't a good option in my case, I also want to avoid
configuring manual med/localpref on router c+d.

What is the best practise for such setups?
What do for example providers do that exchange a full table between their
routers that way and do not have those routes in IGP.
Or what did they do before MPLS became popular?

kind regards

More information about the cisco-nsp mailing list