WeOS
5.29.0

# OSPF Route Redistribution HowTo

## About

This document aims to provide example OSPF use-cases where route redistribution is applied in order to distribute routes from other sources into the OSPF domain.

For an overview of all available configuration settings for OSPF refer to the configuration guide:

- OSPF Configuration Guide

## Introduction

Currently support exist to redistribute other RIP networks, connected routes and static routes into the OSPF domain. In addition routers are also able to inject a default route (0.0.0.0/0) into the the OSPF domain.

Any router who performs route redistribution into the OSPF domain is known as a Autonomous System Boundary Router (ASBR).

Note

Remember, if stub areas are used and it is necessary to redistribute routing information directly into that area, the type must be changed to NSSA. This is because a stub area cannot harbour any ASBRs.

The following example use-cases are presented in this document:

- Case 1: Redistribute RIP

- Case 2: Redistribute Connected Routes

- Case 3: Redistribute Static Routes

- Case 4: Redistribute Default Route

## Case 1: Redistribute RIP

In Figure 1, an example setup consisting of one OSPF network and one RIP network is displayed. In order to redistribute the RIP network into the OSPF network, and vice versa, it needs to be configured on the `ASBR`.

    . . . . . . . . . . . . . . . . .   . . . . . . . . . . . . . . . . .
    .          OSPF Network         .   .          RIP Network          .
    .                               .   .                               .
    .  .-------.                    .   .                    .-------.  .
    .  |       |                    .   .                    |       |  .
    .  |  R1   |                    .   .                    |  R4   |  .
    .  |       |                    .   .                    |       |  .
    .  '---+---'                    .   .                    '---+---'  .
    .    .2|                        .   .                        |.2    .
    .      | 192.168.2.0/24         .   .          172.16.2.0/24 |      .
    .    .1|                        .   .                        |.1    .
    .  .---+---.                  .-------.                  .---+---.  .
    .  |       |.1              .2|       |.2              .1|       |  .
    .  |  R2   +------------------+ ASBR  +------------------+  R5   |  .
    .  |       |  192.168.1.0/24  |       |  172.16.1.0/24   |       |  .
    .  '---+---'                  '-------'                  '---+---'  .
    .    .1|                        .   .                        |.1    .
    .      | 192.168.3.0/24         .   .          172.16.3.0/24 |      .
    .    .2|                        .   .                        |.2    .
    .  .---+---.                    .   .                    .---+---.  .
    .  |       |                    .   .                    |       |  .
    .  |  R3   |                    .   .                    |  R6   |  .
    .  |       |                    .   .                    |       |  .
    .  '-------'                    .   .                    '-------'  .
    .                               .   .                               .
    . . . . . . . . . . . . . . . . .   . . . . . . . . . . . . . . . . .

Figure 1: Example of an OSPF network and a RIP network distributing its routes into each others domains.

When redistributed any destination will be reachable as if they were part of the same type of domain.

### Configure

For this example we assume that both the OSPF network and the RIP network has been configured with the relevant internal networks. Refer to this example for basic OSPF network configuration, and to this for RIP network configuration.

Redistribution will be configured for both the OSPF and RIP networks, to redistribute each other.

#### ASBR

First we configure OSPF to redistribute the RIP network into its own domain:

    ASBR:/#> configure
    ASBR:/config/#> router
    ASBR:/config/router/#> ospf
    ASBR:/config/router/ospf/#> redistribute rip
    ASBR:/config/router/ospf/#> leave
    ASBR:/#>

Then we can also configure the RIP network to redistribute the OSPF network into its own domain:

    ASBR:/#> configure
    ASBR:/config/#> router
    ASBR:/config/router/#> rip
    ASBR:/config/router/rip/#> redistribute ospf
    ASBR:/config/router/rip/#> leave
    ASBR:/#>

Note

It may be necessary to also redistribute connected routes to be able to reach the networks `192.168.1.0/24` and `172.16.1.0/24` across the domains, because they are directly connected to the ASBR. Directly connected routes have administrative distance of 0 and will be selected above all other routes by default, so the RIP or OSPF route for those networks will not be active.

#### Routes

When redistributed we should be able to see routes to all parts of the OSPF domain, along with routes towards the networks present in the RIP domain. As an example, the routes on `R1`, in the OSPF domain, looks like this:

    R1:/#> show ip route
    S - Static | C - Connected | K - Kernel route  | > - Selected route
    O - OSPF   | R - RIP       | [Distance/Metric] | * - FIB route

    O>* 172.16.1.0/24 [110/20] via 192.168.2.1, vlan1, 00:11:06
    O>* 172.16.2.0/24 [110/20] via 192.168.2.1, vlan1, 00:10:58
    O>* 172.16.3.0/24 [110/20] via 192.168.2.1, vlan1, 00:10:58
    O>* 192.168.1.0/24 [110/20] via 192.168.2.1, vlan1, 00:31:25
    O   192.168.2.0/24 [110/10] is directly connected, vlan1, 00:36:25
    C>* 192.168.2.0/24 is directly connected, vlan1
    O>* 192.168.3.0/24 [110/20] via 192.168.2.1, vlan1, 00:31:25

In the same manner, the routes on `R4`, in the RIP domain, looks like this:

    R4:/#> show ip route
    S - Static | C - Connected | K - Kernel route  | > - Selected route
    O - OSPF   | R - RIP       | [Distance/Metric] | * - FIB route

    R>* 172.16.1.0/24 [120/2] via 172.16.2.1, vlan1, 00:28:58
    C>* 172.16.2.0/24 is directly connected, vlan1
    R>* 172.16.3.0/24 [120/2] via 172.16.2.1, vlan1, 00:28:58
    R>* 192.168.1.0/24 [120/3] via 172.16.2.1, vlan1, 00:12:06
    R>* 192.168.2.0/24 [120/3] via 172.16.2.1, vlan1, 00:23:26
    R>* 192.168.3.0/24 [120/3] via 172.16.2.1, vlan1, 00:23:26

## Case 2: Redistribute Connected Routes

The case presented in Figure 2, shows a very simple example where a connected route is redistributed into an OSPF domain.

    . . . . . . . . . . . . . . . . . .
    .          OSPF Network           .
    .                                 .
    .  .-------.                  .-------.                  .-------.
    .  |       |.2              .1|       |.1              .2|       |
    .  |  R1   +------------------+ ASBR  +------------------+  R2   |
    .  |       |  192.168.1.0/24  |       |  172.16.1.0/24   |       |
    .  '-------'                  '-------'                  '-------'
    .                                 .
    .                                 .
    . . . . . . . . . . . . . . . . . .

Figure 2: Example of an OSPF network redistributing a connected route into the OSPF domain.

Note

Remember that the router `R2` also needs to have a route towards the `ASBR` if it is to be reachable from inside the OSPF network. It could, for instance, be configured with a static route or a default route towards the `ASBR`.

### Configure

As in the previous case, we assume that the OSPF network itself is already configured as intended. Configuring a router to redistribute a connected route will also turn it into a ASBR.

#### ASBR

The router is configured to redistribute connected routes in the following manner:

    ASBR:/#> configure
    ASBR:/config/#> router
    ASBR:/config/router/#> rip
    ASBR:/config/router/rip/#> redistribute connected
    ASBR:/config/router/rip/#> leave
    ASBR:/#>

Now routes to all connected links will be redistributed into the OSPF domain. In this example case we only have one connected link, but keep in mind that all connected links will be redistributed.

#### Routes

If the active routes are observed on `R1`, inside the OSPF domain, a route towards the connected network can be observed:

    R1:/#> show ip route
    S - Static | C - Connected | K - Kernel route  | > - Selected route
    O - OSPF   | R - RIP       | [Distance/Metric] | * - FIB route

    O>* 172.16.1.0/24 [110/20] via 192.168.1.1, vlan1, 00:23:47
    O   192.168.1.0/24 [110/10] is directly connected, vlan1, 00:25:23
    C>* 192.168.1.0/24 is directly connected, vlan1

## Case 3: Redistribute Static Routes

In Figure 3, an example case is presented where an OSPF network is connected to some external network. We want some of these networks to be accessible from within the OSPF domain. The ASBR have static routes configured to reach these networks that we want to redistribute into the OSPF domain.

                                                                       Networks:
                                                                       172.16.10.0/24
    . . . . . . . . . . . . . . . . . .                                172.16.20.0/24
    .          OSPF Network           .                                172.16.30.0/24
    .                                 .
    .  .-------.                  .-------.               .-------.     .--.-.
    .  |       |.2              .1|       |.1           .2|       |    ( (    )
    .  |  R1   +------------------+ ASBR  +---------------+  R2   +---(_,  \ ) ,_)
    .  |       |  192.168.1.0/24  |       | 172.16.1.0/24 |       |     '-'--`--'
    .  '-------'                  '-------'               '-------'  External Network
    .                                 .
    .                                 .
    . . . . . . . . . . . . . . . . . .

Figure 3: Example of an OSPF network redistributing static routes into the OSPF domain.

### Configure

As before, we assume that the OSPF network itself is already configured as it is supposed to be. We will configure the static routes and their redistribution on the ASBR.

#### ASBR

First we add the static routes towards the intended networks, located in the connected external network, through `172.16.1.2`.

    ASBR:/#> configure
    ASBR:/config/#> ip
    ASBR:/config/ip/#> route 172.16.10.0/24 172.16.1.2
    ASBR:/config/ip/#> route 172.16.20.0/24 172.16.1.2
    ASBR:/config/ip/#> route 172.16.30.0/24 172.16.1.2
    ASBR:/config/ip/#> leave
    ASBR:/#>

When the static routes have been set up, OSPF can be configured to redistribute those routes in the following way:

    ASBR:/#> configure
    ASBR:/config/#> router
    ASBR:/config/router/#> rip
    ASBR:/config/router/rip/#> redistribute static
    ASBR:/config/router/rip/#> leave
    ASBR:/#>

#### Routes

Looking at the routing table for `R1` we can see that the static routes have been distributed through the OSPF domain:

    R1:/#> show ip route
    S - Static | C - Connected | K - Kernel route  | > - Selected route
    O - OSPF   | R - RIP       | [Distance/Metric] | * - FIB route

    O>* 172.16.10.0/24 [110/20] via 192.168.1.1, vlan1, 00:00:01
    O>* 172.16.20.0/24 [110/20] via 192.168.1.1, vlan1, 00:00:01
    O>* 172.16.30.0/24 [110/20] via 192.168.1.1, vlan1, 00:00:01
    O   192.168.1.0/24 [110/10] is directly connected, vlan1, 00:07:27
    C>* 192.168.1.0/24 is directly connected, vlan1

## Case 4: Redistribute Default Route

Distributing a default route cannot be done by redistributing a static route, it utilises its own command.

    . . . . . . . . . . . . . . . . . .
    .          OSPF Network           .
    .                                 .
    .  .-------.                  .-------.                  .-------.
    .  |       |.2              .1|       |.1              .2|       |
    .  |  R1   +------------------+ ASBR  +------------------+  GW   |
    .  |       |  192.168.1.0/24  |       |  172.16.1.0/24   |       |
    .  '-------'                  '-------'                  '-------'
    .                                 .
    .                                 .
    . . . . . . . . . . . . . . . . . .

Figure 4: Example of an OSPF network distributing a default route into the OSPF domain.

The `ASBR` have a default route towards the `GW` router. The `ASBR` in turn injects a default route into the OSPF network that points to itself.

### Configure

Same as before, we assume that the OSPF network itself is already configured as it is supposed to be. We configure the `ASBR` to advertise a default route into the OSPF domain.

#### ASBR

Configure OSPF to advertise a default route into the OSPF domain:

    ASBR:/#> configure
    ASBR:/config/#> router
    ASBR:/config/router/#> ospf
    ASBR:/config/router/ospf/#> distribute-default
    ASBR:/config/router/ospf/#> leave
    ASBR:/#>

Note

A default route will not be advertised by OSPF if it is not already present in the routing table. If the `always` keyword is added, to the `distribute-default` command, a default route will be advertised even if it is not present in the routing table.

#### Routes

When the a default route is being advertised the routing table on `R1` will look like this:

    R1:/#> show ip route
    S - Static | C - Connected | K - Kernel route  | > - Selected route
    O - OSPF   | R - RIP       | [Distance/Metric] | * - FIB route

    O>* 0.0.0.0/0 [110/10] via 192.168.1.1, vlan1, 00:20:26
    O   192.168.1.0/24 [110/10] is directly connected, vlan1, 00:20:37
    C>* 192.168.1.0/24 is directly connected, vlan1

« Previous Next »