Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

BGP routing

Hi guys , I am still new , can anybody help me intrepreting the command . I believe the BGP has been redistributed into OSPF . But what the commands metric-type 1 , means . BGP deterministic-med commands being used , I am not sure , how it works

router ospf 1



area 0 authentication message-digest

redistribute bgp 2 metric-type 1 subnets

passive-interface default

no passive-interface GigabitEthernet0/0

no passive-interface GigabitEthernet0/1

network area 0

network area 0

network area 0

default-information originate


router bgp 2

bgp log-neighbor-changes

bgp deterministic-med

neighbor Test peer-group

neighbor Test remote-as 3

neighbor Test password 7 15330A3F072C39742E35

neighbor Test timers 2 6

neighbor INTERNAL peer-group

neighbor INTERNAL remote-as 2

neighbor INTERNAL password 7 1526052D551E39003107

neighbor INTERNAL update-source Loopback0

neighbor INTERNAL timers 2 6

neighbor peer-group INTERNAL

neighbor peer-group TEST

Please help ....

New Member

Re: BGP routing

In OSPF you have two types of external routes

1) Type 1 (E1) - Metric keeps on incerasing as per the cost.

2) Type 2 (E2) - Metric remains constant

But E1 routes are always preferred over E2.

Enabling bgp deterministic-med removes any temporal dependency of MED-based best path decisions. It ensures that an accurate MED comparison is made across all routes received from the same autonomous system (AS). (Source :

You can also go to and select your cisco IOS software to learn more about the commands and understand what it does.

Re: BGP routing


whenever a redistribution of a routing protocol takes place into OSPF, the Routes are by default E2 routes and assigned a metric/cost of 20. The (metric-type 1) keyword ensures the metric/cost of path toward the ASBR is calculated (Takes into account the metric of each hop from any router toward the ASBR redistributing router).

The command (BGP determenistic-med) is recommended by Cisco, what this command does it will ensure the MED attribute is compared and taken in BGP best path Selection algorithm before the Lowest Origin Code. Source (Internet Routing Architecture) By Sam Halabi.



New Member

Re: BGP routing

Thanks guys for the input . The question is , why do we need to assign metric-type 1 to ensure the metric/cost be calculated . I believe , it will choose , best route with the lowerest cost .

How do i verify , the bgp deterministic command being compared and taken in BGP best path before Lowest Origin Code ..

Re: BGP routing


As a side note, it looks like you are not passing the BGP routes into OSPF as you need the command bgp redistribute-internal under your BGP cli.

You don't necessary need to change the type but by changing the type from the default type 2 to type 1, the cost will increase as it traverses other interfaces within your OSPF domain.

Lets say your have a the network /24 being injected into your OSPF area from two places and you are using type 2, you have not adjusted the metric during the redistribution either. Now you have you have the route in your OSPF database twice with the same cost and therefore it will load balance between them. If you use the type 2, they will have different costs depending on where they are in the network, ie best path wins which is more desirable.

As you know, with bgp deterministic enabled, prefix's from the same AS are grouped and the meds compared, so if you have same prefix more than once in your BGP RIB (show ip bgp), you can check if bgp deterministic is doing it's thing as long as you have got prefix's with metrics set, the default being 0.

If you look at your BGP RIB with the command show ip bgp, you will be able to see which route has been chosen as best, you can also filter by AS by using regexp.

Below is a useful link on the topic


New Member

Re: BGP routing

Hi guys , I have attached the output of :

show ip bgp . It seems that all my internal routes has the same MED . In this case , which part will be taken .

Re: BGP routing

any route with > is the chosen one

all ur route will be used becuase u have one next-hop for each route


Re: BGP routing


Yes the forwarding is based on the least cost, but what differ here is that the total cost from every router is calculated toward the ASBR, why?

The OSPF prefers paths based on the following:

1) The Intra Area route (Always preferred 1st).

2) The Inter Area Routes.

3) External Routes type 1.

4) External Routes Type 2.

So, If a router recieve External Network as Type 1 and recieves it from another router as Type2, it will always prefer the Type-1 Over the TYPE-2 regardless of its total cost.

Verifying the BGP Med attribute by:

sh ip bgp

sh ip bgp (network)



New Member

Re: BGP routing

Incase you have a huge internal network with multiple paths to the ASBR, then E1 routes will prefer the best path to the ASBR. However if it is E2, then there will be load balancing across non-equal (bandwidth wise) paths to the ASBR.

If your internal network does not have redundant paths, then u can leave it to E@, thereby reducing the resource consumption on the router. If there are redundant paths and one better than other, then u better make it E1 as the traffic will flow through the best path.

Re: BGP routing


OSPF has tow external route types E1 andE2 as other posts mentioned above E2 is the defualt and 20

but ucan change it to any route to E1 but type-1 (E1) is not constant like E@ i mean it increase thorughout the nework when passing hops (neighbors)

E1 (external type-1) and E2 (external type-2).

External type-2 is default and only defines a static metric for redistribution into

the OSPF domain. Regardless of the cost to the ASBR all routers throughout the

OSPF domain see the exact same cost for the E2 route. An E1 route takes the

cost as reported into the OSPF domain plus the cost to get to the ASBR

good luck

if helpful Rate