Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 are can be redistributed into OSPF as Type-5 LSAs.

...

                                                 Figure 1 OSPF Route Redistribution and Route Maps

supports controlling the dissemination of routing information that is added to the routing table with route maps.

OSPF route import and export can be applied in the following scenarios:

  • Introducing Route

The OSPF export operation introduces routes learned by other routing protocols from the RIB into OSPF routing table. Meanwhile, you can also configure the routing policy to introduce certain routes that only meet the filter conditions.

  • Filtering Route

OSPF export can be configured to filter routing information advertised from the routing table in RIB to neighbors; OSPF import can be used to filter routing information received from the neighbors by configuring filter rules before adding to the routing table in RIB.

  • Modifying Route

OSPF can configure route import or export a routing policy in which route parameters can be modified when meet the filter conditions, so as to change the properties and priority of the received route or the route to be advertised.

Definition

Figure 1. Definition of OSPF route import and export

Image Removed

When we refer to OSPF import and export, it is from the point of view of the routing table in RIB. This means importing route from OSPF protocol into RIB using a routing policy, and advertising route from RIB to OSPF protocol by exporting a routing policy.

The OSPF import operation is defined as filtering and modifying the OSPF route received from the neighbors by configuring the routing policy before adding to the routing table in RIB.

OSPF export consists of two types of applications:

  1. The OSPF route advertised to neighbors is filtered and modified by configuring routing policy.
  2. Introducing route learned from other routing protocols (could be BGP, RIP or static routing) from routing table into OSPF by configuring the routing policy with this command:

set policy policy-statement <policy-name> term <term-name> from protocol <bgp | connected | ospf4 | ospf6 | rip | static>

You can also refer to 1.4 Example for Configuring OSPF Introducing Route by Using Export to see the configuration example.

...

NOTE:

  • When configuring filter rule of the routing policy to be applied in OSPF import, only filter attributes supported by OSPF can be set. Other filter attributes that are not supported by OSPF, such as BGP specific routing attribute AS Path, should not be configured in this policy, or it will cause commit fail when configuring this OSPF import policy.

For example,

Code Block
admin@Xorplus# set policy policy-statement p5 term 1 from as-path 100
admin@Xorplus# set policy policy-statement p5 then reject
admin@Xorplus# set protocols ospf4 import p5
admin@Xorplus# commit
Unknown variable aspath for protocol ospf4
Commit failed.
  • The policy for OSPF import does not support configuring the protocol attribute in filtering rules.



When VRF is Implemented

Figure 2. Definition of OSPF route import and export with VRF

Image Removed

Currently, only OSPF route import and export support VRF, while route import and export of other routing protocols such as RIP and BGP do not support VRF.

Figure 2 depicts how OSPF import and export support VRF. Each routing protocol has a separate routing table which is isolated by different VRFs (Note that, currently, only OSPF and static routing support VRF). Besides, the system has a whole routing table in RIB including the route entries of all the routing protocols which are divided by VRF.

NOTE:

...

Configuration on Router 2

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

Code Block
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.


Code Block
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.


Code Block
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.