CCNP ROUTE Tutorial and Lab: Route Maps and Redistribution

In the previous CCNP ROUTE redistribution lab, we used distribute-lists to filter the routes being redistributed.

On occasion, we’ll need to do more than a simple permit or deny when it comes to redistributed routes.  Sometimes we just may need to set different metrics for different routes, and maybe even change an OSPF external route type or two.  We can get those jobs done with route maps.

Route maps operate in a similar fashion to access-lists.  Both route maps and ACLs arrive at a decision of “permit” or “deny”.  Route maps give us power over the packets beyond that simple “send” or “don’t send”; we can actually change BGP route attributes with these babies, among other things.

We’ll put route maps to work in this lab, using the following topology.  As always, the 4th octet of any interface’s IP address is the router number.

Route Redistribution with Route Maps Lab Topology

R1 sees all three routes advertised by R2 via RIP.

R1#show ip route rip

R    222.2.2.0/24 [120/1] via 172.12.123.2, 00:00:07, Serial1/0

R    2.0.0.0/8 [120/1] via 172.12.123.2, 00:00:07, Serial1/0

R    22.0.0.0/8 [120/1] via 172.12.123.2, 00:00:07, Serial1/0

After applying route redistribution for both connected and RIP subnets, R3 sees four OSPF routes from R1.  Each is marked O E2, the default route type for routes redistributed into OSPF.

R1(config)#router ospf 100

R1(config-router)#redistribute rip subnets

R1(config-router)#redis connected subnets
R3#show ip route ospf

O E2  2.0.0.0/8 [110/20] via 172.12.13.1, 00:04:29, Serial0/1/0

O E2  22.0.0.0/8 [110/20] via 172.12.13.1, 00:04:29, Serial0/1/0

      30.0.0.0/24 is subnetted, 1 subnets

O        30.1.1.0 [110/65] via 172.12.13.1, 00:01:23, Serial0/1/0

      172.12.0.0/16 is variably subnetted, 3 subnets, 2 masks

O E2     172.12.123.0/24 [110/20] via 172.12.13.1, 00:04:29, Serial0/1/0

O E2  222.2.2.0/24 [110/20] via 172.12.13.1, 00:04:29, Serial0/1/0

Our requirements for this lab involve a different action for three separate routes:

  • 2.0.0.0 /8:  Double the default seed metric and set the route type to E1
  • 22.0.0.0 /8:  Keep the default seed metric and set the route type to E1.
  • 222.2.2.0 /24:  Don’t redistribute this route at all.

Route Redistribution Actions

Oh, just one more thing … all other routes redistributed into OSPF, both present and future,  should keep the default seed metric and the default route type.

Regular Route Redistribution For All Other Routes

Quite a set of requirements.  Let’s have at it.

The first step, as always, is to identify each route or group of routes with an ACL.   Since we’re taking a different action on three specific routes, we’ll need an ACL for each route.

R1(config)#access-list 2 permit 2.0.0.0 0.255.255.255

R1(config)#access-list 22 permit 22.0.0.0 0.255.255.255

R1(config)#access-list 44 permit 222.2.2.0 0.0.0.255

Now to start on the route map.   Route maps are named rather than numbered, and you should give yours at least a slightly intuitive name.   We’ll have a separate clause for each of our routes, starting with doubling the seed metric of 2.0.0.0 /8  and setting the OSPF route type to E1.

First Route Has Seed Doubled And Route Type Set To E1

Since we’re taking two actions on this route, we’ll have one match statement but two set statements.  I’ll use IOS Help along the way in this clause to show you the wide variety of match values and set actions.

_________________________________________________________

Chris Bryant’s CCNP ROUTE Study Guide on Amazon

Cisco Press CCNP ROUTE Study Guide on Amazon

Check ’em both out!

Chris Bryant's CCNP ROUTE Study Guide

__________________________________________

R1(config)#route-map RIP2OSPF permit 10

R1(config-route-map)#match ?

  as-path           Match BGP AS path list

  clns              CLNS information

  community         Match BGP community list

  extcommunity      Match BGP/VPN extended community list

  interface         Match first hop interface of route

  ip                IP specific information

  ipv6              IPv6 specific information

  length            Packet length

  local-preference  Local preference for route

  metric            Match metric of route

  mpls-label        Match routes which have MPLS labels

  nlri              BGP NLRI type

  policy-list       Match IP policy list

  route-type        Match route-type of route

  source-protocol   Match source-protocol of route

  tag               Match tag of route



R1(config-route-map)#match ip ?

  address       Match address of route or match packet

  next-hop      Match next-hop address of route

  route-source  Match advertising source address of route


R1(config-route-map)#match ip address ?

  <1-199>      IP access-list number

  <1300-2699>  IP access-list number (expanded range)

  WORD         IP access-list name

  prefix-list  Match entries of prefix-lists


R1(config-route-map)#match ip address 2

All IP addresses matching ACL 2 will match this route-map clause.  (You can specify more than one ACL for a single route-map clause.)  And just as quite a few values can be matched here, quite a few attributes can be set.

R1(config-route-map)#match ip address 2

R1(config-route-map)#set ?

  as-path           Prepend string for a BGP AS-path attribute

  automatic-tag     Automatically compute TAG value

  clns              OSI summary address

  comm-list         set BGP community list (for deletion)

  community         BGP community attribute

  dampening         Set BGP route flap dampening parameters

  default           Set default information

  extcommunity      BGP extended community attribute

  interface         Output interface

  ip                IP specific information

  ipv6              IPv6 specific information

  level             Where to import route

  local-preference  BGP local preference path attribute

  metric            Metric value for destination routing protocol

  metric-type       Type of metric for destination routing protocol

  mpls-label        Set MPLS label for prefix

  nlri              BGP NLRI type

  origin            BGP origin code

  tag               Tag value for destination routing protocol

  traffic-index     BGP traffic classification number for accounting

  vrf               Define VRF name

  weight            BGP weight for routing table

Quite a few BGP mentions here, but as we’re about to see, route-maps are hardly limited to BGP configurations.  We’ll use this clause to set both the metric and metric type for this particular route as it’s being redistributed into OSPF.

First Route Has Seed Doubled And Route Type Set To E1

R1(config-route-map)#set metric ?

  +/-<metric>     Add or subtract metric

  <0-4294967295>  Metric value or Bandwidth in Kbits per second



R1(config-route-map)#set metric 40

R1(config-route-map)#set metric-type ?

  external  IS-IS external metric

  internal  IS-IS internal metric or Use IGP metric as the MED for BGP

  type-1    OSPF external type 1 metric

  type-2    OSPF external type 2 metric


R1(config-route-map)#set metric-type type-1

Just as you can put more than one match statement in a single clause, you can enter multiple set statements, as we just did.    That clause will set the OSPF metric type to E1 and double the seed metric from its default of 20.

The next clause will match ACL 22.  We’ll leave the seed metric alone with this clause and set the OSPF route type to E1.

Route Type Set To E1, Default Seed Metric Used

 

R1(config-route-map)#route-map RIP2OSPF permit 20

R1(config-route-map)#match ip address 22

R1(config-route-map)#set metric-type type-1

The third clause will match ACL 44 and will deny the matching route from being redistributed.  We won’t do that with a set statement; rather, we’ll make that happen with deny in the route-map clause.  This particular clause will not have a set statement.

Do Not Redistribute 222.2.2.0 /24

R1(config-route-map)#route-map RIP2OSPF deny 30

R1(config-route-map)#match ip address 44

Now we need a clause to match all redistributed routes that don’t match one of those ACL lines.  For that, we’ll write what I call a “catch-all” clause, a clause that matches any route that wasn’t specifically matched earlier in the route-map.

Redistribute All Other Routes With No Changes

This clause will have no match rule, and since we’re not changing any attributes, it won’t have any set rules.  It’s an empty clause, but an important one.

R1(config-route-map)#route-map RIP2OSPF permit 40

R1(config-route-map)#

There’s a lot going on with your average route-map (not that mine is average), so always review your work before applying the route-map with show route-map.

R1#show route-map

route-map RIP2OSPF, permit, sequence 10

  Match clauses:

    ip address (access-lists): 2

  Set clauses:

    metric 40

    metric-type type-1

  Policy routing matches: 0 packets, 0 bytes

route-map RIP2OSPF, permit, sequence 20

  Match clauses:

    ip address (access-lists): 22

  Set clauses:

    metric-type type-1

  Policy routing matches: 0 packets, 0 bytes

route-map RIP2OSPF, deny, sequence 30

  Match clauses:

    ip address (access-lists): 44

  Set clauses:

  Policy routing matches: 0 packets, 0 bytes

route-map RIP2OSPF, permit, sequence 40

  Match clauses:

  Set clauses:

  Policy routing matches: 0 packets, 0 bytes

We’ve written the route-map, but haven’t applied it yet.   Before we do, let’s remind ourselves of what R3’s routing table looks like.

R3#show ip route ospf

O E2  2.0.0.0/8 [110/20] via 172.12.13.1, 00:04:29, Serial0/1/0

O E2  22.0.0.0/8 [110/20] via 172.12.13.1, 00:04:29, Serial0/1/0

      30.0.0.0/24 is subnetted, 1 subnets

O        30.1.1.0 [110/65] via 172.12.13.1, 00:01:23, Serial0/1/0

      172.12.0.0/16 is variably subnetted, 3 subnets, 2 masks

O E2     172.12.123.0/24 [110/20] via 172.12.13.1, 00:04:29, Serial0/1/0

O E2  222.2.2.0/24 [110/20] via 172.12.13.1, 00:04:29, Serial0/1/0

On R1, we’ll now remove the redistribute rip subnets statement configured earlier and replace it with one that calls the route-map.    I’m not going to apply the route-map to the redistribute connected subnets statement, so there’s no reason to remove that.

Route Redistribution with Route Maps Lab Topology

R1(config)#router ospf 100

R1(config-router)#no redis rip subnets

R1(config-router)#redis rip subnets route-map RIP2OSPF
R3#show ip route ospf

O E1  2.0.0.0/8 [110/104] via 172.12.13.1, 00:00:07, Serial0/1/0

O E1  22.0.0.0/8 [110/84] via 172.12.13.1, 00:00:07, Serial0/1/0

      30.0.0.0/24 is subnetted, 1 subnets

O        30.1.1.0 [110/65] via 172.12.13.1, 00:01:46, Serial0/1/0

      172.12.0.0/16 is variably subnetted, 3 subnets, 2 masks

O E2     172.12.123.0/24 [110/20] via 172.12.13.1, 00:00:07, Serial0/1/0

Checking our results…

The 2.0.0.0 /8 route is marked E1 and the seed metric was doubled from 20 to 40 during redistribution.  Since E1 routes reflect the entire path to the destination, the final cost is not the doubled seed metric of 40, but 104.

The 22.0.0.0 /8 route is marked E1, and the seed metric was left alone.  The cost of 84 reflects the entire cost of the path to the destination.    This cost shows us that the doubling of the seed metric for the 2.0.0.0 /8 route was successful.

The 222.2.2.0 /24 route does not appear, having been filtered during redistribution.

172.12.123.0 was redistributed via redistribute connected, which didn’t have a route-map applied, so we see the usual defaults in a seed metric of 20 and a route code of E2.

Before we move on, we need to test the 4th clause of our route-map — the “catch-all”.  Let’s add a route not specifically named by the first three lines and see what happens.

R2(config)#int loopback 55

R2(config-if)#ip address 55.5.5.5

*Jun 18 19:10:49.306: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback55, changed state to up

R2(config-if)#ip address 55.5.5.5 255.255.255.0


R2(config-if)#router rip

R2(config-router)#network 55.0.0.0

The route is in R1’s RIP routing table…

R1#show ip route rip

R    222.2.2.0/24 [120/1] via 172.12.123.2, 00:00:19, Serial1/0

R    2.0.0.0/8 [120/1] via 172.12.123.2, 00:00:19, Serial1/0

     55.0.0.0/24 is subnetted, 1 subnets

R       55.5.5.0 [120/1] via 172.12.123.2, 00:00:19, Serial1/0

R    22.0.0.0/8 [120/1] via 172.12.123.2, 00:00:19, Serial1/0

… and R3 has it via route redistribution, with both the default seed metric of 20 and default code of E2, having matched clause 40 of the route-map.

R3#show ip route ospf

O E1  2.0.0.0/8 [110/104] via 172.12.13.1, 00:10:41, Serial0/1/0

O E1  22.0.0.0/8 [110/84] via 172.12.13.1, 00:10:41, Serial0/1/0

      30.0.0.0/24 is subnetted, 1 subnets

O        30.1.1.0 [110/65] via 172.12.13.1, 00:12:20, Serial0/1/0

      55.0.0.0/24 is subnetted, 1 subnets

O E2     55.5.5.0 [110/20] via 172.12.13.1, 00:01:44, Serial0/1/0

      172.12.0.0/16 is variably subnetted, 3 subnets, 2 masks

O E2     172.12.123.0/24 [110/20] via 172.12.13.1, 00:10:41, Serial0/1/0

Quick note:  We can have multiple match statements in a single clause, and should we do so, both match statements must do just that in order for the clause to match.   For example, the following clause would have to match ACL 5 and be an OSPF E2 route in order to have its metric set to the specified value.

R1(config)#route-map OSPF2RIPDOMAIN permit 10

R1(config-route-map)#match ip address 5

R1(config-route-map)#match route-type external type-2

R1(config-route-map)#set metric 5

There’s one more set value I want to introduce you to, and I’ll do just that in the next installment of this CCNP ROUTE redistribution tutorial series.

If you’re serious about your ROUTE and TSHOOT exams — and I know you are — there are two things you should do right now.

First, follow that link to the main CCNP ROUTE tutorial page, where you’ll find links to every redistribution tutorial on this site.

Second, head to Amazon and purchase Chris Bryant’s CCNP ROUTE Study Guide.

You’ll be very glad you did.

And I’m not scared of comparisons — check out the Cisco Press CCNP ROUTE guide, too.

Enjoy your day, and I’ll see you August 16, 2018 with the next redistribution tutorial.

Chris B.

Chris Bryant's CCNP ROUTE Study Guide