Programmable Internetworking & Communication Operating System Docs ... Click Spaces -> Space Directory to see docs for all releases ...
Page tree
Skip to end of metadata
Go to start of metadata

OSPF has the ability to redistribute routes of other routing protocols in the routing table into OSPF.  In OSPF terminology, routes from other routing protocols are known as external routes and they can be redistributed into OSPF as Type-5 LSAs.

When redistributing external routes, we can specify filters to control which type of routes are redistributed into OSPF otherwise it has the potential to overwhelm the OSPF process especially in large networks. It also gives the administrator the ability to stop advertising unnecessary routes through OSPF. Filtering of routes for redistribution is achieved by route maps. To create a route map, we can run the command set routing route-map <map-name>

In the following section we will demonstrate route redistribution and the use of route map in a sample topology shown in Figure 1.



                                                 Figure 1 OSPF Route Redistribution and Route Maps



Configuration on Router 2

On Router 2, we have the following basic OSPF configuration.

admin@router2# set interface gigabit-ethernet ge-1/1/3 family ethernet-switching native-vlan-id 30
admin@router2# set interface gigabit-ethernet ge-1/1/5 family ethernet-switching native-vlan-id 40
admin@router2# set protocols ospf router-id 2.2.2.2
admin@router2# set protocols ospf area 0.0.0.2 area-type stub
admin@router2# set protocols ospf network 10.10.2.0/24 area 0.0.0.2
admin@router2# set protocols ospf network 10.10.4.0/24 area 0.0.0.0
admin@router2# set l3-interface loopback lo address 2.2.2.2 prefix-length 32
admin@router2# set l3-interface vlan-interface vlan30 address 10.10.2.2 prefix-length 24
admin@router2# set l3-interface vlan-interface vlan40 address 10.10.4.1 prefix-length 24
admin@router2# set vlans vlan-id 30 l3-interface vlan30
admin@router2# set vlans vlan-id 40 l3-interface vlan40
Commit OK.
Save done.
admin@router2#


If we wish to redistribute external routes through OSPF, we can configure the set protocols ospf redistribute command. And then configure a route map to control which type or specific prefixes are allowed to be redistributed through OSPF. The configuration shown below permits the redistribution of prefix 2.2.2.3/32 through OSPF.


admin@router2# set routing prefix-list IPv4 list2 permit prefix 2.2.2.3/32
admin@router2# set routing route-map map2 order 1 matching-policy "permit"
admin@router2# set routing route-map map2 order 1 match ip address prefix-list "list2"
admin@router2# set protocols ospf redistribute connected route-map "map2"


The configuration above first creates a prefix list list2, which permits prefix 2.2.2.3/32. Then create a route map map2 with matching policy of permit. The match IP for map2 is set to list2. Finally, the command set protocols ospf redistribute connected route-map map2 applies the configuration to Router 2. We can confirm that the prefix is advertised to Router 4 by checking the routing table on Router 4.


admin@router4> show route ipv4
Possible completions:
  <ip-address>                    An IPv4/IPv6 address or prefix length
  ipv4                            IPv4
admin@router4> show route ipv4
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric,
       > - selected route, * - FIB route, q - queued route, r - rejected route

K>* 0.0.0.0/0 [0/0] via 10.10.51.1, eth0, 04:05:50
O>* 2.2.2.3/32 [110/20] via 10.10.4.1, vlan40, weight 1, 04:03:30        <-----OSPF Redistributed Prefix
O   4.4.4.4/32 [110/0] is directly connected, lo, weight 1, 04:05:23
C>* 4.4.4.4/32 is directly connected, lo, 04:05:23
O>* 10.10.2.0/24 [110/20] via 10.10.4.1, vlan40, weight 1, 01:55:32
O   10.10.4.0/24 [110/10] is directly connected, vlan40, weight 1, 04:04:21
C>* 10.10.4.0/24 is directly connected, vlan40, 04:04:21
O   10.10.5.0/24 [110/10] is directly connected, vlan50, weight 1, 04:04:02
C>* 10.10.5.0/24 is directly connected, vlan50, 04:04:21


The OSPF redistribute command can redistribute the following types of external routes.

  • BGP Routes
  • Connected Routes
  • Kernel Routes
  • Static Routes
  • Table

We can also specify the OSPF metric for these routes, for example run the command set protocols ospf redistribute static metric to specify the metric for the redistributed static routes.

  • No labels