I have a home lab setup with three 3640 routers, easily named and connected as "Top", "Left", and "Right". They are connected in a triangle, with the top router on the top and the other two on the bottom. Each router has 2 serial cables connecting it to the other 2 routers, and each router has a loopback configured.
The link on the bottom is RIPv2, and the left side and right side links are running OSPF. I am redistributing from RIP to OSPF on the 2 bottom routers so that the top router can reach the bottom link. Everything is hunky-dory, except that suboptimal routes are being introduced due to OSPF having a lower AD than RIP - so the left router will reach the right router's loopback via the top router - taking a longer path through 2 serial ports because the OSPF route is preferred over the shorter RIP route. Fine - I understand this.
My idea was this - why not configure an access list permitting the RIP routes (the bottom serial link and the bottom two routers' loopbacks), and then apply a distance command of 125 in ospf using that access-list. I read in the CCNP book that this is a good way to prevent suboptimal routes from being installed in the routing table.
What happened, in effect, was this:
before distance command, the top router would reach the left router's loopback via it's serial connection to the left router.
after the distance command, the top router had 2 equal cost paths to the left router's loopback, one via the left router and the other via the right router.
the right router originated an LSA advertising the left router's loopack address via itself when I configured the distance command.
Here are the pertinent details of the routing table:
O E1 172.16.3.0 [110/84] via 172.16.2.2, 00:05:50, Serial1/0
O E1 172.16.3.0 [110/84] via 172.16.6.2, 00:00:20, Serial1/1
[110/84] via 172.16.2.2, 00:00:20, Serial1/0
172.16.2.2 is the left router
172.16.6.2 is the right router with the distance command configured.
Any help would be greatly appreciated. Also any advice on a perhaps better way to avoid suboptimal routes that does not involve originating routes that a router should really not originate.
Cheers and thanks in advance.
The reason that the top only has one route for either left or right loopback prior to configuring the distance command, is because the other router uses the route from the top to get to the other router loopback.
IE. Left will use the route to right loopback, that it learns from top, which in turn learns it from right. Right will use route route to left loopback which it learns from top, which top learns from left.
This is because left and right have two possible routes to each others loopback, one via rip AD 120, and one via ospf AD 110, so ospf wins!
When you config the distance command, ospf does not win, rip does, so both left and right redistribute all their rip routes, which include each others loopbacks, into ospf, so top now has two routes to left and right loopback.
Always remember the golden rule, that a router will only redistribute a route from one protocol to another, if it is using that route! In this case, left is not using the route via rip to right loopback, so it does not redistribute right loopback into ospf, and vice versa!