Redistribute Static on Juniper & Cisco

In case you wondered how to redistribute static routes into dynamic routing protocol you are at the right place. This is normally a basic thing to do, but I will let you know how to do it in different ways on different vendor devices so it might be interesting.

We will go through few examples of normal static to OSPF redistribution and then see how it can be partially done with only part of static routes using route filters. I’ll do it on Cisco and Juniper devices so we can see what’s the difference.

Cisco

In Cisco CLI, redistribute static is fairly simple thing to do:

Router(config)#router ospf 1
Router(config-router)#redistribute static subnets

But you need to know that this simple command will take all static router available on that router and push them to OSPF and redistribute them to all other routers participating in that OSPF process.

If you want to redistribute just some of the static routes, or in our next example only static route towards the network 10.10.10.0/24 you need route map filtering in redistribution command to reference only that one network:

We create an access-list with which we will reference to that network and then use that access-list inside route-map. Route-map will then be referenced in redistribution command:

access-list 11 permit 10.10.10.0 0.0.0.255

route-map REDISTRIBUTE permit 10
   match ip address 11

router ospf 1
   redistribute static route-map REDISTRIBUTE subnets

IF we need more granular matching on prefix length, we can use prefix-list instead of access-list

ip prefix-list PREFIX permit 10.10.10.0/24

route-map REDISTRIBUTE permit 10
   match ip address prefix-list PREFIX

router ospf 1
   redistribute static route-map REDISTRIBUTE subnets

Juniper

In case of Juniper, we are using ‘set protocols ospf export’ command to redistribute.

In our example, if we want to redistribute all static routes into OSPF we are creating something like this:

set policy-options policy-statement REDISTRIBUTE_ALL_STATIC term 1 from protocol static
set policy-options policy-statement REDISTRIBUTE_ALL_STATIC term 1 then accept
 
set protocols ospf export REDISTRIBUTE_ALL_STATIC

If fo example we want to redistribute into OSPF only 10.10.10.0/24 network, then we need to add extra condition into policy-statement which is basically matching the network with prefix-list:

set policy-options policy-statement REDISTRIBUTE_STATIC term 1 from protocol static
set policy-options policy-statement REDISTRIBUTE_STATIC term 1 from route-filter 10.10.10.0/24 prefix-length-range /24-/24
set policy-options policy-statement REDISTRIBUTE_STATIC term 1 then accept

set protocols ospf export REDISTRIBUTE_STATIC

 

UPDATE on 30 Aug 2017:
Article was corrected after my polite reader from first comment pointed on few big mistakes in the config.

 

2 Comments

  1. showipintbri July 30, 2017
    • Valter Popeskic July 30, 2017

Leave a Reply