Showing posts with label routing. Show all posts
Showing posts with label routing. Show all posts
The BIG lab - Part 8 - Route-filtering and fixing route recursion using a distribute list (2.90)

The BIG lab - Part 8 - Route-filtering and fixing route recursion using a distribute list (2.90)

Following on from part 7 when we created a tunnel between R5 and R10 (refer to part 1 for the topology) we have a little bit of tidying up to do (basically static routes are verboten on the proper exam), but first we are going to have a dip into filtering some routes.

We can be a bit creative and prevent routers from learning about specific routes - say for instance we have a "secure" network that we don't want to be advertised to some routers, depending on where we are limiting access to we have a number of options, including access-lists, prefix-lists, distribute-lists and route-maps. We arn't going to use a route-map to prevent a route, as these are mainly used during redistribution, but we can play around with access-lists, prefix-lists and distribute-lists.

R1 has a loopback interface, which will be our "secure network":
R1#sh run int lo0
Building configuration...

Current configuration : 95 bytes
!
interface Loopback0
 ip address 10.10.1.1 255.255.255.0
 ip ospf network point-to-point
end
This is accessible by R10:
R10#ping 10.10.1.1
Type escape sequence to abort.

Sending 5, 100-byte ICMP Echos to 10.10.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 36/36/36 ms

R10#
R10#sh ip route 10.10.1.0
Routing entry for 10.10.1.0/24
 Known via "eigrp 10", distance 170, metric 2937856, type external
 Redistributing via eigrp 10
Last update from 10.31.1.1 on Serial1/0, 00:22:07 ago
 Routing Descriptor Blocks:
 * 10.31.1.1, from 10.31.1.1, 00:22:07 ago, via Serial1/0
   Route metric is 2937856, traffic share count is 1
   Total delay is 50000 microseconds, minimum bandwidth is 1544 Kbit
   Reliability 255/255, minimum MTU 1500 bytes
   Loading 1/255, Hops 2
R10#

Controlling routes through an access-list

So assuming that everything before R10 is allowed to this "private" network we need to prevent R10 from seeing this route (but lets keep access to R1's interface (1.2.3.4/24) accessible. we can do this in a number of ways. The most obvious place to put any configuration would be on R8's s0/2 interface.

I am going to use a distribute list for this, which references an access-list.
router eigrp 10
 distribute-list 1 out Serial0/2
 network 10.0.0.0
 no auto-summary
!
access-list 1 deny 10.10.1.0 0.0.0.255
access-list 1 permit any
Then I shut down the S0/2 interface on R8, cleared the IP routing table on R10 using "clear ip route *" and brought up the S0/2 interface on R8.

And now do we see the 10.10.1.0/24 network magically disappear from R10?
R10#sh ip route | beg 10.10
D EX  10.10.1.0/24 [170/27136000] via 10.120.2.1, 00:02:47, Tunnel0
D     10.20.1.0/24 [90/3193856] via 10.31.1.1, 00:02:47, Serial1/0
No, it has now learned it from its tunnel interface, that we created in part 7.

So let's add the same access-list to R5 (the other end of the tunnel):
R5(config)#access-list 1 deny 10.10.1.0 0.0.0.255
R5(config)#access-list 1 permit any
R5(config)#router eigrp 10
R5(config-router)#distribute-list 1 out Tunnel 0
R5(config-router)#exit
R5(config)#int tunnel 0
R5(config-if)#shut
Now let's clear the route from R10 
R10#
*Nov 25 13:06:24.635: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.120.2.1 (Tunnel0) is down: holding time expired
R10#sh ip route | i 10.10
R10#
And bring the tunnel back up again, does R10 still have a route to the loopback on R1?
R10#
*Nov 25 13:10:36.375: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.120.2.1 (Tunnel0) is up: new adjacency
R10#sh ip route | i 10.10
R10#
No, it doesn't.

Controlling routes through a prefix-list

Suppose we are told (for some reason) that we are not allowed to use an access-list, we could use a prefix list. So let's first put the 10.10.1.0/24 network back onto R10.
R10#
*Nov 25 13:17:31.431: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.120.2.1 (Tunnel0) is down: peer restarted
R10#
*Nov 25 13:17:35.935: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.120.2.1 (Tunnel0) is up: new adjacency
R10#sh ip route | i 10.10
D EX  10.10.1.0/24 [170/27136000] via 10.120.2.1, 00:00:31, Tunnel0
R10#sh ip route | i 10.10
D EX  10.10.1.0/24 [170/2937856] via 10.31.1.1, 00:00:01, Serial1/0
R10#
*Nov 25 13:18:08.659: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.31.1.1 (Serial1/0) is resync: peer graceful-restart
R10#sh ip route | i 10.10
D EX  10.10.1.0/24 [170/2937856] via 10.31.1.1, 00:00:13, Serial1/0
R10#
We can also use a prefix-list to accomplish the same thing, again we will need to put it on both R8 and R5
R8(config)#ip prefix-list deny-10.10.1.0 seq 5 deny 10.10.1.0/24
R8(config)#router eigrp 10
R8(config-router)#distribute-list prefix deny-10.10.1.0 out s0/2
R8(config-router)#
*Nov 25 13:21:29.207: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.31.1.2 (Serial0/2) is resync: route configuration changed
R8(config-router)#
We can see that EIGRP does its stuff, and again R10 gets its path to 10.10.1.0/24 through the tunnel.
R10#sh ip route | i 10.10
D EX  10.10.1.0/24 [170/2937856] via 10.31.1.1, 00:03:19, Serial1/0
R10#
*Nov 25 13:21:29.223: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.31.1.1 (Serial1/0) is resync: peer graceful-restart
R10#sh ip route | i 10.10
D EX  10.10.1.0/24 [170/27136000] via 10.120.2.1, 00:00:08, Tunnel0
So lets do the same commands on R5:
R5(config)#ip prefix-list deny-10.10.1.0 seq 5 deny 10.10.1.0/24
R5(config)#router eigrp 10
R5(config-router)#distribute-list prefix deny-10.10.1.0 out tunnel 0
R5(config-router)#exit

R10#sh ip route | i 10.10
D EX  10.10.1.0/24 [170/27136000] via 10.120.2.1, 00:00:08, Tunnel0
R10#
*Nov 25 13:23:50.015: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.120.2.1 (Tunnel0) is resync: peer graceful-restart
R10#sh ip route | i 10.10
R10#
Now R10 has no knowledge of the 10.10.1.0/24 network, but has also lost many of the other routes:
R10#sh ip route | beg Gateway

Gateway of last resort is not set
   10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
S    10.1.7.1/32 is directly connected, Serial1/0
C    10.31.1.0/24 is directly connected, Serial1/0
L    10.31.1.2/32 is directly connected, Serial1/0
C    10.120.2.0/24 is directly connected, Tunnel0
L    10.120.2.2/32 is directly connected, Tunnel0
   172.20.0.0/16 is variably subnetted, 9 subnets, 3 masks
C    172.20.20.0/24 is directly connected, Loopback0
L    172.20.20.1/32 is directly connected, Loopback0
C    172.20.30.0/24 is directly connected, Loopback1
L    172.20.30.1/32 is directly connected, Loopback1
D    172.20.40.0/23 is a summary, 00:40:49, Null0
C    172.20.40.0/24 is directly connected, Loopback2
L    172.20.40.1/32 is directly connected, Loopback2
C    172.20.41.0/24 is directly connected, Loopback3
L    172.20.41.1/32 is directly connected, Loopback3
R10 has lost the other routes due to a default deny in the prefix-list. We can overcome this by adding the following permit any any rule:
R8(config)#ip prefix-list deny-10.10.1.0 seq 10 permit 0.0.0.0/0 le 32

R5(config)#ip prefix-list deny-10.10.1.0 seq 10 permit 0.0.0.0/0 le 32
And now R10 can still reach R1, but on a different IP address:
R10#ping 1.2.3.4

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.2.3.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/35/40 ms
R10#

Fixing recursive routing using a distribute list

Remember back in part 7 when we set up our tunnel, to avoid route recursion and that annoying %TUN-5-RECURDOWN error we had to add a few static routes, well Cisco (in the exam at least) don't like you to use static routes, if they did then the exam would be so much easier, and where would the fun in that be? So what can we do to keep our tunnel working and still control our metrics?

Lets start by shutting down our tunnel and removing the static routes:
R5(config)#int tunnel 0
R5(config-if)#shut
R5(config-if)#
*Nov 25 14:33:24.711: %DUAL-5-NBRCHANGE: EIGRP-IPv4 10: Neighbor 10.120.2.2 (Tunnel0) is down: interface down
R5(config-if)#exit
R5(config)#
*Nov 25 14:33:26.711: %LINK-5-CHANGED: Interface Tunnel0, changed state to administratively down
*Nov 25 14:33:27.715: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to down
R5(config)#no ip route 172.20.40.0 255.255.255.0 Serial0/0
R5(config)#no ip route 172.20.40.0 255.255.255.0 Serial 0/2 10

R10(config)#int tunnel 0
R10(config-if)#shut
*Nov 25 14:34:27.411: %LINK-5-CHANGED: Interface Tunnel0, changed state to administratively down
*Nov 25 14:34:28.411: %LINEPROTO-5-UPDOWN: Line protocol on Interface Tunnel0, changed state to down
R10(config-if)#no ip route 10.1.7.1 255.255.255.255 Serial1/0
R10 knows of 10.1.7.0/24 through EIGRP, so the easiest thing to do is to use an incoming distribute list, coupled with an ACL to deny the EIGRP process from learning about the tunnel endpoint on R10. R5 is being used as this is the router that is complaining about route recursion.
router eigrp 10
 distribute-list prefix deny-10.10.1.0 out Tunnel0
 distribute-list 20 in
 network 10.0.0.0
 redistribute rip metric 10000 1000 255 1 1500
 no auto-summary
!
ip prefix-list deny-10.10.1.0 seq 5 deny 10.10.1.0/24
ip prefix-list deny-10.10.1.0 seq 10 permit 0.0.0.0/0 le 32
access-list 20 deny 10.120.2.2
And with this in place our tunnel is stable and we have avoided using any static routes.

In part 9 we will add IPv6 onto our network, which should be interesting!
The BIG lab - Part 6 - Route Redistribution (2.90)

The BIG lab - Part 6 - Route Redistribution (2.90)

We have now reached part 6 of this series, we have OSPF, RIP and EIGRP working in our network, but at the moment these networks are all self-contained and have visibility only within their own routing processes. So lets do some redistribution between them and get all of our networks talking to each other and have some end-to-end visibilty.

We will redistribute OSPF into RIP and EIGRP into RIP, and hopefully at the end of this post we should have working routes all the way from R1 (OSPF) through our RIP routers all the way over to R10 (EIGRP).

So what is redistribution? Well, hopefully you have already covered this in the CCNP, but if not (and hopefully this series has been a good start for those doing the CCNA, CCNP or CCIE), then we'll briefly cover the basics of redistribution before we put this into our topology.

Route Redistribution

In small scale networks it's often the case that one routing protocol is used, as the networks grow, and expand there may be the need (such as migrating from one routing protocol to another) that different IGPs are used. Route redistribution allows for routes from one routing protocol to be advertised into another. These redistributed routes will be learned as external routes, and as such usually have a higher (therefore less preferred) metric to the local routes.

For redistribution to work we need a router to run both routing protocols, having one interface in each of the different routing domains.

In our topology R4 will handle redistribution between OSPF and RIP, and both R4 and R5 will handle redistribution between RIP and EIGRP. It is the redistribution between RIP and EIGRP that will cause us some potential issues, and to understand why we need to have a quick look at Administrative Distances.

Administrative Distances

The default Administrative Distances (AD) are as follows, and the ones we need to concern ourselves with are bolded:


Routing Protocol Administrative Distance
Connected interface 0
Static route 1
EIGRP Summary route 5
External BGP 20
Internal EIGRP 90
IGRP 100
OSPF 110
IS-IS 115
RIP 120
EGP 140
ODR 160
External EIGRP 170
Internal BGP 200
Because OSPF into RIP only has one redistribution point (R4) then we will be OK, but because EIGRP into RIP has two redistribution points (R4 and R5) we will have EIGRP summary routes (that we set up in the previous lab) with an AD of 5, Internal EIGRP (on R4 and R5) with an AD of 90 being redistributed into RIP (AD of 120), and it is these internal EIGRP routes that might cause us an issue, as lower AD is preferred. In short we have the potential for a routing loop. If we do encounter any issues then we can look at distribution-lists or route-tagging to overcome any issues. I have covered routing loops before, so this will be a good refresher. Like they say though the proof is in the pudding, so let's get on and get started.

Redistributing RIP into EIGRP

EIGRP uses bandwidth and delay as its main metrics, but will also use reliability, load and MTU.

We start by entering the EIGRP process on R5
R5(config)#router eigrp 10
R5(config-router)#redistribute rip ?
     metric     Metric for redistributed routes
     route-map  Route map reference
R5(config-router)#redistribute rip metric ?
     <1-4294967295>  Bandwidth metric in Kbits per second
The first metric we need to set is the bandwidth, so lets set this as 10000. The next next metric is delay, which we will set at 1000
R5(config-router)#redistribute rip metric 10000 ?
      <0-4294967295>  EIGRP delay metric, in 10 microsecond units
Thankfully IOS is very helpful and gives us a good idea for how we should set our metrics. So for the next metric, which is reliability we know that 255 is the most reliable
R5(config-router)#redistribute rip metric 10000 1000 ?
     <0-255>  EIGRP reliability metric where 255 is 100% reliable
And for load we should set it at the lowest possible (1)
R5(config-router)#redistribute rip metric 10000 1000 255 ?
     <1-255>  EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded
Lastly we can set the MTU at 1500.
R5(config-router)#redistribute rip metric 10000 1000 255 1 ?
     <1-65535>  EIGRP MTU of the path
And thats it the full command would be:
R5(config-router)#redistribute rip metric 10000 1000 255 1 1500
We do the same on R4:
R4(config)#router eigrp 10
R4(config-router)#redistribute rip metric 10000 1000 255 1 1500
R4(config-router)#exit
R4(config)#exit

Redistributing EIGRP into RIP

Not much has, so far, changed within our routing tables on R4 or R5, which is not overly surprising. So let's redistribute EIGRP into RIP. The commands to use are:
R5(config)#router rip
R5(config-router)#redistribute eigrp 10 metric 2
R5(config-router)#exit
R5(config)#exit
And this is identical for R4 The command specifies that we are redistributing eigrp AS 10 into RIP and setting the metric (and RIP only uses hop count for its calculations) at 2. If a metric is not supplied RIP will assume a metric of 0 and will not advertise the redistributed routes.

Confirming mutual redistribution between RIP and EIGRP

R6 is a good router to look at to check for our redistributed EIGRP routes. Without any redistribution the routing table for R6 looks like this:

R6#sh ip route | beg Gate
Gateway of last resort is not set       
   10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
R        10.20.1.0/24 [120/1] via 10.20.2.1, 00:00:00, Serial0/0
C        10.20.2.0/24 is directly connected, Serial0/0
L        10.20.2.2/32 is directly connected, Serial0/0
R        10.35.1.0/24 [120/1] via 10.20.2.1, 00:00:00, Serial0/0

(Note that R7 is currently turned off...)

After redistributing RIP into EIGRP, and EIGRP into RIP, the routing table on R6 looks like this:

R6#sh ip route | beg Gate
Gateway of last resort is not set       
   10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
R        10.20.1.0/24 [120/1] via 10.20.2.1, 00:00:00, Serial0/0
C        10.20.2.0/24 is directly connected, Serial0/0
L        10.20.2.2/32 is directly connected, Serial0/0
R        10.25.1.0/24 [120/2] via 10.20.2.1, 00:00:00, Serial0/0
R        10.30.1.0/24 [120/2] via 10.20.2.1, 00:00:00, Serial0/0
R        10.31.1.0/24 [120/2] via 10.20.2.1, 00:00:00, Serial0/0
R        10.35.1.0/24 [120/1] via 10.20.2.1, 00:00:00, Serial0/0      
   172.20.0.0/16 is variably subnetted, 3 subnets, 2 masks
R        172.20.20.0/24 [120/2] via 10.20.2.1, 00:00:00, Serial0/0
R        172.20.30.0/24 [120/2] via 10.20.2.1, 00:00:00, Serial0/0
R        172.20.40.0/23 [120/2] via 10.20.2.1, 00:00:00, Serial0/0

So we can see that R6 which is just running RIP, now knows of the EIGRP network, and has learned the EIGRP routes through our redistribution, and they have an AD of 120, and a hop count of 2We can also look at R10 to see the effects of redistribution. 

Before we started to redistribute the routing table of R10 looked like this:

R10#sh ip route | beg Gate
Gateway of last resort is not set       
   10.0.0.0/8 is variably subnetted, 7 subnets, 2 masks
D        10.20.1.0/24 [90/3193856] via 10.31.1.1, 00:02:23, Serial1/0
D        10.20.2.0/24 [90/3705856] via 10.31.1.1, 00:02:23, Serial1/0
D        10.25.1.0/24 [90/2681856] via 10.31.1.1, 00:02:23, Serial1/0
D        10.30.1.0/24 [90/2681856] via 10.31.1.1, 00:02:23, Serial1/0
C        10.31.1.0/24 is directly connected, Serial1/0
L        10.31.1.2/32 is directly connected, Serial1/0
D        10.35.1.0/24 [90/41536000] via 10.31.1.1, 00:02:23, Serial1/0       
   172.20.0.0/16 is variably subnetted, 9 subnets, 3 masks
C        172.20.20.0/24 is directly connected, Loopback0
L        172.20.20.1/32 is directly connected, Loopback0
C        172.20.30.0/24 is directly connected, Loopback1
L        172.20.30.1/32 is directly connected, Loopback1
D        172.20.40.0/23 is a summary, 00:02:25, Null0
C        172.20.40.0/24 is directly connected, Loopback2
L        172.20.40.1/32 is directly connected, Loopback2
C        172.20.41.0/24 is directly connected, Loopback3
L        172.20.41.1/32 is directly connected, Loopback3

And once we turn on R7 it now looks like this:

R10#sh ip route | beg Gate
Gateway of last resort is not set       
   10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
D        10.20.1.0/24 [90/3193856] via 10.31.1.1, 00:19:27, Serial1/0
D        10.20.2.0/24 [90/3705856] via 10.31.1.1, 00:19:27, Serial1/0
D EX     10.20.3.0/24 [170/2937856] via 10.31.1.1, 00:06:31, Serial1/0
D        10.25.1.0/24 [90/2681856] via 10.31.1.1, 00:19:27, Serial1/0
D        10.30.1.0/24 [90/2681856] via 10.31.1.1, 00:19:27, Serial1/0
C        10.31.1.0/24 is directly connected, Serial1/0
L        10.31.1.2/32 is directly connected, Serial1/0
D        10.35.1.0/24 [90/41536000] via 10.31.1.1, 00:19:27, Serial1/0
D EX     10.60.1.0/24 [170/2937856] via 10.31.1.1, 00:06:12, Serial1/0       
   172.20.0.0/16 is variably subnetted, 9 subnets, 3 masks
C        172.20.20.0/24 is directly connected, Loopback0
L        172.20.20.1/32 is directly connected, Loopback0
C        172.20.30.0/24 is directly connected, Loopback1
L        172.20.30.1/32 is directly connected, Loopback1
D        172.20.40.0/23 is a summary, 00:19:44, Null0
C        172.20.40.0/24 is directly connected, Loopback2
L        172.20.40.1/32 is directly connected, Loopback2
C        172.20.41.0/24 is directly connected, Loopback3
L        172.20.41.1/32 is directly connected, Loopback3
We can see that R7 has the following IP addresses assigned to it:
R7#sh ip int bri
Interface          IP-Address  OK? Method  Status                           Protocol
Serial0/0         unassigned YES TFTP      administratively down down
Serial0/1         10.20.3.2     YES TFTP      up                                 up
Serial0/2         unassigned YES TFTP      administratively down down
Serial0/3         unassigned YES TFTP      administratively down down
Loopback0     10.60.1.1     YES TFTP      up                                 up

So R10 now knows of both the 10.20.3.0/24 network and the 10.60.1.0/24 network, and that they are being advertised as an EIGRP External (D EX) with an AD of 170. We can confirm reachability as well:

R10#ping 10.60.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.60.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 44/44/48 ms
R10#

Mutual redistribution of RIP and OSPF

Lets start by redistributing RIP into OSPF
R2's current routing table looks like this (with R12, R13 and R14 turned off - due to not wanting to completely drain my laptop resources):

R2#sh ip route | beg Gate
Gateway of last resort is not set
      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.2.3.0/24 is directly connected, Multilink1
L        1.2.3.5/32 is directly connected, Multilink1
      10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
C        10.1.1.0/24 is directly connected, Serial0/2
L        10.1.1.1/32 is directly connected, Serial0/2
O IA     10.1.2.0/24 [110/128] via 10.1.1.2, 00:04:00, Serial0/2
C        10.1.6.0/24 is directly connected, Serial0/3
L        10.1.6.1/32 is directly connected, Serial0/3
O IA     10.10.1.0/24 [110/33] via 1.2.3.4, 00:04:00, Multilink1

We can see that we have some OSPF Inter-Area routes (denoted by O IA).

Once R4 is added to the OSPF domain via it's s0/0 interface in area 3, the routing table looks like this:

R4#sh ip route | beg Gate
Gateway of last resort is not set
      1.0.0.0/24 is subnetted, 1 subnets
O IA     1.2.3.0 [110/96] via 10.1.6.1, 00:01:41, Serial0/0
      10.0.0.0/8 is variably subnetted, 15 subnets, 2 masks
O IA     10.1.1.0/24 [110/128] via 10.1.6.1, 00:01:41, Serial0/0
O IA     10.1.2.0/24 [110/192] via 10.1.6.1, 00:01:41, Serial0/0
C        10.1.6.0/24 is directly connected, Serial0/0
L        10.1.6.2/32 is directly connected, Serial0/0
O IA     10.10.1.0/24 [110/97] via 10.1.6.1, 00:01:41, Serial0/0
C        10.20.1.0/24 is directly connected, Serial0/1
L        10.20.1.1/32 is directly connected, Serial0/1
D        10.20.2.0/24 [90/2681856] via 10.20.1.2, 00:02:09, Serial0/1
R        10.20.3.0/24 [120/2] via 10.20.1.2, 00:00:06, Serial0/1
C        10.25.1.0/24 is directly connected, Serial0/2
L        10.25.1.1/32 is directly connected, Serial0/2
D        10.30.1.0/24 [90/2681856] via 10.25.1.2, 00:02:13, Serial0/2
D        10.31.1.0/24 [90/2681856] via 10.25.1.2, 00:02:13, Serial0/2
D        10.35.1.0/24 [90/41024000] via 10.20.1.2, 00:02:13, Serial0/1
R        10.60.1.0/24 [120/3] via 10.20.1.2, 00:00:10, Serial0/1
      172.20.0.0/16 is variably subnetted, 3 subnets, 2 masks
D        172.20.20.0/24 [90/2809856] via 10.25.1.2, 00:02:13, Serial0/2
D        172.20.30.0/24 [90/2809856] via 10.25.1.2, 00:02:13, Serial0/2
D        172.20.40.0/23 [90/2809856] via 10.25.1.2, 00:02:13, Serial0/2
R4(config)#router rip
R4(config-router)#redistribute ospf 1 metric 2
R6's routing table now looks like this:

R6#sh ip route | beg Gate
Gateway of last resort is not set
      1.0.0.0/24 is subnetted, 1 subnets
R        1.2.3.0 [120/3] via 10.20.2.1, 00:00:28, Serial0/0
      10.0.0.0/8 is variably subnetted, 14 subnets, 2 masks
R        10.1.1.0/24 [120/3] via 10.20.2.1, 00:00:28, Serial0/0
R        10.1.2.0/24 [120/3] via 10.20.2.1, 00:00:28, Serial0/0
R        10.1.6.0/24 [120/2] via 10.20.2.1, 00:00:28, Serial0/0
R        10.10.1.0/24 [120/3] via 10.20.2.1, 00:00:28, Serial0/0
R        10.20.1.0/24 [120/1] via 10.20.2.1, 00:00:28, Serial0/0
C        10.20.2.0/24 is directly connected, Serial0/0
L        10.20.2.2/32 is directly connected, Serial0/0
C        10.20.3.0/24 is directly connected, Serial0/1
L        10.20.3.1/32 is directly connected, Serial0/1
R        10.25.1.0/24 [120/2] via 10.20.2.1, 00:00:28, Serial0/0
R        10.30.1.0/24 [120/2] via 10.20.2.1, 00:00:28, Serial0/0
R        10.31.1.0/24 [120/2] via 10.20.2.1, 00:00:28, Serial0/0
R        10.35.1.0/24 [120/1] via 10.20.2.1, 00:00:28, Serial0/0
R        10.60.1.0/24 [120/1] via 10.20.3.2, 00:00:05, Serial0/1
      172.20.0.0/16 is variably subnetted, 3 subnets, 2 masks
R        172.20.20.0/24 [120/2] via 10.20.2.1, 00:00:28, Serial0/0
R        172.20.30.0/24 [120/2] via 10.20.2.1, 00:00:28, Serial0/0
R        172.20.40.0/23 [120/2] via 10.20.2.1, 00:00:28, Serial0/0

And R10's looks like this:

R10#sh ip route | beg Gate
Gateway of last resort is not set
      1.0.0.0/24 is subnetted, 1 subnets
D EX     1.2.3.0 [170/41792000] via 10.31.1.1, 00:01:58, Serial1/0
      10.0.0.0/8 is variably subnetted, 13 subnets, 2 masks
D EX     10.1.1.0/24 [170/41792000] via 10.31.1.1, 00:01:58, Serial1/0
D EX     10.1.2.0/24 [170/41792000] via 10.31.1.1, 00:01:58, Serial1/0
D        10.1.6.0/24 [90/3193856] via 10.31.1.1, 00:05:50, Serial1/0
D EX     10.10.1.0/24 [170/41792000] via 10.31.1.1, 00:01:58, Serial1/0
D        10.20.1.0/24 [90/3193856] via 10.31.1.1, 00:40:20, Serial1/0
D        10.20.2.0/24 [90/3705856] via 10.31.1.1, 00:40:20, Serial1/0
D EX     10.20.3.0/24 [170/2937856] via 10.31.1.1, 00:27:24, Serial1/0
D        10.25.1.0/24 [90/2681856] via 10.31.1.1, 00:40:20, Serial1/0
D        10.30.1.0/24 [90/2681856] via 10.31.1.1, 00:40:20, Serial1/0
C        10.31.1.0/24 is directly connected, Serial1/0
L        10.31.1.2/32 is directly connected, Serial1/0
D        10.35.1.0/24 [90/41536000] via 10.31.1.1, 00:40:20, Serial1/0
D EX     10.60.1.0/24 [170/2937856] via 10.31.1.1, 00:27:05, Serial1/0
      172.20.0.0/16 is variably subnetted, 9 subnets, 3 masks
C        172.20.20.0/24 is directly connected, Loopback0
L        172.20.20.1/32 is directly connected, Loopback0
C        172.20.30.0/24 is directly connected, Loopback1
L        172.20.30.1/32 is directly connected, Loopback1

So R6 has learnt of the routes through RIP, and R10 has learnt of the OSPF routes via EIGRP.

Now lets send our RIP routes (and hopefully all of the redistributed EIGRP routes) into OSPF.

Before redistribution R1's routing table looks like this:

R1#sh ip route | beg Gate
Gateway of last resort is not set
      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.2.3.0/24 is directly connected, Multilink1
L        1.2.3.4/32 is directly connected, Multilink1
      10.0.0.0/8 is variably subnetted, 4 subnets, 2 masks
O        10.1.1.0/24 [110/96] via 1.2.3.5, 00:00:51, Multilink1
O IA     10.1.2.0/24 [110/160] via 1.2.3.5, 00:00:47, Multilink1
C        10.10.1.0/24 is directly connected, Loopback0
L        10.10.1.1/32 is directly connected, Loopback0
R4(config)#router ospf 1
R4(config-router)#redistribute rip subnets metric 2000
R1#sh ip route | beg Gate
Gateway of last resort is not set
      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.2.3.0/24 is directly connected, Multilink1
L        1.2.3.4/32 is directly connected, Multilink1
      10.0.0.0/8 is variably subnetted, 9 subnets, 2 masks
O        10.1.1.0/24 [110/96] via 1.2.3.5, 00:23:34, Multilink1
O IA     10.1.2.0/24 [110/160] via 1.2.3.5, 00:23:30, Multilink1
O IA     10.1.6.0/24 [110/96] via 1.2.3.5, 00:15:30, Multilink1
C        10.10.1.0/24 is directly connected, Loopback0
L        10.10.1.1/32 is directly connected, Loopback0
O E2     10.20.1.0/24 [110/20] via 1.2.3.5, 00:00:45, Multilink1
O E2     10.20.3.0/24 [110/20] via 1.2.3.5, 00:00:45, Multilink1
O E2     10.25.1.0/24 [110/20] via 1.2.3.5, 00:00:45, Multilink1
O E2     10.60.1.0/24 [110/20] via 1.2.3.5, 00:00:45, Multilink1

And now we can see that R1 has learnt of the RIP routes as OSFP External Type 2, but not the EIGRP, so lets just do the last couple of redistribution commands:
R4(config)#router eigrp 10
R4(config-router)#redistribute ospf 1 metric 10000 1000 255 1 1500
R4(config-router)#router ospf 1
R4(config-router)#redistribute eigrp 10 subnets metric 2222
R4(config-router)#exit
R4(config)#exit
And now we can see, using R1, R7 and R10 (as these are on the periphery of our network) that we have full reachability:

R1#sh ip route | beg Gate
Gateway of last resort is not set
      1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C        1.2.3.0/24 is directly connected, Multilink1
L        1.2.3.4/32 is directly connected, Multilink1
      10.0.0.0/8 is variably subnetted, 13 subnets, 2 masks
O        10.1.1.0/24 [110/96] via 1.2.3.5, 00:43:07, Multilink1
O IA     10.1.2.0/24 [110/160] via 1.2.3.5, 00:43:03, Multilink1
O IA     10.1.6.0/24 [110/96] via 1.2.3.5, 00:35:03, Multilink1
C        10.10.1.0/24 is directly connected, Loopback0
L        10.10.1.1/32 is directly connected, Loopback0
O E2     10.20.1.0/24 [110/2222] via 1.2.3.5, 00:05:06, Multilink1
O E2     10.20.2.0/24 [110/2222] via 1.2.3.5, 00:05:06, Multilink1
O E2     10.20.3.0/24 [110/2000] via 1.2.3.5, 00:17:35, Multilink1
O E2     10.25.1.0/24 [110/2222] via 1.2.3.5, 00:05:06, Multilink1
O E2     10.30.1.0/24 [110/2222] via 1.2.3.5, 00:05:06, Multilink1
O E2     10.31.1.0/24 [110/2222] via 1.2.3.5, 00:05:06, Multilink1
O E2     10.35.1.0/24 [110/2222] via 1.2.3.5, 00:05:06, Multilink1
O E2     10.60.1.0/24 [110/2000] via 1.2.3.5, 00:17:35, Multilink1
      172.20.0.0/16 is variably subnetted, 3 subnets, 2 masks
O E2     172.20.20.0/24 [110/2222] via 1.2.3.5, 00:05:06, Multilink1
O E2     172.20.30.0/24 [110/2222] via 1.2.3.5, 00:05:06, Multilink1
O E2     172.20.40.0/23 [110/2222] via 1.2.3.5, 00:05:06, Multilink1

R7#sh ip route | beg Gateway
Gateway of last resort is not set
      1.0.0.0/24 is subnetted, 1 subnets
R        1.2.3.0 [120/4] via 10.20.3.1, 00:00:28, Serial0/1
      10.0.0.0/8 is variably subnetted, 14 subnets, 2 masks
R        10.1.1.0/24 [120/4] via 10.20.3.1, 00:00:28, Serial0/1
R        10.1.2.0/24 [120/4] via 10.20.3.1, 00:00:28, Serial0/1
R        10.1.6.0/24 [120/3] via 10.20.3.1, 00:00:28, Serial0/1
R        10.10.1.0/24 [120/4] via 10.20.3.1, 00:00:28, Serial0/1
R        10.20.1.0/24 [120/2] via 10.20.3.1, 00:00:28, Serial0/1
R        10.20.2.0/24 [120/1] via 10.20.3.1, 00:00:28, Serial0/1
C        10.20.3.0/24 is directly connected, Serial0/1
L        10.20.3.2/32 is directly connected, Serial0/1
R        10.25.1.0/24 [120/3] via 10.20.3.1, 00:00:28, Serial0/1
R        10.30.1.0/24 [120/3] via 10.20.3.1, 00:00:28, Serial0/1
R        10.31.1.0/24 [120/3] via 10.20.3.1, 00:00:28, Serial0/1
R        10.35.1.0/24 [120/2] via 10.20.3.1, 00:00:28, Serial0/1
C        10.60.1.0/24 is directly connected, Loopback0
L        10.60.1.1/32 is directly connected, Loopback0
      172.20.0.0/16 is variably subnetted, 3 subnets, 2 masks
R        172.20.20.0/24 [120/3] via 10.20.3.1, 00:00:28, Serial0/1
R        172.20.30.0/24 [120/3] via 10.20.3.1, 00:00:28, Serial0/1
R        172.20.40.0/23 [120/3] via 10.20.3.1, 00:00:28, Serial0/1

R10#sh ip route | beg Gate
Gateway of last resort is not set
      1.0.0.0/24 is subnetted, 1 subnets
D EX     1.2.3.0 [170/2937856] via 10.31.1.1, 00:07:16, Serial1/0
      10.0.0.0/8 is variably subnetted, 13 subnets, 2 masks
D EX     10.1.1.0/24 [170/2937856] via 10.31.1.1, 00:07:16, Serial1/0
D EX     10.1.2.0/24 [170/2937856] via 10.31.1.1, 00:07:16, Serial1/0
D        10.1.6.0/24 [90/3193856] via 10.31.1.1, 00:32:34, Serial1/0
D EX     10.10.1.0/24 [170/2937856] via 10.31.1.1, 00:07:16, Serial1/0
D        10.20.1.0/24 [90/3193856] via 10.31.1.1, 01:07:04, Serial1/0
D        10.20.2.0/24 [90/3705856] via 10.31.1.1, 01:07:04, Serial1/0
D EX     10.20.3.0/24 [170/2937856] via 10.31.1.1, 00:54:08, Serial1/0
D        10.25.1.0/24 [90/2681856] via 10.31.1.1, 01:07:04, Serial1/0
D        10.30.1.0/24 [90/2681856] via 10.31.1.1, 01:07:04, Serial1/0
C        10.31.1.0/24 is directly connected, Serial1/0
L        10.31.1.2/32 is directly connected, Serial1/0
D        10.35.1.0/24 [90/41536000] via 10.31.1.1, 01:07:04, Serial1/0
D EX     10.60.1.0/24 [170/2937856] via 10.31.1.1, 00:53:49, Serial1/0
      172.20.0.0/16 is variably subnetted, 9 subnets, 3 masks
C        172.20.20.0/24 is directly connected, Loopback0
L        172.20.20.1/32 is directly connected, Loopback0
C        172.20.30.0/24 is directly connected, Loopback1
L        172.20.30.1/32 is directly connected, Loopback1
D        172.20.40.0/23 is a summary, 01:07:08, Null0
C        172.20.40.0/24 is directly connected, Loopback2
L        172.20.40.1/32 is directly connected, Loopback2
C        172.20.41.0/24 is directly connected, Loopback3
L        172.20.41.1/32 is directly connected, Loopback3

We have avoided routing loops in this scenario, but if the topology was the other way around, with EIGRP on the left hand side, and OSPF on the other, we would have had a routing loop on R4 and R5 into the OSPF domain. Thankfully this was not the case.

Now we can move on to Part 7 and set up a tunnel.

When Route Redistribution goes bad - Routing Loops and Route feedback (2.90)

When we are redistributing from one protocol into another, we find that with one point of redistribution everything is fine, but when we have multiple points of redistribution we can start to encounter problems, namely routing loops and route feedback. Thankfully these can be fixed with a few commands.

Routing loops

OSPF and RIP IOU NetMap


In the diagram above we are redistributing RIP into OSPF, and from OSPF into RIP. Ignore the mis-labelled interface for Router C (the interface in the RIP network is actually e0/1), I made a mistake in my original netmap. I wondered why things didn't work properly. Originally I did this in Packet Tracer, only to find a serious limitation was the lack of distribute-lists and limitations on the distance command.

If you want to follow this post through, then you can download the IOU lab from here.

First we begin with very straight-forward ospf and rip networks. Picking RouterA and RouterF, we quickly check that the basics are all plumbed in:

OSPF on Cisco IOU

OSPF looks good, so lets just check rip

RIP on Cisco IOU

OK, all looks good.

The routing tables on routers C and D look like this

Cisco IOU routing ospf and rip

Lets have a quick look at the routing tables of routers A and F

Cisco IOU routing ospf and rip

Making a routing loop

To create the routing loop we need to mutually redistribute OSPF and RIP on routers C and D. The commands are identical for both.

Cisco IOU mutual redistribution of rip and ospf

And we can see (using the "sh ip route" command) the contents of the routing table:


Now we can start to see the problem.

Router C which has an interface in the RIP network, has a route to the 10.1.X.0 through router A (apart from its own directly connected 10.1.1.0/24 network) - which is kind of in the wrong direction. Similarly Router D has routes all of the 10.1.X networks (apart from its own directly connected 10.1.5.0/24 network) through Router B. Again really this is in the wrong direction.

The reason for this because the AD (Administrative Distance) of OSPF (110) is lower than the AD for RIP (120), and therefore is the prefered route. The AD can be seen as the first number in the square brackets [110/1] and [120/1]. Therefore to reach the non-connected networks, Routers C and D will prefer the sub-optimal path through OSPF.

The end effect is that if Router C sends a a packet destined for the 10.1.5.0/24 network it will go to Router A first (192.168.1.1). This is Router A's routing table:

sh ip route loop

Router A will pass the packet to Router B, and from B it passes to Router D. This does not present its-self as much of an issue, but look at the routes for the 10.1.4/0/24 network.

A packet to the 10.1.4.0/24 network originating from Router C would pass to Router A. From Router A it would pass to Router B, and from B to D. Now here we see the loop:

cisco ios redistribution routing loop

The routing table for Router B is on the left and for Router D is on the right. As you can see Router B prefers Router D as the best route to the 10.1.4.0 network, and Router D prefers Router B as the best route. Thus we have a loop.

Fixing a routing loop

Thankfully all is not lost (well, maybe a few packets along the way), and we have two ways of fixing this scenario.

Fixing a routing loop with a distribution-list

The first method is to use a distribution-list and attach it to the interface we want to prevent accepting routes from the wrong side. The configuration on Router C would be as follows:

RouterC(config)# access-list 10 deny 10.1.2.0 0.0.0.255
RouterC(config)# access-list 10 deny 10.1.3.0 0.0.0.255
RouterC(config)# access-list 10 deny 10.1.4.0 0.0.0.255
RouterC(config)# access-list 10 deny 10.1.5.0 0.0.0.255
RouterC(config)# access-list 10 permit any

RouterC(config)# router opsf 1
RouterC(config-router)# distribute-list 10 in ethernet0/0

And Router D would look similar:

RouterC(config)# access-list 10 deny 10.1.1.0 0.0.0.255
RouterC(config)# access-list 10 deny 10.1.2.0 0.0.0.255
RouterC(config)# access-list 10 deny 10.1.3.0 0.0.0.255
RouterC(config)# access-list 10 deny 10.1.4.0 0.0.0.255
RouterC(config)# access-list 10 permit any

RouterC(config)# router opsf 1
RouterC(config-router)# distribute-list 10 in ethernet0/0

These access-lists deny the RIP networks specified, whilst permitting all the other networks. We can see this taking effect immediately in the routing table:

fixing routing loop with distribution-list

The downside of this method is that any form of redundancy is also lost. If Router C lost its e0/1 interface it would not be able to select an alternative path (i.e. through the RIP network) for the other OSPF networks.

distribution-list ios ospf rip


Fixing a routing loop with the distance command

The second method we have available is to tweak the AD for the specific routes. it is very similar to the first method, but with a few changes, we can either lower the AD of the routes learned through RIP, or raise the AD of the external OSPF learned routes. Again we start with an access list:

RouterC(config)# access-list 10 permit 10.1.2.0 0.0.0.255
RouterC(config)# access-list 10 permit 10.1.3.0 0.0.0.255
RouterC(config)# access-list 10 permit 10.1.4.0 0.0.0.255
RouterC(config)# access-list 10 permit 10.1.5.0 0.0.0.255
RouterC(config)# access-list 10 deny any

RouterC(config)# router rip
RouterC(config-router)# distance 70 10.1.1.0 0.0.0.255 10

Here we are applying a an AD of 70 for the routes specified in access list 10. Again Router D's config would be similar, but I think you can see what needs changing, so I wont put the config here.

The end result is that the routes originating from RIP will now have a lower AD than the routes that have been redistributed from OSPF. This eliminates the routing loop.

tune distance metrics rip ospf redistribution


If we decided that we wanted to use the second method and raise the AD for the external OSPF learned routes then we can do this with one line, and do not need the access list:

RouterC(config)# router ospf 1
RouterC(config-router)# distance ospf external 240

Router C and Router D then replaced the externally learned routes with the routers learned by its own RIP process:

change ospf external ad administrative distance

change ospf external ad administrative distance

Router D is probably the best example of the process, as the screenshot managed to catch the transition in routes, firstly as their AD is increased to 240, and then, moments later, as these routes are replaced by the ones originating from within RIP.

So that's routing loops taken care of, now lets move on.

Route feedback

The OSPF routes that have been redistributed into RIP by Router C will also reach Router D, and will again be redistributed back into OSPF. hence the term "feedback".

The feedback could very well cause Router B to prefer the route through RouterD for the 192.168.2.0/24 network. This is called suboptimal routing.

clearly we want to make sure that no re-injection occurs. We can do this through distribution lists and by using the distance command, but lets look at route tags instead.

We can tag routes in order to identify and filter them. The tag is retained as it passes from router to router. So a tag that is applied when it is redistributed into RIP (say from Router C) retains its tag and can be used by another router (Router D) to be filtered out.

We use route-maps in order to apply tags, these are similar to access-lists by using permit or deny statements but also allow attributes to be matched and set.

Using RouterC are the example, the route maps would look like this (I have added line numbers for reference later on) :

1. RouterC(config)# route-map ospf->rip deny 5
2. RouterC(config-route-map)# match tag 33
3. RouterC(config)# route-map ospf->rip permit 15
4. RouterC(config-route-map)# set tag 44
5. RouterC(config-route-map)# exit

6. RouterC(config)# router rip
7. RouterC(config-router)# redistribute ospf 1 route-map ospf->rip

8. RouterC(config)# route-map rip->ospf deny 5
9. RouterC(config-route-map)# match tag 44
10. RouterC(config-route-map)# route-map rip->ospf permit 15
11. RouterC(config-route-map)# set tag 33

12. RouterC(config)# router ospf 1
13. RouterC(config-router)# redistribute rip route-map rip->ospf

So here any OSPF routes that are being redistributed into RIP have a tag of 44 set (line 4). When RIP is redistributed back into OSPF any tag that matches 44 is denied (lines 8 and 9).

When RIP routes are being redistributed into OSPF they have a tag of 33 set (line 11). These routes are denied (line 1) when being redistributed from OSPF back into RIP (line 2). The ordering of these statements is crucial.

setting tag using route-map ospf rip redistribution

We can see above the tag being added to the routes. Unfortunately I could not get and routes to feedback to show you this in action, sometimes its annoying when things work properly!

Nonetheless, the end result is that routes will not be redistributed back into the routing domain from where they originated.

I hope you have found this useful.