Redistribution: ip default-gateway vs. ip default-network

ip default-gateway vs. ip default-network

The ip default-network command can be used to inject a default route into your routing process.

If the router has an interface directly connected to the network specified with this command, the router will generate a default route and send that route to its neighbor routers.

This command can be a little tricky to use, and it works differently with different protocols. It’s easy to get ip default-network and ip default-gateway mixed up.

They’re both used to generate a default route. The key difference is that ip default-gateway is used when IP routing is off, while ip default-network is used when IP routing is on.

Advertisements

Redistribution: Default-Information Originate (OSPF)

Default-Information Originate (Always?)

We know that default routes are generated in OSPF when stub and total stub areas are involved.

We also know that you can’t make Area 0 a stub area.

What we can do is run the OSPF command default-information originate with the always option to send a default route to all other OSPF routers — and that includes routers in Area 0.

The always option allows the router to propagate a default route without actually having one in its routing table.

Without that option, the router must have a default route in its table in order to advertise one. If there is no default route to advertise, neighbors will not receive a default route.

Redistribution: More EIGRP Redistribution

EIGRP has a default seed metric of “infinity”, and we need to define a seed metric when we perform the redistribution. With EIGRP, that means defining five different settings.

There are two ways to set the seed metric with EIGRP:

  1. Set the metric for the redistributed routes learned from a specific source at the end of the redistribute command.
  2. Use the default-metric command to set the default metric for all routes being redistributed.

Example:

R3(config-router)#redistribute rip metric 1544 10 255 1 1500
R3(config-router)#redistribute connected metric 1544 10 255 1 1500

Fairly straightforward stuff.

Or using default metric option:

R2(config)#router eigrp 100
R2(config-router)#default-metric 1544 10 255 1 1500

Be very careful when redistributing with RIP as the AD for RIP routes is 120 and will be ‘better’ then External EIGRP routes with an AD of 170. This is example where we may need to change the AD for EIGRP to something lower than 120.

Example:

R2(config)#router eigrp 100
R2(config-router)#distance ?
<1-255> Administrative distance
eigrp IP-EIGRP distance
R2(config-router)#distance eigrp ?
<1-255> Distance for internal routes
R2(config-router)#distance eigrp 90 ?
<1-255> Distance for external routes
R2(config-router)#distance eigrp 90 119

show ip protocols’ is an excellent command for reviewing redistribution.

 

 

Route Redistribution: Changing the AD

If we have an example whereby we are going to be redistributing between RIP and OSPF, we need to consider the AD.

We know that RIP uses an AD of 120 and OSPF uses 110, we might have an example whereby the best OSPF (selected by the AD) is not in fact the preferred or optimal path to the destination. We can get around this by changing the AD value for OSPF specifically.

To change the AD of a protocol on a router, use the distance command under the appropriate routing process. We’ll use this command to change the AD of OSPF on R2 to 200.

R2(config)#router ospf 1
R2(config-router)#distance ?
<1-255> Administrative distance
ospf OSPF distance
R2(config-router)#distance 121

This is now a higher value than RIP and therefore the RIP route with the AD of 120 will now be the ‘best’ route to the destination.

You can also change the AD for specific routes only!

Example config:

Let’s double the AD of the route for 4.4.4.4 while leaving the other routes alone. ACL 5 identifies that route and that route only, and then we just use that ACL number at the end of the distance command.

R2(config)#access-list 5 permit 4.4.4.4 0.0.0.0
R2(config)#router eigrp 100
R2(config-router)#distance 180 0.0.0.0 255.255.255.255 ?
<1-99> IP Standard access list number
<1300-1999> IP Standard expanded access list number
WORD Standard access-list name
R2(config-router)#distance 180 0.0.0.0 255.255.255.255 5

After clearing the route table, the route to 4.4.4.4 now has an AD of 180, while the other distances remain the same.

Route Redistribution: Suboptimal Routing And Routing Loops

Suboptimal Routing And Routing Loops

Most of the problems you have with redistributed routes fall into two categories:

  • suboptimal routing (bad)
  • routing loops (very bad).

Suboptimal routing generally occurs because of a miscalculation in coming up with the right seed metric value. The packets will eventually get where they are supposed to go, but not in an optimal manner.

General rule of thumb: “Never assume the physically shortest path is the logically shortest path, whether you’re routing or switching

Generally speaking the shortest path is often the preferred path, however with route redistribution we have to careful that we don’t end up sending packets across the longest path!

A worse effect of improperly configured route redistribution is a routing loop. Packets that enter a routing loop will be sent back and forth between the same group of routers over and over. Packets that enter a routing loop will keep looping and will never reach the intended destination. (Traceroute is an excellent tool to diagnose suspected routing loops)

A good tip for route redistribution is to think twice about using the ‘redistribute static’ or ‘redistribute connected’ commands when not necessary. Chris Bryant refers to this as ‘blind configuration’,  since someone may add a static route to the config later that you don’t want redistributed.

From Chris Bryant study guide, an example of steps to a routing loop:

Anytime you see the same few (or two) IP addresses in traceroute, you have a routing loop. Basically, here’s what’s happening:

  • Line 1: R2 pings 4.4.4.4. According to R2’s routing table, the nexthop IP address is 172.23.23.3, and the packet is sent there.
  • Line 2: R3 looks up 4.4.4.4 in its routing table, and as a result of that static route, the next-hop IP is 172.12.123.1 — R1’s serial interface. (The static route went into the routing table since its AD is less than that of the other source for that exact same network, OSPF.)
  • Line 3: R1 gets the packet, looks in its routing table, and sees the next-hop for 4.4.4.4 is 172.12.123.2 — R2’s serial interface. At that point, R2 gets the packet back, and the entire process begins again – and we have ourselves a routing loop.

To avoid routing loops, if you can use one-way route redistribution in situations with multiple boundary routers, you should.

Cisco recommends that as well – avoid two-way route redistribution whenever possible.

Route Redistribution: OSPF

Redistributing into OSPF

Example syntax:

R1(config)#router ospf 1
R1(config-router)#redistribute connected
% Only classful networks will be redistributed
R1(config-router)#redistribute connected subnets

Notice there is no seed metric required for redistribution into OSPF. OSPF has a default seed metric of 20, so none has to be specified with the redistribute command.

What OSPF does require is the subnets option to be enabled — if you want subnets to be redistributed into OSPF.

OSPF Defaults with Route Redistribution

  • The route has a metric of 20, OSPF’s default seed metric
  • The route is marked as “E2”, short for External-Type 2. This is the default routing code for a route redistributed into OSPF. An E2 metric reflects only the cost from the ASBR to the external destination. It does not reflect the cost from the local router to the ASBR itself. This would be covered by an E1 metric which is not the default for route redistribution with OSPF.

Default Seed Metrics

RIP and EIGRP have a seed metric of “infinity”, and you know no routes with a metric of “infinity” are ever going to be placed into a routing table. Both RIP and EIGRP require a default seed metric to be defined during the redistribution process.

OSPF has a default seed metric of 20, as well as defaulting to a route type of E2. There’s always an exception, and the exception here is that BGP routes are given a metric of 1 by OSPF. Be really careful when redistributing BGP into OSPF.

Another link-state protocol, ISIS has a default seed metric of zero, and it does allow routes to be redistributed without a specified seed metric.

OSPF’s default seed metric can be changed in the redistribute command itself.

Example:

R2(config)#router ospf 1
R2(config-router)#redistribute eigrp 100 ?
metric Metric for redistributed routes
metric-type OSPF/IS-IS exterior metric type for redistributed routes
route-map Route map reference
subnets Consider subnets for redistribution into OSPF
tag Set tag for routes redistributed into OSPF
<cr>
R2(config-router)#redistribute eigrp 100 metric ?
<0-16777214> OSPF default metric
R2(config-router)#redistribute eigrp 100 metric 30
% Only classful networks will be redistributed
R2(config-router)#redistribute eigrp 100 metric 30 subnets

*Remember to add the word subnets to the end to ensure classless networks can be advertised and not the default of classful.

Route Redistribution: RIP

Redistribution with RIP

R1(config)#router rip
R1(config-router)#redistribute static ?
metric Metric for redistributed routes
route-map Route map reference
<cr>

The <cr> is a little misleading here. While the command redistribute static is a complete command, it’s not enough to do the job when redistributing routes into RIP – we need to plant a seed metric. RIP will not understand the metric applied to an OSPF route for example, by planting this seed we are in fact manually setting the metric in a format that RIP understands.

Example:

We know that RIP uses hop count as it’s metric. If we redistribute an OSPF route into RIP that has a cost of 74 – a common OSPF metric – RIP doesn’t want anything to do with that route, since RIP considers a metric of 16 to be “unreachable”. Therefore we must manually specify the seed metric value.

A good seed metric value for RIP is 2, as the route travels through the RIP domain it will of course increment as per any other route with a dynamic routing protocol.

In a hub and spoke topology, the router connected to both the spoke routers is known as the Border Router. This is the router where will be performing route redistribution.

Example RIP config to enable the redistribution of routes from OSPF into the RIP domain:

R1(config)#router rip
R1(config-router)#redistribute ospf 1 metric 2
R1(config-router)#redistribute connected metric 2

More to follow on Route Redistribution from the OSPF spoke router…