Monday, April 2, 2012

Preventing Sub-optimal routing in mutual redistribution - Part 1

Following from my previous redistribution post. Let's explore a few ways we can prevent sub-optimal routing from redistributing routes at multiple routers.

Consider the topology from my previous redistribution post and let's continue.


Basically there are 3 ways to prevent sub-optimal routing.

  1. Manually setting Administrative distance
  2. Route tags
  3. Using metric and metric types

We will explore all 3. But first, let's get a baseline of what is happening. For starting configs consider my previous redistribution post.

Router R1

R1#show ip route
10.0.0.0/27 is subnetted, 2 subnets
C 10.0.0.0 is directly connected, FastEthernet1/0
O 10.0.0.32 [110/2] via 10.0.0.3, 00:34:18, FastEthernet1/0
192.168.1.0/27 is subnetted, 2 subnets
O E2 192.168.1.32 [110/20] via 10.0.0.3, 00:34:18, FastEthernet1/0
C 192.168.1.0 is directly connected, FastEthernet1/1
R1#traceroute 192.168.1.34
Translating "192.168.1.34"

Type escape sequence to abort.
Tracing the route to 192.168.1.34

1 10.0.0.3 56 msec 52 msec 20 msec
2 10.0.0.34 44 msec * 28 msec
3 192.168.1.34 64 msec * 60 msec
R1#
!--R1 is taking a suboptimal path to get to R4 fast1/1.

First let's manipulate the Administrative distance to fix this.

Router R1

R1#show run | sec ospf
!
router ospf 1
log-adjacency-changes
redistribute rip subnets
network 10.0.0.0 0.0.0.255 area 0
distance ospf external 125
!--Any external route in OSPF is now assigned a AD of 125 which is worse than the RIP AD (120) So we are now using the RIP learned route from R4 to get to R4 fast1/1. Note that you can add an access list at the end of the distance command to fine tune the external routes which will be assigned this new AD.

!
R1#show ip route
10.0.0.0/27 is subnetted, 2 subnets
C 10.0.0.0 is directly connected, FastEthernet1/0
O 10.0.0.32 [110/2] via 10.0.0.3, 00:02:01, FastEthernet1/0
192.168.1.0/27 is subnetted, 2 subnets
R 192.168.1.32 [120/1] via 192.168.1.4, 00:00:07, FastEthernet1/1
C 192.168.1.0 is directly connected, FastEthernet1/1
R1#traceroute 192.168.1.34
Translating "192.168.1.34"

Type escape sequence to abort.
Tracing the route to 192.168.1.34

1 192.168.1.4 68 msec * 44 msec
R1#

!

Another way to manipulate the AD with a certain router ID.

Router R1

R1#show ip ospf database
Type-5 AS External Link States

Link ID ADV Router Age Seq# Checksum Tag
192.168.1.0 10.0.0.1 1083 0x80000002 0x000E3B 0
192.168.1.32 192.168.1.33 1642 0x80000002 0x005355 0

Notice that the adv router id is 192.168.1.33.

R1#show run | sec ospf
!
router ospf 1
log-adjacency-changes
redistribute rip subnets
network 10.0.0.0 0.0.0.255 area 0
distance 125 192.168.1.33 0.0.0.0
!--Any external route originated by router id 192.168.1.33 (R2) is assigned an AD for 125. You can also apply access-list to fine tune the external routes from 192.168.1.33 (R2) which will get the AD of 125.

!
R1#show ip route
10.0.0.0/27 is subnetted, 2 subnets
C 10.0.0.0 is directly connected, FastEthernet1/0
O 10.0.0.32 [110/2] via 10.0.0.3, 00:02:01, FastEthernet1/0
192.168.1.0/27 is subnetted, 2 subnets
R 192.168.1.32 [120/1] via 192.168.1.4, 00:00:07, FastEthernet1/1
C 192.168.1.0 is directly connected, FastEthernet1/1
R1#traceroute 192.168.1.34
Translating "192.168.1.34"

Type escape sequence to abort.
Tracing the route to 192.168.1.34

1 192.168.1.4 68 msec * 44 msec
R1#

!

Part 2 shows how we can prevent sub-optimal routing by using route tags.