How to configure Redistribution between OSPF and RIP

OK that definitely helped! For one adding the hop counts and E2 same cost together in visual pic really pulled it together and the logic supporting the facts was: more efficiency getting from start to finish. That was spot on you should refine that and add it to your material it was a really solid explanation that immediately had me understanding. I will also state I got it immediately in bad conditions where my brain is not working well.

Son had me watch a bunch of trailers for a new game Warhammer 2 I really love visual cartoon type anime whatever you want to call it so I got really pumped up lolā€¦ So I had to load up old steam game and I played that thing last night till 3:30am in the morning. I have not played games in a very long time just to busy with work and studying but I love strategy from Chess to basically any strategy based PC game. I am not as young as I use to be and I definitely do not stay up into morning hours anymore. Oh boy did I pay the price today with a fog clouded mind working on about 1% of my brain power might as well have been out drinking all night as I felt hung over (something I have also not experienced in a very long timeā€¦I know pretty pathetic for old retired gamer lol).

So sorry about tangent but point I am making is thank you for really good explanation that was able to get through the fog and inability to focus or concentrate in like 30-60 seconds. I am impressed lolā€¦

Hi everyone long time no see. I have been recovering from burnout and changed jobs a few times as I work my way up the chain lolā€¦ Anyway I am back at it now trying to at the very least review all the CCNP route.

Here I only had a question on what happens when you have EIGRP redistributed into OSPF. ā€œredistribute Eigrp subnetsā€ I ask because OSPF has a default metric of 20 it will use but that would not work with EIGRP would it since EIGRP needs all the K values. Or really it wont need the K values correct? since we are gong from EIGRP to OSPF and OSPF does not use K values it only needs values that OSPF can understand so in that case using default metric of 20 which is the default for E2 anyway would be fine?

I am at work so have not tested on my own equipment but that makes logical sense. I think I understand now.

Hello Brian,

Welcome back, hope you are feeling betterā€¦a burnout, that sucks.

When you redistribute between IGPs you canā€™t convert the metrics since each IGP uses its own metric.

So, when you redistribute into OSPF, you have to set a cost metric. By default, OSPF uses a cost of 20 and the E2 type. If you only have one router doing redistribution then it really doesnā€™t matterā€¦there is only path to go from OSPF to EIGRP and thatā€™s your single router.

If you have multiple routers doing redistribution then you could play with the metric and optionally change the E2 type to E1 so that other routers prefer one router over another to get from OSPF to EIGRP.

Hope this helps!

Rene

Sorry for this question as iā€™m just starting to study route material and iā€™m sure itā€™s stupid:

R2(config)#router ospf 1
R2(config-router)#network 192.168.12.0 0.0.0.255 area 0
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary 
R2(config-router)#network 192.168.23.0
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 3.3.3.0
R3(config-router)#network 192.168.23.0

Why for OSPF do we have to define 0.0.0.255

R2(config-router)#network 192.168.12.0 0.0.0.255 area 0

versus RIP

R3(config-router)#network 3.3.3.0

is this to do with no auto-summary?

Hello Daniel

The difference has to do with how each routing protocol interprets the network command. Even though the same command is used, it is dealt with differently for each routing protocol.

For OSPF, the ip-address and wildcard-mask arguments together allow you to define one or multiple interfaces to be associated with a specific OSPF area using a single command. OSPF requires both to accept the command.

For RIP, the network statements are not specifically telling RIP what prefix(es) to advertise, they tell RIP which interfaces should participate in RIP, and RIP will get the specific prefix(es) from the interface(s) which fall into the network statement.

The two network commands are simply different and require different syntax.

The no auto-summary command will cause RIP to advertise all of the routes associated with the interfaces themselves rather than creating an aggregated route that includes all interfaces.

You can find more info at the following links:

OSPF Command Reference
RIP Command Reference

I hope this has been helpful!

Laz

Iā€™m getting a basic light understanding, a little confusing still. For RIP wouldnā€™t you want to use a wildcard mask in order to define multiple interfaces?

ā€œFor RIP, the network statements are not specifically telling RIP what prefix(es) to advertise, they tell RIP which interfaces should participate in RIP, and RIP will get the specific prefix(es) from the interface(s) which fall into the network statementā€

this is confusing me a bit i believe.

Using this example: https://networklessons.com/rip/how-to-configure-redistribution-between-ospf-and-rip/

R1(config)#router ospf 1
R1(config-router)#network 1.1.1.0 0.0.0.255 area 0
R1(config-router)#network 192.168.12.0 0.0.0.255 area 0

So for OSPF even though there are only 2 interfaces on 192.168.12.0 /24, is it wise to still use 0.0.0.255?

Hi Daniel

Letā€™s say you have a router with the following interfaces:

Fa0/1 192.168.0.1/26
Fa0/2 192.168.1.1/24
Fa0/3 172.16.15.1/24
Fa0/4 172.16.16.1/23
Fa0/5 10.10.10.1/24
Fa0/6 10.20.20.1/24

For RIP, in order to include all of the subnets of these interfaces in the routing exchanges, you would have to issue the following commands (remember that RIP assumes the classful address range):

R1(config-router)#network 192.168.0.0
R1(config-router)#network 192.168.1.0
R1(config-router)#network 172.16.0.0
R1(config-router)#network 10.0.0.0

This would include all of the networks of all of the interfaces, because for the first two /24 is assumed, for the third /16 is assumed, and for the fourth /8 is assumed, all of which encompass all of the networks.

You could even issue the following command for example:

R1(config-router)#network 172.16.15.0

This would be accepted but would actually be translated to the classful network address like so in the configuration:

network 172.16.0.0

And remember, auto-summary on the advertising router (by default) simply allows for the grouping of the networks of these interfaces within the same classful network into single entries in the routing tables of the RIP neighbors.

Now OSPF simply allows you to more specifically state which networks you want to participate in the routing exchanges. For the same set of interfaces, you can have the following commands for OSPF:

R1(config-router)#network 192.168.0.0 0.0.0.63 area 0
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#network 172.16.15.0 0.0.0.255 area 0
R1(config-router)#network 172.16.16.0 0.0.1.255 area 0
R1(config-router)#network 10.10.10.0 0.0.0.255 area 0
R1(config-router)#network 10.20.20.0 0.0.0.255 area 0

Each of the above statements corresponds exactly to each of the networks on the interfaces, including the subnet masks. This is an explicit description. However, we could have also done this:

R1(config-router)#network 192.168.0.0 0.0.1.255 area 0
R1(config-router)#network 172.16.0.0 0.0.255.255 area 0
R1(config-router)#network 10.0.0.0 0.255.255.255 area 0

This too includes all networks on all interfaces.

But OSPF, because it is separated into areas, needs the granularity that the specific subnet masks provide in order to more explicitly state which networks (and thus interfaces) should be advertised and to which area.

Now concerning your question:

There is only one interface that corresponds with the 192.168.12.0/24 network on R1 and that is interface Fa0/0. So if you use a wildcard mask of 0.0.0.255 you are stating exactly that you want this subnet of that interface to participate in OSPF.

I hope this has been helpful!

Laz

1 Like

Hi Rene,

According to the text below, the keyword subnets in needed because OSPF will redistribute classful.

Is this the default behavior that it will always redistribute classful or is it because RIP is a classful routing protocol and thats why OSPF will redistribute in classful?

Letā€™s redistribute RIP into OSPF now. I can use the redistribute rip subnets command here. The keyword subnets is needed because otherwise OSPF will redistribute classful! I want it to redistribute classless so thatā€™s why Iā€™ve added the keyword subnets.

Hello Leon

When redistributing from another routing protocol into OSPF, the option of using the keyword subnets is available for all routing protocols. For example, for EIGRP:

H1(config-router)#redistribute eigrp 1 ?
  metric       Metric for redistributed routes
  metric-type  OSPF/IS-IS exterior metric type for redistributed routes
  nssa-only    Limit redistributed routes to NSSA areas
  route-map    Route map reference
  subnets      Consider subnets for redistribution into OSPF
  tag          Set tag for routes redistributed into OSPF
  <cr>

H1(config-router)#redistribute eigrp 1 

Even for redistribution from one OSPF process to another, the subnets keyword is available:

H1(config-router)#redistribute ospf 2 ?
  match        Redistribution of OSPF routes
  metric       Metric for redistributed routes
  metric-type  OSPF/IS-IS exterior metric type for redistributed routes
  nssa-only    Limit redistributed routes to NSSA areas
  route-map    Route map reference
  subnets      Consider subnets for redistribution into OSPF
  tag          Set tag for routes redistributed into OSPF
  vrf          VPN Routing/Forwarding Instance
  <cr>

H1(config-router)#redistribute ospf 2 

The same is true for BGP, IS-IS, or even static routes! So it is not a matter of the default behaviour of RIP, but the default behaviour of redistribution into OSPF from any other routing protocol, that redistribution will occur classfully unless the subnet keyword is used. This keyword simply says ā€œwhen you redistribute, take into account the subnet associated with the prefixā€.

I hope this has been helpful!

Laz

Hi
The redistribution from OSPF into RIP will redistribute only internal routes by default.

The command:

redistribute ospf 1 match external

will include external routes too into the redistribution process, because IOS will rewrite this command to:

redistribute ospf 1 match internal external 1 external 2

So my question isā€¦do these commands are actually the same command?
Is it possible to redistribute only external routes?

Thank you

Hello Giovanni

The redistribute ospf 1 match external command will automatically redistribute both types of OSPF external routes. In this Cisco documentation, it gives this explanation:

Note: The configuration shows match external 1 external 2 and the command entered was redistribute ospf 1 match external. This is normal because OSPF automatically appends ā€œexternal 1 external 2ā€ in the configuration. It matches both OSPF external 1 and external 2 routes and it redistributes both routes into BGP.

I hope this has been helpful!

Laz

Thanks for the answer, but actually this command redistribute internal and external routes, Iā€™m not so sure if that is a normal behavior or another joke of GNS3 :face_with_spiral_eyes:

Hello Giovanni

Ah I see, you are correct, I missed the internal part of the modified command. That is strange. I tried to replicate your results in CML, but I found that I donā€™t get the internal keyword appearing on mine. It could be a GNS3 issue.

Laz

1 Like

Hi Rene, thanks a lot for your site. I have a question, Why when I apply first the redistribution command in RIP, appear a similar command in OSPF. I meant, I use the command in RIP:

router rip
 version 2
 redistribute ospf 1 metric 4

then when I checked OSPF I saw this

router ospf 1
redistribute ospf 1 metric 4

thanks for your help!

Hello Heriberto

I tried reproducing your results, but when I configured redistribution under RIP, nothing else appeared under the OSPF configuration. Are you sure that the redistribute command wasnā€™t issued under OSPF by accident? Can you attempt to reproduce these results once again? If you get the same results, let us know your setup, emulator, IOS versions etc so that we can help you further.

I hope this has been helpful!

Laz

Hello!

I have a quick question about redistribution and route maps. I am trying to redistribute connected networks which match the interfaces specified in a route-map.

My question is, those interfaces are all on the same line. Arenā€™t route-map match parameters of the same kind that are located on the same line considered an OR operation?

So I initially thought that this would only redistribute the connected network from G0/2 since thatā€™s the first match that the route-map will find, but itā€™s actually redistributing the connected networks from all 3 interfaces. How does this work?

Kind regards,
David

Hello David

Your understanding of route maps is correct. Any parameters of the same kind within the same match statement are indeed treated as an OR operation. This is clarified in the following Cisco documentation where it says:

If a match command refers to several objects in one command, either match (the logical OR algorithm is applied). For example, in the match ip address 101 121 commands, a route is permitted if it is permitted by access list 101 or access list 121.

In the above case, either ACL is matched. Now when you are matching ACLs, you are matching them to particular networks. What if both ACLs match the particular network? The OR logic means that we check ALL of the potential elements in the match statement. So we donā€™t stop at one, but check them all. And if they all match, then the route map will act accordingly.

So in your case, when you have multiple match commands on the same line, the router doesnā€™t stop at the first match it finds. Instead, it will match any of the conditions listed. So, itā€™s not that it matches G0/2 and stops, itā€™s that it matches G0/2 OR G0/1 OR G0/0.

In other words, the router will redistribute the connected networks from any of the three interfaces listed as they all match the conditions in the route-map.

I hope this has been helpful!

Laz

1 Like

Perfectly explained Laz, thank you!

1 Like