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
no passive-interface GigabitEthernet0/0
no passive-interface GigabitEthernet0/1
network 184.108.40.206 0.0.0.0 area 0
network 220.127.116.11 0.0.0.0 area 0
network 18.104.22.168 0.0.0.0 area 0
router bgp 2
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 22.214.171.124 peer-group INTERNAL
neighbor 126.96.36.199 peer-group TEST
Please help ....
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 : Cisco.com)
You can also go to http://www.cisco.com/univercd and select your cisco IOS software to learn more about the commands and understand what it does.
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.
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 ..
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 192.168.1.0 /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
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)
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.
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
if helpful Rate