redistribute maximum-prefix command

Use the redistribute maximum-prefix command to prevent an unexpectedly large amount of route information from being redistributed to OSPF due to a configuration error.

With the redistribute maximum-prefix command, you can determine the maximum amount of route information that will be redistributed to OSPF from other routing protocols (routing processes).

redistribute maximum-prefix command syntax

The redistribute maximum-prefix command is configured in OSPF configuration mode.

redistribute maximum-prefix command

(config)#router ospf <process-id>
(config-router)#redistribute maximum-prefix <maximum> [<threshold>] [warning-only]

<process-id> : OSPF process id
<maximum> : Upper limit of routes to be redistributed. (Percentage)
<threshold> : Threshold for generating a warning message

The command format is very simple. Basically, you just use <maximum> to determine the upper limit of routes that will be redistributed to OSPF. <threshold> determines the threshold at which warning messages are generated. The default value for <threshold> is 75 (%), rounded down to the nearest whole number.

Also, if you add the warning-only option, just generate a warning message and it will be redistributed to OSPF even if the configured limit is exceeded.

redistribute maximum-prefix command configuration example

In the following simple network diagram, use the redistribute maximum-prefix command to limit the routes that are redistributed to OSPF.

Figure redistribute maximum-prefix command configuration example network diagram
Figure redistribute maximum-prefix command configuration example network diagram

Redistribute to OSPF on R1. The routing process of the redistribution source is connected.

When there is no limit

10.1.1.0/24 to 10.1.6.0/24 are the connected route information of the IP address configured in R1’s Lo0. Connected route informations in R1 are redistributed to OSPF.

R1

interface Loopback0
 ip address 10.1.2.1 255.255.255.0 secondary
 ip address 10.1.3.1 255.255.255.0 secondary
 ip address 10.1.4.1 255.255.255.0 secondary
 ip address 10.1.5.1 255.255.255.0 secondary
 ip address 10.1.6.1 255.255.255.0 secondary
 ip address 10.1.1.1 255.255.255.0
!
router ospf 1
 redistribute connected subnets

The OSPF LSDB has six route information registered for LSA type 5, from 10.1.1.0/24 to 10.1.6.0/24.

R1

R1#show ip ospf database

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         213         0x80000003 0x007DBC 1
2.2.2.2         2.2.2.2         214         0x80000002 0x003BF8 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.12.1    1.1.1.1         213         0x80000001 0x00C7EB

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
10.1.1.0        1.1.1.1         272         0x80000001 0x003060 0
10.1.2.0        1.1.1.1         272         0x80000001 0x00256A 0
10.1.3.0        1.1.1.1         272         0x80000001 0x001A74 0
10.1.4.0        1.1.1.1         272         0x80000001 0x000F7E 0
10.1.5.0        1.1.1.1         272         0x80000001 0x000488 0
10.1.6.0        1.1.1.1         272         0x80000001 0x00F892 0

Configuring redistribute maximum-prefix command

The maximum limit of route information to be redistributed to OSPF is configured to be 5 with the redistribute maximum-prefix command.

R1

router ospf 1
 redistribute maximum-prefix 5

After configuring the redistribute maximum-prefix command, clear the OSPF process once.

If the maximum amount of route information to be redistributed is set to 5, the following message will be displayed in the console.

*Mar  1 00:08:28.755: %IPRT-4-REDIST_THR_PFX: Redistribution prefix threshold has been reached "ospf 1" - 3 prefixes
*Mar  1 00:08:28.759: %IPRT-4-REDIST_MAX_PFX: Redistribution prefix limit has been reached "ospf 1" - 5 prefixes

The threshold for generating a warning message is 5*0.75=3 (rounded down to the nearest whole number). 3 or more routes are redistributed and a warning message is generated. Looking at the LSDB of R1, there are only 5 routes redistributed from connected.

R1

R1#show ip ospf database

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         260         0x80000004 0x0085B2 1
2.2.2.2         2.2.2.2         267         0x80000003 0x0043EE 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.12.2    2.2.2.2         267         0x80000001 0x008F1F

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
10.1.1.0        1.1.1.1         252         0x80000001 0x003060 0
10.1.2.0        1.1.1.1         252         0x80000001 0x00256A 0
10.1.3.0        1.1.1.1         252         0x80000001 0x001A74 0
10.1.5.0        1.1.1.1         252         0x80000001 0x000488 0
10.1.6.0        1.1.1.1         252         0x80000001 0x00F892 0

warning-only option

Add the warning-only option to the redistribute maximum-prefix command.

R1

router ospf 1
 redistribute maximum-prefix 5 warning-only

The message generated to the console is the same.

*Mar  1 00:16:45.791: %IPRT-4-REDIST_THR_PFX: Redistribution prefix threshold has been reached "ospf 1" - 3 prefixes
*Mar  1 00:16:45.795: %IPRT-4-REDIST_MAX_PFX: Redistribution prefix limit has been reached "ospf 1" - 5 prefixes

If you look at the LSDB of R1, you can see that by adding the warning-only option, it is redistributed even if the limit is exceeded.

R1

R1#show ip ospf database

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.1.1.1         1.1.1.1         84          0x80000005 0x0083B3 1
2.2.2.2         2.2.2.2         580         0x80000003 0x0043EE 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
192.168.12.2    2.2.2.2         580         0x80000001 0x008F1F

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
10.1.1.0        1.1.1.1         69          0x80000001 0x003060 0
10.1.2.0        1.1.1.1         69          0x80000001 0x00256A 0
10.1.3.0        1.1.1.1         69          0x80000001 0x001A74 0
10.1.4.0        1.1.1.1         69          0x80000001 0x000F7E 0
10.1.5.0        1.1.1.1         69          0x80000001 0x000488 0
10.1.6.0        1.1.1.1         69          0x80000001 0x00F892 0

How the OSPF works