Junos
Reply
Contributor
jelm0
Posts: 10
Registered: ‎10-28-2008
0
Accepted Solution

How do I redistribute (export) between two OSPF instances

I would like to redistribute some routes between 2 OSPF processes (I think this translates to export OSPF routes to another OSPF instance in JUNOS-speak)

 

So far I have been able to export a static route to another OSPF instance with this:

[edit]
admin@pe1# show routing-instances
cust1 {
    interface ge-0/0/1.0;
    routing-options {
        static {
            route 0.0.0.0/0 {
                discard;
                no-install;
            }
        }
    }
    protocols {
        ospf {
            export originate;
            area 0.0.0.0 {
                interface ge-0/0/1.0;
            }
        }
    }
}

[edit]
admin@pe1# show policy-options
policy-statement originate {
    from protocol static;
    then accept;
}

 

However, I cannot get OSPF to do the same (ie. "from protocol ospf" in the policy-statement). This is the equivalent in Cisco syntax of what I'd like to do:

 

router ospf 1
 network 192.168.0.0 0.0.255.255 area 0
!
router ospf 2
 redistribute ospf 1 subnets route-map filter
 network 10.0.0.1 0.0.0.0 area 0
!

access-list 1 permit 192.168.2.0 0.0.1.255
route-map filter permit 10
 match ip address 1
!
route-map filter deny 20

Any pointers would be appreciated.

 

Cheers.

Super Contributor
AntonD
Posts: 111
Registered: ‎11-07-2007
0

Re: How do I redistribute (export) between two OSPF instances

Hi

 

This is a similar question to the one possed in this thread - export and import routes from routing-instance

 

JUNOS documentation has an example of what you need to do here: Configuring Multiple Instances of OSPF

Contributor
jelm0
Posts: 10
Registered: ‎10-28-2008
0

Re: How do I redistribute (export) between two OSPF instances

Thanks for your response. Unfortunately I tried the "Configuring Multiple Instances of OSPF" example but it did not work for me. I'm not sure it was fully tested. For example the so-2/2/2.0 interface is referenced under the default and the voice-policy routing instance. I also could not see how it would work without export statements.

 

A simple worked example would be so helpful.

 

Super Contributor
AntonD
Posts: 111
Registered: ‎11-07-2007
0

Re: How do I redistribute (export) between two OSPF instances

The example in the documentation actually does work. The export statement you are looking for is actually the rib-group options that you see. rib-groups allow you to export/import routes from a protocol within one routing table into another routing table.

 

In general, the normal policy based import/export functions let you import/export routes between protocols within the same routing table.

Contributor
jelm0
Posts: 10
Registered: ‎10-28-2008
0

Re: How do I redistribute (export) between two OSPF instances

Thank you for the clarification about rib-groups vs. normal policy. However, I still can't get the example to work.

 

I substituted so-2/2/2.0 with ge-0/0/1 and so-4/2/2.0 with ge-0/0/0.0. Applying the example I get:

admin@r1# commit
[edit protocols ospf area 0.0.0.0]
  'interface ge-0/0/1.0'
    duplicate intf or intf not configured in this instance
error: configuration check-out failed


Which was my point earlier: the interfaces overlap. I corrected this and removed the other-policy. This resulted in:

admin@r1# show
version 9.2R2.15;

...
routing-options {  
    rib-groups {
        inet_to_voice_and_other {
            import-rib [ inet.0 voice-policy.inet.0 ];
        }
        voice_to_inet {
            import-rib [ inet.0 voice-policy.inet.0 ];
        }
    }
}
protocols {
    ospf {
        rib-group inet_to_voice_and_other;
        area 0.0.0.0 {
            interface ge-0/0/0.0;
        }
    }
}
routing-instances {
    voice-policy {
        interface ge-0/0/1.0;
        protocols {
            ospf {
                rib-group voice_to_inet;
                area 0.0.0.0 {
                    interface ge-0/0/1.0;
                }
            }
        }
    }
}

[edit]
admin@r1# commit
[edit routing-instances voice-policy protocols]
  'ospf'
    rib-group voice_to_inet: primary routing table does not match instance voice-policy
error: configuration check-out failed
 

I really don't think the example works. However, if you have it working I'd appreciate you listing the config.

 

Alternatively how would the following Cisco config be translated to JUNOS?
 
router ospf 1
 network 192.168.0.0 0.0.255.255 area 0
!
router ospf 2
 redistribute ospf 1 subnets route-map filter
 network 10.0.0.1 0.0.0.0 area 0
!

access-list 1 permit 192.168.2.0 0.0.1.255
route-map filter permit 10
 match ip address 1
!
route-map filter deny 20

 

Super Contributor
AntonD
Posts: 111
Registered: ‎11-07-2007

Re: How do I redistribute (export) between two OSPF instances

Hi Jelm0

 

I have spotted the mistake in the online documentation and will raise an documenation but to get it solved. The voice_to_inet should actually be define as this.

 

 

lab@florence> show configuration routing-options rib-groups
voice_to_inet {
import-rib [ voice-policy.inet.0 inet.0 ];
}

lab@florence>

 The way to read the import-rib statement is as follows. Take the routes from the current protocol (ospf in this case) and import them into the primary (or local) route table and also any other routing tables listed after this. The primary route table would be the main route table where the rib-group is being used. That would be either inet.0 if used in the main routing instance or voice-policy.inet.0 if used within the routing instance.

 

Note that this has only installed the route into the routing table. This does not mean that the OSPF protocol in the other routing table will now advertise these routes to the rest of their peers. In order to do this, you will still need to define an export policy to export active routes from the local routing table into the particular protocol.

 

Here is some show output to make more clear what I am describing.

 

 

adelport@bristol> show ospf neighbor instance voice-policy
Address Interface State ID Pri Dead
10.2.21.1 fe-1/3/0.100 Full 10.2.21.1 128 39
10.1.21.1 so-0/0/1.200 Full 10.1.21.1 128 39

adelport@bristol> show ospf route instance voice-policy
Topology default Route Table:

Prefix Path Route NH Metric NextHop Nexthop
Type Type Type Interface addr/label
10.1.21.1 Intra Router IP 1 so-0/0/1.200
10.2.21.1 Intra Router IP 1 fe-1/3/0.100 10.2.21.1
10.1.21.0/24 Intra Network IP 1 so-0/0/1.200
10.2.21.0/24 Intra Network IP 1 fe-1/3/0.100

 

adelport@bristol> show route 10.1.21.0 terse

__juniper_private1__.inet.0: 8 destinations, 8 routes (5 active, 0 holddown, 3 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination P Prf Metric 1 Metric 2 Next hop AS path
* 10.0.0.0/8 D 0 >fxp1.0

ce2.inet.0: 5 destinations, 5 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination P Prf Metric 1 Metric 2 Next hop AS path
* 0.0.0.0/0 S 5 >10.2.2.2

voice-policy.inet.0: 5 destinations, 6 routes (5 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination P Prf Metric 1 Metric 2 Next hop AS path
* 10.1.21.0/24 D 0 >so-0/0/1.200
O 10 1 >so-0/0/1.200

adelport@bristol>  

 

On the neighboring route where I have the rib-groups defined you can see the following.

 

 

adelport@florence> show ospf neighbor instance voice-policy
Address Interface State ID Pri Dead
10.2.21.2 fe-1/3/0.100 Full 10.2.21.2 128 33

adelport@florence> show ospf route instance voice-policy
Topology default Route Table:

Prefix Path Route NH Metric NextHop Nexthop
Type Type Type Interface addr/label
10.1.21.1 Intra Router IP 2 fe-1/3/0.100 10.2.21.2
10.2.21.2 Intra Router IP 1 fe-1/3/0.100 10.2.21.2
10.1.21.0/24 Intra Network IP 2 fe-1/3/0.100 10.2.21.2
10.2.21.0/24 Intra Network IP 1 fe-1/3/0.100

adelport@florence> show route table voice-policy

voice-policy.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.1.21.0/24 *[OSPF/10] 00:18:01, metric 2
> to 10.2.21.2 via fe-1/3/0.100
10.2.21.0/24 *[Direct/0] 00:28:21
> via fe-1/3/0.100
10.2.21.1/32 *[Local/0] 00:28:21
Local via fe-1/3/0.100
224.0.0.5/32 *[OSPF/10] 00:28:22, metric 1
MultiRecv

adelport@florence> show route 10.1.21.0 terse

inet.0: 24 destinations, 25 routes (24 active, 0 holddown, 0 hidden)
@ = Routing Use Only, # = Forwarding Use Only
+ = Active Route, - = Last Active, * = Both

A Destination P Prf Metric 1 Metric 2 Next hop AS path
* 10.1.21.0/24 O 10 2 >10.2.21.2

__juniper_private1__.inet.0: 12 destinations, 12 routes (7 active, 0 holddown, 5 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination P Prf Metric 1 Metric 2 Next hop AS path
* 10.0.0.0/8 D 0 >fxp1.0

voice-policy.inet.0: 4 destinations, 4 routes (4 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

A Destination P Prf Metric 1 Metric 2 Next hop AS path
* 10.1.21.0/24 O 10 2 >10.2.21.2

 

 Here is the configuration on florence

 

adelport@florence> show configuration routing-options rib-groups
voice_to_inet {
import-rib [ voice-policy.inet.0 inet.0 ];
}

adelport@florence> show configuration routing-instances voice-policy
interface fe-1/3/0.100;
protocols {
ospf {
rib-group voice_to_inet;
area 0.0.0.0 {
interface fe-1/3/0.100;
}
}
}

 

 Hope this helps.

 

 

Contributor
jelm0
Posts: 10
Registered: ‎10-28-2008
0

Re: How do I redistribute (export) between two OSPF instances

AntonD,

 

Thanks for spotting the error in the example and especially the point you made about "Note that this has only installed the route into the routing table...".  This was what I was missing. Your explanation was just what I needed.

 

So I have now been able to get this working with my original scenario. Here is the Cisco config:

 

router ospf 1
 network 192.168.0.0 0.0.255.255 area 0
!
router ospf 2
 redistribute ospf 1 subnets route-map filter
 network 10.0.0.1 0.0.0.0 area 0
!

access-list 1 permit 192.168.2.0 0.0.1.255
route-map filter permit 10
 match ip address 1
!
route-map filter deny 20

 

 

And this is how to achieve it in JUNOS:

 

routing-options {
    interface-routes {
        rib-group inet main;
    }
    rib-groups {
        main {
            import-rib [ inet.0 ospf2.inet.0 ];
            import-policy filter;
        }
    }
}
protocols {
    ospf {
        rib-group main;
        area 0.0.0.0 {
            interface ge-0/0/0.0;
            interface ge-0/0/2.11;
            interface ge-0/0/2.12;
            interface ge-0/0/2.13;
        }
    }
}
policy-options {
    policy-statement filter {
        term redistribute {
            from {
                route-filter 192.168.2.0/23 orlonger;
            }
            then accept;
        }
        term default {
            then reject;
        }
    }
}
routing-instances {
    ospf2 {
        interface ge-0/0/1.0;
        protocols {
            ospf {
                export filter;
                area 0.0.0.0 {
                    interface ge-0/0/1.0;
                }
            }
        }
    }
}

Visitor
networking_03
Posts: 6
Registered: ‎05-13-2013
0

Re: How do I redistribute (export) between two OSPF instances

Hi,

 

What do you mean it still need and export policy to advertise the routes to peers, can you give an example?

 

It means the configuration given on the sample is not enough?

Copyright© 1999-2013 Juniper Networks, Inc. All rights reserved.