Redistribution into OSPF with Route Maps

Written on by admin on. Posted in OSPF, Route Maps

Earlier we discussed about how to redistribute routes into OSPF by using standard method. In this article we will use the same topology and will do redistribution into OSPF by using Route Maps.

Below you will find GNS3 topology for this lab.

Redistribution-into-OSPF-with-route-maps

In the topology we have two EIGRP domains and one OSPF domain. The task is to redistribute EIGRP learned routes into OSPF domain. Redistribution will be done by router R1 which is part of all routing domains.

Let’s assume that all interface configurations are done and EIGRP and OSPF is configured except redistribution. At this point R1 knows all routes learned by EIGRP and OSPF, R2 doesn’t know EIGRP learned routes.

R1

R1#show ip route 
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 2 subnets
C       172.16.30.0 is directly connected, FastEthernet0/1
C       172.16.0.0 is directly connected, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, FastEthernet1/0
D    192.168.0.0/24 [90/409600] via 172.16.0.2, 01:12:06, FastEthernet0/0
D    192.168.1.0/24 [90/409600] via 172.16.0.2, 01:12:06, FastEthernet0/0
D    192.168.2.0/24 [90/409600] via 172.16.30.2, 01:12:06, FastEthernet0/1
D    192.168.3.0/24 [90/409600] via 172.16.30.2, 01:12:08, FastEthernet0/1
R1#

When configuring route redistribution with route-maps a simple guideline should be followed:

  • Define one or more ACLs (Access Lists) in which specify routes that should be checked by the route-map;
  • Define an route-map with permit (redistribution will take place) or deny (redistribution will not take place) statements where ACLs are matched and attributes for routes are set;
  • Set the route-map parameter in redistribute command.

Configuring Redistribution

Ok! Let’s move to configuration. First of all we’ll define access lists where will specify routes that route map will analyze. I will define one ACL per EIGRP domain, first domain uses EIGRP AS 1 and second uses EIGRP AS 2.

ACL 10 used to specify routes from EIGRP domain 1:

ip access-list standard 10 
 10 permit 192.168.0.0 0.0.0.255
 20 permit 192.168.1.0 0.0.0.255
 30 permit 172.16.0.0 0.0.0.255

ACL 20 used to specify routes from EIGRP domain 2:

ip access-list standard 20 
 10 permit 192.168.2.0 0.0.0.255
 20 permit 172.16.30.0 0.0.0.255

Now, that ACLs are defined, let’s create route-maps and match ACLs within route-map statements. I will create one route-map for each EIGRP redistributed domain.

Route map domain1-in-ospf

route-map domain1-in-ospf permit 10
 match ip address 10
 set metric 200
 set metric-type type-1

Route map domain2-in-ospf

route-map domain2-in-ospf permit 10
 match ip address 20
 set metric 200
 set metric-type type-2

If route map sequence is a permit then redistribution will take place, if it is a deny redistribution will not happen. In both route-maps above there is a match statement, first matches access list 10 and second matches access list 20 (one for each redistributed EIGRP domain). Then metric value was set to 200, which means that matched routes will enter ospf domain with metric 200. Also you can set metric type for redistributed routes, if type-1 is chosen then OSPF will add internal cost to redistributed metric, if type-2 is chosen then metric value (cost) will remain unchanged.

Take note that redistribution will happen or not depending on permit or deny command of route-map sequence, but not ACL statement.

And now the redistribute commands!

R1
router ospf 1
 redistribute eigrp 1 subnets route-map domain1-in-ospf
 redistribute eigrp 2 subnets route-map domain2-in-ospf

In redistribution statement we use route-map parameter to specify wich route map will be used (in our case there is domain1-in-ospf and domain2-in-ospf ). At this point R2 should have external routes to EIGRP domains, let’s check:

R2

R2#sh ip route 
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area 
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     172.16.0.0/24 is subnetted, 2 subnets
O E2    172.16.30.0 [110/200] via 10.0.0.1, 00:13:20, FastEthernet0/0
O E1    172.16.0.0 [110/210] via 10.0.0.1, 00:13:30, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.0.0.0 is directly connected, FastEthernet0/0
O E1 192.168.0.0/24 [110/210] via 10.0.0.1, 00:13:30, FastEthernet0/0
O E1 192.168.1.0/24 [110/210] via 10.0.0.1, 00:13:30, FastEthernet0/0
O E2 192.168.2.0/24 [110/200] via 10.0.0.1, 00:13:20, FastEthernet0/0
R2#

Nice! Isn’t it?

With E1 you see routes learned from first EIGRP domain that are type-1 routes and cost is 210 (200 at the redistribution point plus cost of R2’s fa0/0 interface). With E2 (type-2) cost remains unchanged.

If you noticed above in ACL 20 I’ve skipped 192.168.3.0/24 route in second EIGRP domain. I did this with the purpose to not redistribute that network in OSPF domain. Also you can filter routes from being redistributed with deny sequences in route-maps.

I hope I was clear in this article regarding redistribution into OSPF by using route-maps. Good Luck!
21033 views

Comments (4)

  • zuela

    |

    great explanation! thanks a lot man

    Reply

  • Hema

    |

    very Good explanation. keep it up.

    Reply

  • tk

    |

    great

    Reply

  • RR

    |

    Nice explanation .Thank’s lot sir

    Reply

Leave a comment


4 + = ten