The Mechanics of the redistribute Command

The redistribute router subcommand tells one routing protocol to take routes from another routing protocol. This command can simply redistribute all routes or, by using matching logic, redistribute only a subset of the routes. The redistribute command also supports actions for setting some parameters about the redistributed routes—for example, the metric.

The full syntax of the redistribute command is as follows:

redistribute protocol [process-id] [level-1 | level-1-2 | level-2] [as-number] [metric metric-value] [metric-type type-value] [match {internal | external 1 | external 2}] [tag tag-value] [route-map map-tag] [subnets]

The redistribute command identifies the routing source from which routes are taken, and the router command identifies the routing process into which the routes are advertised. For example, the command redistribute eigrp 1 tells the router to take routes from EIGRP process 1; if that command were under router rip, the routes would be redistributed into RIP, enabling other RIP routers in the network to see some or all routes coming from EIGRP AS 1.

The redistribute command has a lot of other parameters as well, most of which will be described in upcoming examples. The first few examples use the network shown in Figure 11-2. In this network, each IGP uses a different class A network just to make the results of redistribution more obvious. Also note that the numbering convention is such that each of R1's connected WAN subnets has 1 as the third octet, and each LAN subnet off R3, R4, and R5 has 2 as the third octet.

Figure 11-2 Sample Network for Default Route Examples

RIP OSPF 1 (Two Areas, with R5 as ABR)

Network 13.0.0.0 Network 15.0.0.0

Figure 11-2 Sample Network for Default Route Examples

RIP OSPF 1 (Two Areas, with R5 as ABR)

Network 13.0.0.0 Network 15.0.0.0

EIGRP 1

Network 14.0.0.0

EIGRP 1

Network 14.0.0.0

Redistribution Using Default Settings

The first example configuration meets the following design goals:

■ R1 redistributes between each pair of IGPs—RIP, EIGRP, and OSPF.

■ Default metrics are used whenever possible; when required, the metrics are configured on the redistribute command.

■ Redistribution into OSPF uses the non-default subnets parameter, which causes subnets to be advertised into OSPF.

■ All other settings use default values.

Example 11-1 shows R1's configuration for each routing protocol, along with show commands from all four routers to highlight the results of the redistribution.

Example 11-1 Route Redistribution with Minimal Options

! EIGRP redistributes from OSPF (process ID 1) and RIP. EIGRP must

! set the metric, as it has no default values. It also uses the

! no auto-summary command so that subnets will be redistributed into

Example 11-1 Route Redistribution with Minimal Options (Continued)

router eigrp 1 redistribute ospf 1 metric 1544 5 255 1 1500 redistribute rip metric 1544 5 255 1 1500 network 14.0.0.0 no auto-summary

! OSPF redistributes from EIGRP (ASN 1) and RIP. OSPF defaults the ! metric to 20 for redistributed IGP routes. It must also use the ! subnets option in order to redistribute subnets. router ospf 1 router-id 1.1.1.1 redistribute eigrp 1 subnets redistribute rip subnets network 15.0.0.0 0.255.255.255 area 0

! RIP redistributes from OSPF (process ID 1) and EIGRP (ASN 1). RIP ! must set the metric, as it has no default values. It also uses the ! no auto-summary command so that subnets will be redistributed into ! EIGRP. router rip version 2

redistribute eigrp 1 metric 2 redistribute ospf 1 metric 3 network 13.0.0.0 no auto-summary

! R1 has a connected route (x.x.1.0) in networks 13, 14, and 15, as well as ! an IGP-learned route (x.x.2.0). R1# show ip route ! lines omitted for brevity

10.0.0.0/24 is subnetted, 1 subnets C 10.1.1.0 is directly connected, FastEthernet0/0

13.0.0.0/24 is subnetted, 2 subnets C 13.1.1.0 is directly connected, Serial0/0/0.3

R 13.1.2.0 [120/1] via 13.1.1.3, 00:00:07, Serial0/0/0.3

14.0.0.0/24 is subnetted, 2 subnets D 14.1.2.0 [90/2172416] via 14.1.1.4, 00:58:20, Serial0/0/0.4

C 14.1.1.0 is directly connected, Serial0/0/0.4

15.0.0.0/24 is subnetted, 2 subnets O IA 15.1.2.0 [110/65] via 15.1.1.5, 00:04:25, Serial0/0/0.5 C 15.1.1.0 is directly connected, Serial0/0/0.5

! R3 learned two routes each from nets 14 and 15.

! Compare the metrics set on R1s RIP redistribute command to the metrics below. R3# show ip route rip

14.0.0.0/24 is subnetted, 2 subnets

R 14.1.2.0 [120/2] via 13.1.1.1, 00:00:19, Serial0/0/0.1

R 14.1.1.0 [120/2] via 13.1.1.1, 00:00:19, Serial0/0/0.1

15.0.0.0/24 is subnetted, 2 subnets

R 15.1.2.0 [120/3] via 13.1.1.1, 00:00:19, Serial0/0/0.1

R 15.1.1.0 [120/3] via 13.1.1.1, 00:00:19, Serial0/0/0.1

Example 11-1 Route Redistribution with Minimal Options (Continued) ! R4 learned two routes each from nets 13 and 15.

! EIGRP injected the routes as external (EX), which are considered AD 170. R4# show ip route eigrp

13.0.0.0/24 is subnetted, 2 subnets D EX 13.1.1.0 [170/2171136] via 14.1.1.1, 00:09:57, Serial0/0/0.1 D EX 13.1.2.0 [170/2171136] via 14.1.1.1, 00:09:57, Serial0/0/0.1

15.0.0.0/24 is subnetted, 2 subnets D EX 15.1.2.0 [170/2171136] via 14.1.1.1, 01:00:27, Serial0/0/0.1 D EX 15.1.1.0 [170/2171136] via 14.1.1.1, 01:00:27, Serial0/0/0.1 ! R5 learned two routes each from nets 13 and 14. ! OSPF by default injected the routes as external type 2, cost 20. R5# show ip route ospf

13.0.0.0/24 is subnetted, 2 subnets O E2 13.1.1.0 [110/20] via 15.1.1.1, 00:36:12, Serial0/0.1 O E2 13.1.2.0 [110/20] via 15.1.1.1, 00:36:12, Serial0/0.1

14.0.0.0/24 is subnetted, 2 subnets O E2 14.1.2.0 [110/20] via 15.1.1.1, 00:29:56, Serial0/0.1 O E2 14.1.1.0 [110/20] via 15.1.1.1, 00:36:12, Serial0/0.1 ! As a backbone router, OSPF on R1 created type 5 LSAs for the four E2 subnets. ! If R1 had been inside an NSSA stub area, it would have created type 7 LSAs. R5# show ip ospf data | begin Type-5

Type-5 AS External Link States

Link

ID

ADV

Router

Age

Seq#

Checksum

Tag

13.1

1.0

1.1

1.1

1444

0x80000002

0x000785

0

13.1

2.0

1.1

1.1

1444

0x80000002

0x00FB8F

0

14.1

1.0

1.1

1.1

1444

0x80000002

0x00F991

0

14.1

2.0

1.1

1.1

1444

0x80000002

0x00EE9B

0

Metrics must be set via configuration when redistributing into RIP and EIGRP, whereas OSPF uses default values. In the example, the two redistribute commands under router rip used hop counts of 2 and 3 just so the metrics could be easily seen in the show ip route command output on R3. The EIGRP metric in the redistribute command must include all five metric components, even if the last three are ignored by EIGRP's metric calculation (as they are by default). The command redistribute rip metric 1544 5 255 1 1500 lists EIGRP metric components of bandwidth, delay, reliability, load, and MTU, in order. OSPF defaults to cost 20 when redistributing from an IGP, and 1 when redistributing from BGP.

The redistribute command redistributes only routes in that router's current IP routing table. When redistributing from a given routing protocol, the redistribute command takes routes listed in the IP routing table as being learned from that routing protocol. Interestingly, the redistribute command can also pick up connected routes. For example, R1 has an OSPF route to 15.1.2.0/24, and a connected route to 15.1.1.0/24. However, R3 (RIP) and R4 (EIGRP) redistribute both of these routes—the OSPF-learned route and one connected route—as a result of their respective redistribute ospf commands. As it turns out, the redistribute command causes the router to use the following logic to choose which routes to redistribute from a particular IGP protocol:

KEY 1. Take all routes in my routing table that were learned by the routing protocol from which routes POINT are being redistributed.

2. Take all connected subnets matched by that routing protocol's network commands.

Example 11-1 shows several instances of exactly how this two-part logic works. For instance, R3 (RIP) learns about connected subnet 14.1.1.0/24, because RIP redistributes from EIGRP, and R1's EIGRP network 14.0.0.0 command matches that subnet.

The redistribute command includes a subnets option, but only OSPF needs to use it. By default, when redistributing into OSPF, OSPF redistributes only routes for classful networks, ignoring subnets. By including the subnets option, OSPF redistributes subnets as well. The other IGPs redistribute subnets automatically; however, if at a network boundary, the RIP or EIGRP auto-summary setting would still cause summarization to use the classful network. In Example 11-1, if either RIP or EIGRP had used auto-summary, each redistributed network would show just the classful networks. For example, if RIP had configured auto-summary in Example 11-1, R3 would have a route to networks 14.0.0.0/8 and 15.0.0.0/8, but no routes to subnets inside those class A networks.

Setting Metrics, Metric Types, and Tags

Cisco IOS provides three mechanisms for setting the metrics of redistributed routes, as follows:

KEY 1. Call a route map from the redistribute command, with the route map using the set metric po|NT command. This method allows different metrics for different routes.

2. Use the metric option on the redistribute command. This sets the same metric for all routes redistributed by that redistribute command.

3. Use the default-metric command under the router command. This command sets the metric for all redistributed routes whose metric was not set by either of the other two methods.

The list implies the order of precedence if more than one method defines a metric. For instance, if a route's metric is set by all three methods, the route map's metric is used. If the metric is set on the redistribute command and there is a default-metric command as well, the setting on the redistribute command takes precedence.

The redistribute command also allows a setting for the metric-type option, which really refers to the route type. For example, routes redistributed into OSPF must be OSPF external routes, but they can be either external type 1 (E1) or type 2 (E2) routes. Table 11-7 summarizes the defaults for metrics and metric types.

Table 11-7 Default Metrics and Route Metric Types in IGP Route Redistribution

Table 11-7 Default Metrics and Route Metric Types in IGP Route Redistribution

KEY POINT

IGP into Which Routes Are Redistributed

Default Metric

Default (and Possible) Metric Types

RIP

None

RIP has no concept of external routes

EIGRP

None

External

OSPF

20/1*

E2 (E1 or E2)

IS-IS

0

L1 (L1, L2, L1/L2, or external)

* OSPF uses cost 20 when redistributing from an IGP, and cost 1 when redistributing from BGP.

KEY POINT

* OSPF uses cost 20 when redistributing from an IGP, and cost 1 when redistributing from BGP.

Was this article helpful?

0 0

Post a comment