Tuesday, December 17, 2024

OSPF - Path Selection – Route Type – Cost – Redistribution

  

A computer screen shot of a diagram

In this post, I wanted to go over the OSPF path selection and route types, as well as a couple redistribution points and examples.

First thing is, let’s take a look at the two External AS routers. Both routers 5 and 10 are ASBRs- Autonomous System Boundary Routers – and are redistributing routes from EIGRP and iBGP respectively into OSPF and vice-versa

You can see this by issuing the following command on each ASBR

show ip ospf

A black background with white text

Description automatically generated

A black background with white text

Description automatically generated

Router 5 redistribution config: eigrp\ospf

router eigrp 11

network 10.1.56.0 0.0.0.255

redistribute ospf 1 metric 1000000 10 255 255 1500

!

router ospf 1

router-id 5.5.5.5

auto-cost reference-bandwidth 10000

redistribute eigrp 11 subnets

network 10.1.35.0 0.0.0.255 area 2

network 10.1.50.0 0.0.0.255 area 2

Router 10 redistribution config: bgp\ospf

router ospf 1

router-id 10.10.10.10

auto-cost reference-bandwidth 10000

redistribute bgp 110 metric-type 1 subnets

network 10.1.40.0 0.0.0.255 area 2

network 10.1.50.0 0.0.0.255 area 2

!

router bgp 110

bgp log-neighbor-changes

bgp redistribute-internal

network 10.1.111.0 mask 255.255.255.0

redistribute ospf 1 match internal external 1 external 2

neighbor 10.1.111.11 remote-as 110

neighbor 10.1.111.11 description "External routes to ASBR"

neighbor 10.1.111.11 next-hop-self

Something to point out when redistributing iBGP into an IGP (OSPF in this case) is that the iBGP learned route (R10 learned about the 11.11.11.11 network from R11) will NOT by default be advertised to another iBGP peer OR, to an IGP. We need to add the bgp redistribute-internal command to our bgp instance. We don’t have another iBGP peer here, but we do want the 11.11.11.11 net to be advertised into OSPF at the R10 ASBR.

router bgp 110

bgp log-neighbor-changes

bgp redistribute-internal

When distributing into EIGRP, we need to have various values set to base EIGRP’s final metric on – as shown in the config on R5

router eigrp 11

redistribute ospf 1 metric 1000000 10 255 255 1500

The values are bandwidth(kb), delay, reliability, effective bandwidth (loading) and MTU

OSPF Path Selection

Administrative Distance being equal, OSPF will choose the best path first by route type, and then path\interface cost.

Route Type:

  • Note the use of specifying type 1 external OSPF routes vs type 2 routes (the default). A type 1 route will give you the total cost, including the external (redistributed) and INTERNAL cost, while a type 2 route will just account for the external cost.
  • Also, a type 1 (O E1) route will be chosen over a type 2 route (O E2) regardless of cost. See the difference below – from R8 – the route to 6.6.6.6 is a E2 route, while the route to 11.11.11.11 is a E1

Further, here is the order for OSPF route types – again, chosen over cost.

Intra-Area (O)

Inter-Area (O IA)

External Type 1 (E1)

NSSA Type 1 (N1)

External Type 2 (E2)

NSSA Type 2 (N2)

Also, I want R10 to be the next hop for all routes learned by R11, so the next-hop-self line was added to the neighbor statement on R10

router bgp 110

neighbor 10.1.111.11 next-hop-self

Cost:

OSPF bases cost on the link bandwidth with the formula:

Reference bandwidth value (Mb) / interface bandwidth

For example, in this lab, I set the reference bandwidth to 10,000 on each router and all interfaces are 1 Gbps.

auto-cost reference-bandwidth 10000

10000 Mbps (or 10 Gbps) \ 1 Gbps = 10 - so all links in this lab have a cost of 10.

Loopback interfaces here, since the reference bandwidth on all routers was modified, have a cost of 1. By default it would be cost 0.

A screen shot of a computer screen

Description automatically generated

From the perspective of R9, R8’s loopback, is 2 links and a loopback interface away ( 10+10+1=21)

A black background with white text

Description automatically generated

I hope this OSPF reference was useful – in the next post I’ll cover OSPF area types and LSAs.

Thanks for reading!!

No comments:

Post a Comment