Route Redistribution Between OSPF and RIP is a technique that is implemented to inject OSPF routes into RIP and vice-versa. In an enterprise network, different routing protocols may be used instead of one dynamic routing protocol for several reasons. For example, you may run RIP on routers that do not have enough computing power, while you run OSPF on more capable routers.

Boundary routers, connected to both RIP and OSPF routing domains, have full IP reachability to all IP prefixes in the network. But, the remaining don’t. To solve this issue, you can implement default routing or route redistribution.

In this tutorial, you will learn how to configure route redistribution between OSPF and RIP. I will explain two route redistribution issues you may encounter, and how to circumvent them.

In the rest of this post, I will be using the network diagram in Figure 1. Our network consists of four routers. OSPF is enabled on routers R1, R3, and R4, while RIPv2 is enabled on routers R1, R2, and R3.

This table includes the IP address and routing information of each interface in Figure 1.

Router Interface IP Address Autonomous System
or
OSPF Area
R1 GigabitEthernet 0/2 10.0.12.1/24 RIPv2
GigabitEthernet 0/3 10.0.13.1/24 RIPv2
GigabitEthernet 0/4 10.0.14.1/24 Area 0
R2 GigabitEthernet 0/1 10.0.12.2/24 RIPv2
GigabitEthernet 0/3 10.0.23.2/24 RIPv2
R3 GigabitEthernet 0/1 10.0.13.3/24 RIPv2
GigabitEthernet 0/2 10.0.23.3/24 RIPv2
GigabitEthernet 0/4 10.0.34.3/24 Area 0
R4 GigabitEthernet 0/1 10.0.14.4/24 Area 0
GigabitEthernet 0/3 10.0.34.4/24 Area 0

Here are the routers’ configurations.

Router R1

Router(config)# hostname R1
R1(config)# interface GigabitEthernet0/2
R1(config-if)# ip address 10.0.12.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# 
R1(config-if)# interface GigabitEthernet0/3
R1(config-if)# ip address 10.0.13.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# 
R1(config-if)# interface GigabitEthernet0/4
R1(config-if)# ip address 11.0.14.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# 
R1(config-if)# router rip
R1(config-router)# version 2
R1(config-router)# network 10.0.0.0
R1(config-router)# no auto-summary
R1(config-router)# 
R1(config-router)# router ospf 1
R1(config-router)# router-id 1.1.1.1
R1(config-router)# network 11.0.14.1 0.0.0.0 area 0

Router R2

Router(config)# hostname R2
R2(config)# 
R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip address 10.0.12.2 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# 
R2(config-if)# interface GigabitEthernet0/3
R2(config-if)# ip address 10.0.23.2 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# 
R2(config)# interface loopback 0
R2(config-if)# ip address 10.0.2.2 255.255.255.0
R2(config-if)# 
R2(config-if)# router rip
R2(config-router)# version 2
R2(config-router)# network 10.0.0.0
R2(config-router)# no auto-summary

Router R3

Router(config)# hostname R3
R3(config)# interface GigabitEthernet0/1
R3(config-if)# ip address 10.0.13.3 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# 
R3(config-if)# interface GigabitEthernet0/2
R3(config-if)# ip address 10.0.23.3 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# 
R3(config-if)# interface GigabitEthernet0/4
R3(config-if)# ip address 11.0.34.3 255.255.255.0
R3(config-if)# no shutdown
R3(config-if)# 
R3(config-if)# router rip
R3(config-router)# version 2
R3(config-router)# network 10.0.0.0
R3(config-router)# no auto-summary
R3(config-router)# 
R3(config-router)# router ospf 1
R3(config-router)# router-id 3.3.3.3
R3(config-router)# network 11.0.34.3 0.0.0.0 area 0

Router R4

Router(config)# hostname R4
R4(config)# 
R4(config)# interface GigabitEthernet0/1
R4(config-if)# ip address 11.0.14.4 255.255.255.0
R4(config-if)# no shutdown
R4(config-if)# 
R4(config-if)# interface GigabitEthernet0/3
R4(config-if)# ip address 11.0.34.4 255.255.255.0
R4(config-if)# no shutdown
R4(config-if)# 
R4(config-if)# router ospf 1
R4(config-router)# router-id 4.4.4.4
R4(config-router)# network 11.0.14.4 0.0.0.0 area 0
R4(config-router)# network 11.0.34.4 0.0.0.0 area 0

How to configure OSPF Route Redistribution into RIP?

When you redistribute OSPF in RIP, the router advertises, in the RIP routing domain, all OSPF-connected subnets and all OSPF routes in the routing table.

For example, router R3’s routing table includes one OSPF route (Example 1), and R3 has one connected subnet in OSPF. Therefore, if we instruct R3 to redistribute OSPF in RIPv2, using the redistribute ospf 1 metric transparent statement, the router injects subnets 11.0.14.0/24 (learned via OSPF) and 11.0.34.0/24 (connected) only in the RIP domain (Example 2).

R3# show ip route ospf

omitted output

      11.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O        11.0.14.0/24 [110/2] via 11.0.34.4, 00:02:10, GigabitEthernet0/4

Example 1 – Display OSPF routes in R3’s routing table

R2# show ip route rip

omitted output

      10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
R        10.0.13.0/24 [120/1] via 10.0.23.3, 00:00:22, GigabitEthernet0/3
                      [120/1] via 10.0.12.1, 00:00:05, GigabitEthernet0/1
      11.0.0.0/24 is subnetted, 2 subnets
R        11.0.14.0 [120/3] via 10.0.23.3, 00:00:22, GigabitEthernet0/3
R        11.0.34.0 [120/1] via 10.0.23.3, 00:00:22, GigabitEthernet0/3

Example 2 – External RIP routes in R2’s routing table

Example 2 illustrates that R2 receives OSPF routes redistributed by R3.

To redistribute OSPF into RIP, use the redistribute command using the following syntax:

redistribute ospf process_id metric {0-16|transparent} [match {external|internal|nssa-external}] [route-map route_map_name]

process_id is the process ID of the OSPF instance to be redistributed in RIP.

First of all, you have to configure the RIP metrics of the OSPF routes in order to get them injected into RIP. If you issue the redistributed ospf command without setting metrics, the router sets the routes’ RIP metric to 16, which refers to infinity and thus the routes appears on the RIP neighbors as they possibly down, as shown the next example.

R2# show ip rip database
10.0.0.0/8    auto-summary
10.0.2.0/24    directly connected, Loopback0
10.0.12.0/24    directly connected, GigabitEthernet0/1
10.0.13.0/24
    [1] via 10.0.23.3, 00:00:09, GigabitEthernet0/3
    [1] via 10.0.12.1, 00:00:23, GigabitEthernet0/1
10.0.23.0/24    directly connected, GigabitEthernet0/3
11.0.0.0/8 is possibly down
11.0.14.0/24 is possibly down
11.0.34.0/24 is possibly down

You configure the metric parameter using the metric keyword, a route map, or the default-metric command.

Let’s demonstrate each option in the redistribute ospf command.

Using The redistribute ospf metric Command

The OSPF metric is calculated based on the cost associated with each outbound interface to a destination network. In contrast, the RIP metric cannot exceed 16; and it represents the number of devices that IP packets, destined for a network, traverse.

Therefore, the two metrics don’t mean the same thing, and thus it is not reasonable to advertise OSPF routes with their associated metrics in RIP. Additionally, a route with an OSPF metric greater than 15 would push RIP routers to not install the route in their routing tables.

Using the redistribute ospf metric statement you can either configure one metric for all routes or advertise OSPF routes using their metrics in the routing table.

In this example, we choose to set the metric manually by applying the following configuration.

R3(config)# router rip
R3(config-router)# redistribute ospf 1 metric 5

As a result, router R3 sends IP prefixes 11.0.14.0/24 and 11.0.34.0/24 with a metric of 5 (Example 3). Additionally, router R2 installed routes for those IP prefixes with the same metric (Example 4).

R2# debug ip rip

omitted output

*Oct 21 01:53:13.181: RIP: received v2 update from 10.0.23.3 on GigabitEthernet0/3
*Oct 21 01:53:13.181:      10.0.13.0/24 via 0.0.0.0 in 1 hops
*Oct 21 01:53:13.182:      11.0.14.0/24 via 0.0.0.0 in 5 hops
*Oct 21 01:53:13.182:      11.0.34.0/24 via 0.0.0.0 in 5 hops

Example 3 – Debugging RIP on router R2

R2# show ip route rip

omitted output

      10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
R        10.0.13.0/24 [120/1] via 10.0.23.3, 00:00:06, GigabitEthernet0/3
                      [120/1] via 10.0.12.1, 00:00:03, GigabitEthernet0/1
      11.0.0.0/24 is subnetted, 2 subnets
R        11.0.14.0 [120/5] via 10.0.23.3, 00:00:06, GigabitEthernet0/3
R        11.0.34.0 [120/5] via 10.0.23.3, 00:00:06, GigabitEthernet0/3

Example 4 – Displaying external RIP routes on router R2

The transparent keyword instructs RIP to inject each OSPF route into RIP along with its corresponding metric in the routing table plus 1. For example, if the route’s metric is 4, then the router advertises it in RIP with a metric of 4. Additionally, connected routes get sent with a metric of 1. In this example, we configure R3 to set the RIP metric up automatically.

R3(config)# router rip
R3(config-router)# no redistribute ospf 1 metric 5
R3(config-router)# redistribute ospf 1 metric transparent

In Example 5, the metric of the 11.0.14.0/24 OSPF route is 2 in the R3’s routing table.

R3# show ip route ospf


omitted output

      11.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O        11.0.14.0/24 [110/2] via 11.0.34.4, 02:43:10, GigabitEthernet0/4

Example 5 – Displaying OSPF routes in R3’s routing table

Therefore, router R3 sends the route to router R2 with a RIP metric of 3, while it sends the 11.0.34.0/24 with a RIP metric of 1 since it is connected to R3 (Figure 2).

Figure 2 – Wireshark capture of a RIP update sent by R3 to R2

Using The redistribute ospf match Command

OSPF route can be categorized into four categories: internal (intra-area and inter-area routes), external (E1 or E2 routes), and NSSA-external (external routes injected into an NSSA area).  The redistribute ospf match command allows you to choose what types of OSPF routes to advertise into RIP.

In this example, we instruct router R3 to redistribute internal OSPF routes into RIP. We have to set their RIP metrics; otherwise, their metric will be set to 16 (infinity), which causes R2 to not add them to the routing table. To avoid this issue, we used the default-metric command to a default RIP metric value that is applied when RIP metric is not configured explicitly.

R3(config)# router rip
R3(config-router)# redistribute ospf 1 match internal
R3(config-router)# default-metric 10

If the match and route-map keywords are not specified, all internal OSPF routes get redistributed.

Using The redistribute ospf route-map Command

First, If the route map keyword is not used, all internal OSPF routes are redistributed. Second, the route-map keyword allows to configure routes to redistribute, routes to filter, RIP metric, route-type (internal, external, NSSA-external), tags, and more. Third, if you specify a non-existent route map, RIP does not redistribute any OSPF route.

In this example, R3 has been configured to block subnet 11.0.34.0 from being redistributed, and set the RIP metric to 5.

R3(config)# access-list 1 deny 11.0.34.0 0.0.0.255
R3(config)# access-list 1 permit any
R3(config)# 
R3(config)# route-map ospf_routes permit 10
R3(config-route-map)# match ip address 1
R3(config-route-map)# set metric 5
R3(config-route-map)# exit
R3(config)# router rip
R3(config-router)# redistribute ospf 1 route-map ospf_routes

As you can see in the following show ip rip database command output, router R2 received one route from router R3.

R2# show ip rip database
10.0.0.0/8    auto-summary
10.0.2.0/24    directly connected, Loopback0
10.0.12.0/24    directly connected, GigabitEthernet0/1
10.0.13.0/24
    [1] via 10.0.23.3, 00:00:15, GigabitEthernet0/3
    [1] via 10.0.12.1, 00:00:05, GigabitEthernet0/1
10.0.23.0/24    directly connected, GigabitEthernet0/3
11.0.0.0/8    auto-summary
11.0.14.0/24
    [5] via 10.0.23.3, 00:00:15, GigabitEthernet0/3

What happens if the RIP metric has been configured using the metric and route-map keyword, while the default-metric command is already applied?

In this example, the default metric for RIP routes is set to 10, and the RIP metrics of redistributed OSPF routes are set to 3 using the metric keyword. Additionally, route map ospf_routes applied to the redistribute command set the RIP metric to 7.

R3(config)# route-map ospf_routes permit 10
R3(config-route-map)# set metric 7
R3(config-route-map)# exit
R3(config)# router rip
R3(config-router)# default-metric 10
R3(config-router)# redistribute ospf 1 metric 3 route-map ospf_routes

In this case, the route map’s metric value wins, and router R3 advertises OSPF routes into RIP with a RIP metric of 7. When the route-map keyword is not used while the metric keyword isn’t, the router uses the RIP metric configured with the metric keyword, as seen in this example.

R2# show ip route rip


omitted output

      10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
R        10.0.13.0/24 [120/1] via 10.0.23.3, 00:00:14, GigabitEthernet0/3
                      [120/1] via 10.0.12.1, 00:00:20, GigabitEthernet0/1
      11.0.0.0/24 is subnetted, 2 subnets
R        11.0.14.0 [120/7] via 10.0.23.3, 00:00:04, GigabitEthernet0/3
R        11.0.34.0 [120/7] via 10.0.23.3, 00:00:04, GigabitEthernet0/3

Example 6 – Showing R2’s routing table

If both the metric and route-map keywords are not used, the router sets the RIP metric to a value configured with the default-metric command. Otherwise, the RIP metric of the redistributed routes is set to 16 (infinity), which makes the routes unreachable, and thus they cannot be installed in the routing table of the receiving routers.

How to configure RIP Route Redistribution into OSPF?

When you redistribute RIP in OSPF, OSPF injects in the routing domain all RIP-connected IP prefixes and RIP routes in the routing table.

For instance, R1’s routing table has two RIP routes (Example 7) and two connected subnets in RIP. Consequently, if we set up R1 to redistribute RIPv2 in OSPF process 1, the router advertises in the OSPF domain four IP prefixes (Example 8): subnets 10.0.2.0/24 and 10.0.23.0/24 (learned via OSPF), plus subnets 10.0.12.0/24 and 10.0.13.0/24 (connected).

R1# show ip route


omitted output

      10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
R        10.0.2.0/24 [120/1] via 10.0.12.2, 00:00:07, GigabitEthernet0/2
C        10.0.12.0/24 is directly connected, GigabitEthernet0/2
L        10.0.12.1/32 is directly connected, GigabitEthernet0/2
C        10.0.13.0/24 is directly connected, GigabitEthernet0/3
L        10.0.13.1/32 is directly connected, GigabitEthernet0/3
R        10.0.23.0/24 [120/1] via 10.0.13.3, 00:00:18, GigabitEthernet0/3
                      [120/1] via 10.0.12.2, 00:00:07, GigabitEthernet0/2
      11.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
C        11.0.14.0/24 is directly connected, GigabitEthernet0/4
L        11.0.14.1/32 is directly connected, GigabitEthernet0/4
O        11.0.34.0/24 [110/2] via 11.0.14.4, 00:14:41, GigabitEthernet0/4

Example 7 – Displaying R1’s routing table

R4# show ip route ospf


omitted output

      10.0.0.0/24 is subnetted, 4 subnets
O E2     10.0.2.0 [110/20] via 11.0.14.1, 00:00:06, GigabitEthernet0/1
O E2     10.0.12.0 [110/20] via 11.0.14.1, 00:00:06, GigabitEthernet0/1
O E2     10.0.13.0 [110/20] via 11.0.14.1, 00:00:06, GigabitEthernet0/1
O E2     10.0.23.0 [110/20] via 11.0.14.1, 00:00:06, GigabitEthernet0/1

Example 8 – Displaying R4’s routing table

To redistribute RIP into OSPF, use the redistribute command using the following syntax:

redistribute rip [metric metric_valuemetric-type {1|2} [route-map route_map_name] [tag tg] [nssa-only] [subnets]

Let’s demonstrate each option in the redistribute rip command.

Using The redistribute rip subnets Command

When the subnets keyword is not specified, Cisco IOS displays the following system message, and the router redistributes only classful networks.

R3(config)# router ospf 1
R3(config-router)# redistribute rip
% Only classful networks will be redistributed

This means IP prefixes within subnetted networks (IP prefixes with subnet masks different from the subnet mask of the IP prefix’s class) won’t get redistributed in OSPF. For instance, subnets 10.0.2.0/24, 10.0.23.0/24, 10.0.12.0/24, and 10.0.13.0/24 are not considered classful networks because they do not use the subnet mask of Class A address, and thus they won’t get redistributed into OSPF until the subnets keyword is applied.

This example shows how to redistribute RIP into OSPF using the subnets keywords.

R3(config)# router ospf 1
R3(config-router)# redistribute rip subnets

Using The redistribute rip metric Command

The default metric or cost OSPF assigns to a redistributed route is 1 for BGP and 20 for  RIP, EIGRP, and all other dynamic routing protocols. Moreover, connected and static routes are redistributed with the default metric of 20.

To change the default metric, use the redistribute rip metric cost command, where cost is the metric value to be associated with the redistributed routes.

This example injects RIP routes with a cost of 100 into OSPF.

R1(config)# router ospf 1
R1(config-router)# redistribute rip subnets metric 100

The following show ip route ospf command output states that RIP routes are getting advertised with a cost of 100.

R1# show ip ospf database external

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Type-5 AS External Link States

  LS age: 157
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.2.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x54EB
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0

  LS age: 157
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.12.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0xE550
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0

  LS age: 157
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.13.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0xDA5A
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0

  LS age: 157
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.23.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x6CBE
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0

Using The redistribute rip metric-type Command

The default metric type for redistributed routes in OSPF is type 2 (E2). E2 routes get injected with the redistribution cost whether it is manually configured or automatically set by Cisco IOS. Additionally, the metric of an E2 route doesn’t get changed as the route’s LSA gets flooded from one router to another.

In the last example, subnets 10.0.2.0/24, 10.0.23.0/24, 10.0.12.0/24, and 10.0.13.0/24 got redistributed with a metric of 100, and the E2 metric type. As a result, they appear on R4’s routing table with their redistribution cost and metric type, as you can see in the following show ip route ospf command output.

R4# show ip route ospf



omitted output

      10.0.0.0/24 is subnetted, 4 subnets
O E2     10.0.2.0 [110/100] via 11.0.14.1, 00:17:25, GigabitEthernet0/1
O E2     10.0.12.0 [110/100] via 11.0.14.1, 00:17:25, GigabitEthernet0/1
O E2     10.0.13.0 [110/100] via 11.0.14.1, 00:17:25, GigabitEthernet0/1
O E2     10.0.23.0 [110/100] via 11.0.14.1, 00:17:25, GigabitEthernet0/1

The redistributed command allows you to set the metric type to either type 1 (E1) or type 2 (E2). E1 routes got injected with the metric configured in the redistribute command. But each router in the OSPF routing domain adds the cost of the path to the router originating the external route over the interface on which it does receive the LSA carrying the external route to the route’s metric. When an E1 external route gets learned over different OSPF-enabled interfaces, OSPF prefers the one with the least cost (redistributed metric +  path cost to the router redistributing the E1 route).

In this example, R1 redistributes RIP routes into OSPF with a metric of 100 and a metric type of E1.

R1(config)# router ospf 1
R1(config-router)#  redistribute rip metric 100 metric-type 1 subnets

The next show ip ospf database external command output states that R1 generated four Type 5 LSAs to advertise the external routes, and each of them has a metric type of 1.

R1# show ip ospf database external

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Type-5 AS External Link States

  LS age: 308
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.2.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000005
  Checksum: 0xC8F3
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0

  LS age: 308
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.12.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000005
  Checksum: 0x5A58
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0

  LS age: 308
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.13.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000005
  Checksum: 0x4F62
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0

  LS age: 308
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.23.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000005
  Checksum: 0xE0C6
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        MTID: 0 
        Metric: 100 
        Forward Address: 0.0.0.0
        External Route Tag: 0

R4’s path cost to R1 is equal to the OSPF cost of R1’s GigabitEthernet0/1 interface is 1 (Example 9) and thus redistributed routes by R1 appear in the routing table of R4 with a cost of 101 (Example 10).

R4# show ip ospf interface gigabitEthernet 0/1
GigabitEthernet0/1 is up, line protocol is up 
  Internet Address 11.0.14.4/24, Area 0, Attached via Network Statement
  Process ID 1, Router ID 4.4.4.4, Network Type BROADCAST, Cost: 1
  Topology-MTID    Cost    Disabled    Shutdown      Topology Name
        0           1         no          no            Base
  Transmit Delay is 1 sec, State BDR, Priority 1
  Designated Router (ID) 1.1.1.1, Interface address 11.0.14.1
  Backup Designated router (ID) 4.4.4.4, Interface address 11.0.14.4
  Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
    oob-resync timeout 40
    Hello due in 00:00:00
  Supports Link-local Signaling (LLS)
  Cisco NSF helper support enabled
  IETF NSF helper support enabled
  Index 1/1/1, flood queue length 0
  Next 0x0(0)/0x0(0)/0x0(0)
  Last flood scan length is 2, maximum is 2
  Last flood scan time is 0 msec, maximum is 1 msec
  Neighbor Count is 1, Adjacent neighbor count is 1 
    Adjacent with neighbor 1.1.1.1  (Designated Router)
  Suppress hello for 0 neighbor(s)

Example 9 – OSPF settings of R4’s GigabitEthernet 0/1 interface

R4# show ip route ospf



omitted output

      10.0.0.0/24 is subnetted, 4 subnets
O E1     10.0.2.0 [110/101] via 11.0.14.1, 00:08:25, GigabitEthernet0/1
O E1     10.0.12.0 [110/101] via 11.0.14.1, 00:08:25, GigabitEthernet0/1
O E1     10.0.13.0 [110/101] via 11.0.14.1, 00:08:25, GigabitEthernet0/1
O E1     10.0.23.0 [110/101] via 11.0.14.1, 00:08:25, GigabitEthernet0/1

On the other hand, R3’s path cost to R1 is 2. Consequently, subnets 10.0.2.0/24 and 10.0.12.0/24 got installed in R3’s routing table with a metric of 102, as indicated in this example.

R3# show ip route ospf


omitted output

      10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
O E1     10.0.2.0/24 [110/102] via 11.0.34.4, 00:22:05, GigabitEthernet0/4
O E1     10.0.12.0/24 [110/102] via 11.0.34.4, 00:22:05, GigabitEthernet0/4
      11.0.0.0/8 is variably subnetted, 3 subnets, 2 masks
O        11.0.14.0/24 [110/2] via 11.0.34.4, 02:57:43, GigabitEthernet0/4

Using The redistribute rip tag Command

A route tag is a 32-bit number between 0 and 4294967295, with 0 being the default value. It is a label attached to the redistributed routes in order to identify them for further processing.

Basically, OSPF does not use route tagging. When it is configured using the redistribute rip tag command, OSPF assigns the same label to all redistributed routes, except to those for which route tagging is configured using a route map.

In this example, we set the tag of RIP routes redistributed into OSPF with a tag of 100.

R1(config)# router ospf 1
R1(config-router)# redistribute rip subnets tag 100

We can verify our configuration using the show ip route command or show ip ospf database external command, as illustrated in the next example.

R1# show ip ospf database external

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Type-5 AS External Link States

  LS age: 11
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.2.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000009
  Checksum: 0x30F3
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 0.0.0.0
        External Route Tag: 100

  LS age: 11
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.12.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000009
  Checksum: 0xC158
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 0.0.0.0
        External Route Tag: 100

  LS age: 11
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.13.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000009
  Checksum: 0xB662
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 0.0.0.0
        External Route Tag: 100

  LS age: 11
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.23.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000009
  Checksum: 0x48C6
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 0.0.0.0
        External Route Tag: 100

Using The redistribute rip route-map Command

When the route-map keyword is not used in the redistribute rip command, OSPF redistributes RIP routes with the same settings. If you want to implement a particular policy that requires different settings for the redistributed routes. For example, you want some routes to be redistributed with a metric type of 1  while you want others to be redistributed with a metric type of 2, and so on.

Here comes the route-map keyword which allows applying a route map to the RIP redistributed routes. Using a route map, you can choose what IP prefixes to redistribute or not, and configure different tags, metrics, and metric types.

In this example, we configure R1 to redistribute RIP routes into OSPF based on the following policy:

  • Subnets 10.0.2.0/24 and 10.0.12.0/24 should be tagged with 212.
  • Subnets 10.0.13.0/24 and 10.0.23.0/24 should be redistributed with a metric type of 1, a cost of 200, and a tag of 1323.
R1(config)# access-list 1 permit 10.0.2.0 0.0.0.255
R1(config)# access-list 1 permit 10.0.12.0 0.0.0.255
R1(config)# 
R1(config)# access-list 2 permit 10.0.13.0 0.0.0.255
R1(config)# access-list 2 permit 10.0.23.0 0.0.0.255
R1(config)# 
R1(config)# route-map RIP_into_OSPF permit 10
R1(config-route-map)# match ip address 1
R1(config-route-map)# set tag 212
R1(config-route-map)# 
R1(config-route-map)# route-map RIP_into_OSPF permit 20
R1(config-route-map)# match ip address 2
R1(config-route-map)# set metric-type type-1
R1(config-route-map)# set metric 200
R1(config-route-map)# set tag 1323
R1(config-route-map)# exit
R1(config)# 
R1(config)# router ospf 1
R1(config-router)# redistribute rip subnets route-map RIP_into_OSPF

To verify our configuration, we use the show ip ospf database external command, as illustrated in this example.

R1# show ip ospf database external

            OSPF Router with ID (1.1.1.1) (Process ID 1)

                Type-5 AS External Link States

  LS age: 113
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.2.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x2893
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 0.0.0.0
        External Route Tag: 212

  LS age: 113
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.12.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0xB9F7
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        MTID: 0 
        Metric: 20 
        Forward Address: 0.0.0.0
        External Route Tag: 212

  LS age: 113
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.13.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0xA17F
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        MTID: 0 
        Metric: 200 
        Forward Address: 0.0.0.0
        External Route Tag: 1323

  LS age: 113
  Options: (No TOS-capability, DC, Upward)
  LS Type: AS External Link
  Link State ID: 10.0.23.0 (External Network Number )
  Advertising Router: 1.1.1.1
  LS Seq Number: 80000001
  Checksum: 0x33E3
  Length: 36
  Network Mask: /24
        Metric Type: 1 (Comparable directly to link state metric)
        MTID: 0 
        Metric: 200 
        Forward Address: 0.0.0.0
        External Route Tag: 1323

Using The redistribute rip nssa-only Command

When an ASBR within an NSSA area redistributes external routes into the area, they get advertised through Type 7 LSAs. Each ABR in the NSSA area translates those Type 7 LSAs into Type 5 LSAs in order to share external routes within normal areas, including the backbone area.

The redistribute rip nssa-only command allows NSSA routers to redistribute RIP routes into OSPF and keep them shared within the NSSA area only, and thus preventing ABRs in the area from translating Type 7 LSAs to LSAs Type 5.

To demonstrate this command, we put the link between R1 and R4 into area 14, which we configure as an NSSA. Next, redistribute RIP routes into OSPF on R1 using the redistribute rip nssa-only command. Finally, we check that R4 does not generate LSAs Type 5 for external OSPF routes 10.0.2.0/24, 10.0.12.0/24, 10.0.13.0/24, and 10.0.23.0/24 (Example 10).

Router R1

R1(config)# router ospf 1
R1(config-router)# no network 11.0.14.1 0.0.0.0 area 0
R1(config-router)# network 11.0.14.1 0.0.0.0 area 14
R1(config-router)# area 14 nssa
R1(config-router)# no  redistribute rip
R1(config-router)# redistribute rip subnets nssa-only

Router R4

R4(config)# router ospf 1
R4(config-router)# no  network 11.0.14.4 0.0.0.0 area 0
R4(config-router)# network 11.0.14.4 0.0.0.0 area 14
R4(config-router)# area 14 nssa

As seen in the following show ip ospf database external command output, router R4, which is the ABR connected to the area 14, does not generate LSAs Type 5 for the external routes injected by R1.

R4# show ip ospf database external

            OSPF Router with ID (4.4.4.4) (Process ID 1)
R4#

Related Lessons to Route Redistribution between OSPF and RIP

Mohamed Ouamer is a computer science teacher and a self-published author. He taught networking technologies and programming for more than fifteen years. While he loves to share knowledge and write, Mohamed's best passions include spending time with his family, visiting his parents, and learning new things.