Route Redistribution

Route Redistribution

Problem

You want to redistribute IPv6 routes between routing protocols.

Solution

First, we will show an example of redistributing from OSPF into RIPv6:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ipv6 router rip RIP_PROC
Router1(config-rtr)#redistribute ospf 1 metric 5
Router1(config-rtr)#exit
Router1(config)#end
Router1#

And here is an example showing redistribution of RIPv6 into OSPF:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#redistribute rip RIP_PROC
Router1(config-rtr)#exit
Router1(config)#end
Router1#

You can advertise a default route with OSPF by using the default-information originate command:

Router1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#default-information originate always
Router1(config-rtr)#exit
Router1(config)#end
Router1#

Discussion

Both of these examples show a minimal configuration for redistributing from one routing protocol into another. In a moment we will show some more sophisticated examples, but these examples show the basic requirements. In the first example, we redistribute OSPF routes into RIP:

Router1(config)#ipv6 router rip RIP_PROC
Router1(config-rtr)#redistribute ospf 1 metric 5

Note that, in this example, we have somewhat arbitrarily set a default metric for RIP to use for all of these redistributed routes. This is because, by default, RIP will attempt to use the existing route metric from OSPF. If we look at the OSPF routing table on this router, you can see that many of the routes that we want to use in the RIP side of the network have metrics that are greater than 15:

Router1#show ipv6 route ospf
IPv6 Routing Table - 16 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
O AAAA:F::AA:1/128 [110/1]
via FE80::20E:D7FF:FED6:1060, FastEthernet0/0
OI AAAA:99::9:0/112 [110/2]
via FE80::20E:D7FF:FED6:1060, FastEthernet0/0
OI AAAA:99::A:0/112 [110/151]
via FE80::20E:D7FF:FED6:1060, FastEthernet0/0
OI AAAA:99::B:0/112 [110/163]
via FE80::20E:D7FF:FED6:1060, FastEthernet0/0
OI AAAA:99::C:0/112 [110/20]
via FE80::20E:D7FF:FED6:1060, FastEthernet0/0
OI AAAA:99::D:0/112 [110/893]
via FE80::20E:D7FF:FED6:1060, FastEthernet0/0
OI AAAA:99::E:0/112 [110/2]
via FE80::20E:D7FF:FED6:1060, FastEthernet0/0
Router1#

If we don't include the metric keyword when redistributing, then none of these routes appear on a downstream RIP router because their metrics are all too large:

Router9#show ipv6 route rip
IPv6 Routing Table - 10 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R AAAA:F::AA:1/128 [120/2]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::9:0/112 [120/3]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::E:0/112 [120/3]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
Router9#

However, if we just set all of these external routes to have the same default metric of 5, then we see all of the OSPF routes:

Router9#show ipv6 route rip
IPv6 Routing Table - 14 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R AAAA:F::AA:1/128 [120/2]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::9:0/112 [120/6]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::A:0/112 [120/6]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::B:0/112 [120/6]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::C:0/112 [120/6]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::D:0/112 [120/6]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::E:0/112 [120/6]
via FE80::20E:D7FF:FED6:4D80, Ethernet0
Router9#

In the second example, we do a simple redistribution of RIP into OSPF:

Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#redistribute rip RIP_PROC

Here we can use the default configuration and get useful results. On a downstream OSPF router, you can see that we now have external OSPF routes:

Router2#show ipv6 route ospf
IPv6 Routing Table - 22 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
OE2 AAAA:FE::/64 [110/20]
via FE80::20E:D7FF:FED6:4D80, FastEthernet0/0
O AAAA:2222::2/128 [110/1]
via FE80::20E:D7FF:FED6:4D80, FastEthernet0/0
Router2#

As we previously saw in Chapter 8 when talking about IPv4 OSPF, the default for redistributed routes in OSPF is type 2 external. This type of route is always considered worse than any internal route, and worse than any external route of type 1. The metric for an OSPF type 2 external route is the same everywhere in the network. We could choose to redistribute all RIP routes into OSPF by simply specifying the metric-type keyword on the redistribute command:

Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#redistribute rip RIP_PROC metric-type 1

Now the downstream OSPF router shows this route as follows:

Router2#show ipv6 route ospf
IPv6 Routing Table - 22 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
OE1 AAAA:FE::/64 [110/21]
via FE80::20E:D7FF:FED6:4D80, FastEthernet0/0
O AAAA:2222::2/128 [110/1]
via FE80::20E:D7FF:FED6:4D80, FastEthernet0/0
Router2#

When using route redistribution, we generally like to use route tags for the external routes. This is simply an arbitrary number associated with the routing prefix that gets carried with the route throughout the autonomous system. Route tags have several applications, but the most common one is to simply designate the autonomous system boundary router where this external route originated. If you have another router connected to the same external network, then you can use this route tag information to ensure that you don't redistribute the same route back into the original network.

You can specify a tag on the redistribute command when redistributing into OSPF:

Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#redistribute rip RIP_PROC metric-type 1 tag 123

This will affect all routes coming from this RIP process. The tag is visible in the downstream routing table:

Router2#show ipv6 route ospf
IPv6 Routing Table - 22 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
OE1 AAAA:FE::/64 [110/21], tag 123
via FE80::20E:D7FF:FED6:4D80, FastEthernet0/0
O AAAA:2222::2/128 [110/1]
via FE80::20E:D7FF:FED6:4D80, FastEthernet0/0
Router2#

Specifying a route tag in RIPv6 is a little bit more complicated because it requires a route-map:

Router1(config)#route-map OSPF-2-RIP permit 10
Router1(config-route-map)#set tag 555
Router1(config-route-map)#exit
Router1(config)#ipv6 router rip RIP_PROC
Router1(config-rtr)#redistribute ospf 1 metric 5 route-map OSPF-2-RIP

Now the redistributed OSPF routes all appear in the routing table of a downstream RIP device with this tag:

Router9#show ipv6 route rip
IPv6 Routing Table - 14 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R AAAA:F::AA:1/128 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::9:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::A:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::B:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::C:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::D:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::E:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
Router9#

With route-maps you can also construct more complicated examples. Using the match command in the route-map, you could, for example, set different tag values for different route prefixes:

Router1(config)#ipv6 prefix-list special-prefixes permit AAAA:99::A:0/112
Router1(config)#ipv6 prefix-list special-prefixes permit AAAA:99::B:0/112
Router1(config)#ipv6 prefix-list ANY-IPv6 permit ::/0 le 128
Router1(config)#route-map OSPF-2-RIP permit 5
Router1(config-route-map)#match ipv6 address prefix-list special-prefixes
Router1(config-route-map)#set tag 321
Router1(config-route-map)#exit
Router1(config)#route-map OSPF-2-RIP permit 10
Router1(config-route-map)#match ipv6 address prefix-list ANY-IPv6
Router1(config-route-map)#set tag 555
Router1(config-route-map)#exit
Router1(config)#ipv6 router rip RIP_PROC
Router1(config-rtr)#redistribute ospf 1 metric 5 route-map OSPF-2-RIP

Now our downstream RIP router has two different tag values:

Router9#show ipv6 route rip
IPv6 Routing Table - 14 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
R AAAA:F::AA:1/128 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::9:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::A:0/112 [120/6], tag 321
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::B:0/112 [120/6], tag 321
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::C:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::D:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
R AAAA:99::E:0/112 [120/6], tag 555
via FE80::20E:D7FF:FED6:4D80, Ethernet0
Router9#

The final example in the Solution section of this recipe shows how to advertise a default route with OSPF. Recall that in IPv4, a default route is written as 0.0.0.0/0that is, an address of all zeroes with a prefix-length of zero. In IPv6 the default route follows the same formula, it is an address of all zeroes and a prefix-length of zero. Since the IPv6 addressing rules allow us to replace the longest string of zeroes with two colons, "::", it follows that an IPv6 address consisting of only zeroes can be written as ::/0.

We can inject a default route into OSPF by using the default-originate command, just as we previously saw in OSPFv2 for IPv4:

Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#default-information originate always

Then, on a downstream router, we see that this default route is, by default, an external route of type 2:

Router2#show ipv6 route ospf
IPv6 Routing Table - 15 entries
Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP
U - Per-user Static route
I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary
O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2
ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
OE2 ::/0 [110/1], tag 1
via FE80::20E:D7FF:FED6:1060, Serial0/0
OI AAAA:99::9:0/112 [110/65]
via FE80::20E:D7FF:FED6:1060, Serial0/0

R2011#

There are several useful options on the default-information originate command. If you want to advertise this route with some other metric, or as a type 1 external route, you simply add the metric and metric-type keywords to the command as follows:

Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#default-information originate always metric 15 metric-type 1

And, by associating the default route with a route-map, you can force this router to only advertise itself as a valid default if it sees certain other routes in its routing table:

Router1(config)#ipv6 prefix-list OUTSIDE-WORLD seq 5 permit AAAA:99::0/112
Router1(config)#route-map DEFAULT-VALID permit 10
Router1(config-route-map)#match ipv6 address prefix-list OUTSIDE-WORLD
Router1(config-route-map)#exit
Router1(config)#ipv6 router ospf 1
Router1(config-rtr)#default-information originate route-map DEFAULT-VALID
Router1(config-rtr)#exit

Here we have defined a route-map that uses a prefix-list to match on a particular external network prefix. If this prefix is present in the routing table, then we know that this router's gateway to the outside world is working, and it is safe to advertise a default route.

See Also