Saturday, November 8, 2008

Mutual Redistribution


In this tutorial, I'd like to go through some elementary concepts of mutual redistribution. Redistribution is process by which the routes learnt by one routing protocol are injected into another routing protocol. These routes could be connected or static as well. An example would an organization having to run various routing protocols. In the topology below, OSPF is running for one half of the network and RIP running on the other as indicated by the dotted lines. R3 and R4 are running both OSPF and RIP.


Topology



Dynagen file
[[Router R1]]
model = 3640
console = 2001
autostart = false
slot0 = NM-4E
slot1 = NM-4T
E0/0 = R2 E0/0
S1/0 = R3 S1/0

[[Router R2]]
model = 3640
console = 2002
autostart = false
slot0 = NM-4E
slot1 = NM-4T
S1/0 = R4 S1/0

[[Router R3]]
model = 3640
console = 2003
autostart = false
slot0 = NM-4E
slot1 = NM-4T
E0/0 = R5 E0/0

[[Router R4]]
model = 3640
console = 2004
autostart = false
slot0 = NM-4E
slot1 = NM-4T
E0/0 = R5 E0/1

[[Router R5]]
model = 3640
console = 2005
autostart = false
slot0 = NM-4E
slot1 = NM-4T
E0/2 = LAN 1

Initial Configurations

R1

interface Ethernet0/0
ip address 192.168.4.1 255.255.255.0
half-duplex

interface Serial1/0
ip address 192.168.3.1 255.255.255.0
clock rate 128000

router ospf 1
router-id 1.1.1.1
log-adjacency-changes
network 192.168.3.1 0.0.0.0 area 0
network 192.168.4.1 0.0.0.0 area 0

R2
interface Ethernet0/0
ip address 192.168.4.2 255.255.255.0
half-duplex


interface Serial1/0
ip address 192.168.5.2 255.255.255.0
clock rate 128000

router ospf 1
router-id 2.2.2.2
log-adjacency-changes
network 192.168.4.2 0.0.0.0 area 0
network 192.168.5.2 0.0.0.0 area 0
R3
interface Ethernet0/0
ip address 192.168.2.3 255.255.255.0
half-duplex

interface Serial1/0
ip address 192.168.3.3 255.255.255.0

router ospf 1
router-id 3.3.3.3
log-adjacency-changes detail
network 192.168.3.3 0.0.0.0 area 0

router rip
passive-interface Serial1/0
network 192.168.2.0

R4
interface Ethernet0/0
ip address 192.168.6.4 255.255.255.0
half-duplex

interface Serial1/0
ip address 192.168.5.4 255.255.255.0
serial restart-delay 0

router ospf 1
router-id 4.4.4.4
log-adjacency-changes detail
network 192.168.5.4 0.0.0.0 area 0

router rip
passive-interface Serial1/0
network 192.168.6.0

R5

interface Ethernet0/0
ip address 192.168.2.5 255.255.255.0
half-duplex

interface Ethernet0/1
ip address 192.168.6.5 255.255.255.0
half-duplex

interface Ethernet0/2
ip address 192.168.1.5 255.255.255.0
half-duplex

router rip
network 192.168.1.0
network 192.168.2.0
network 192.168.6.0

On examining the route table of R1, it seen R1 has no idea of RIP routes. Obviously, OSPF is not advertising those routes. Since R3 and R4 are running both RIP and OSPF, mutual redistribution can be configured on those devices.

R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

O 192.168.4.0/24 [110/74] via 192.168.3.1, 00:04:49, Serial1/0
O 192.168.5.0/24 [110/138] via 192.168.3.1, 00:04:49, Serial1/0
R 192.168.6.0/24 [120/1] via 192.168.2.5, 00:00:19, Ethernet0/0
R 192.168.1.0/24 [120/1] via 192.168.2.5, 00:00:19, Ethernet0/0
C 192.168.2.0/24 is directly connected, Ethernet0/0
C 192.168.3.0/24 is directly connected, Serial1/0
R3#sh ip ospf database

OSPF Router with ID (3.3.3.3) (Process ID 1)

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 588 0x80000004 0x009D1F 3
2.2.2.2 2.2.2.2 585 0x80000003 0x00DECC 3
3.3.3.3 3.3.3.3 1179 0x80000002 0x00BDED 2
4.4.4.4 4.4.4.4 1163 0x80000003 0x00E3B5 2

Net Link States (Area 0)

Link ID ADV Router Age Seq# Checksum
192.168.4.2 2.2.2.2 585 0x80000002 0x00E5CF

R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.4.0/24 is directly connected, Ethernet0/0
O 192.168.5.0/24 [110/74] via 192.168.4.2, 00:03:55, Ethernet0/0
C 192.168.3.0/24 is directly connected, Serial1/0
Table 1 : Routing Tables and OSPF database

On R3 and R4, redistribution is configured. When redistributing a routing procotol, for instance, RIP into OSPF (receiving protocol), specify the protocol that must redistributed, in this case RIP and the metric associated with routes of the protocol being redistributed, unless a default-metric parameter is configured. Optional parameters can be specified [route-maps], which is outside the scope of this tutorial

R3(config-router)#redistribute rip metric 100
R4(config-router)#redistribute rip metric
100

Similarly we need redistribute OSPF into RIP

R3(config-router)#redistribute ospf 1 metric 2
R4(config-router)#redistribute ospf 1 metric 2


Lets take a look at R1 and R3 routing table now.
R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

O 192.168.4.0/24 [110/74] via 192.168.3.1, 00:04:31, Serial1/0
O 192.168.5.0/24 [110/138] via 192.168.3.1, 00:04:31, Serial1/0
O E2 192.168.6.0/24 [110/100] via 192.168.3.1, 00:02:20, Serial1/0
R 192.168.1.0/24 [120/1] via 192.168.2.5, 00:00:23, Ethernet0/0
C 192.168.2.0/24 is directly connected, Ethernet0/0
C 192.168.3.0/24 is directly connected, Serial1/0

R4#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

O 192.168.4.0/24 [110/74] via 192.168.5.2, 00:11:11, Serial1/0
C 192.168.5.0/24 is directly connected, Serial1/0
C 192.168.6.0/24 is directly connected, Ethernet0/0
O E2 192.168.1.0/24 [110/100] via 192.168.5.2, 00:07:41, Serial1/0
O E2 192.168.2.0/24 [110/100] via 192.168.5.2, 00:07:41, Serial1/0
O 192.168.3.0/24 [110/138] via 192.168.5.2, 00:11:11, Serial1/0

R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.4.0/24 is directly connected, Ethernet0/0
O 192.168.5.0/24 [110/74] via 192.168.4.2, 00:06:36, Ethernet0/0
O E2 192.168.6.0/24 [110/100] via 192.168.4.2, 00:04:25, Ethernet0/0
O E2 192.168.1.0/24 [110/100] via 192.168.3.3, 00:03:06, Serial1/0

O E2 192.168.2.0/24 [110/100] via 192.168.3.3, 00:03:06, Serial1/0
C 192.168.3.0/24 is directly connected, Serial1/0

Table 2 : R1 and R3 routing tables

We see R1 is learning RIP routes now as OSPF External Type 2, sweet. However, take a closer look at R3's routing table, it is now learning the route 192.168.0.6/24 via OSPF even when the same route via RIP is the optimal path. Similarly, R4 is learning routes to 192.168.1.0/24 and 192.168.2.0/24 via OSPF instead of RIP. When routes are advertised by two routing protocols, the router will always select the routes from the routing protocol which has a better administrative distance, in this case OSPF. We need to somehow tell the router to choose specific routes from a particular protocol and this is were distribute-lists comes in play.

By using a distribute list and applying it under the OSPF process of R3 and R4, specific routes learned via OSPF/RIP can be inserted into the routing table.

distribute-list [access-list no] in
applied under a routing process, specifies which routes learnt via the routing protocol should be filtered in the routing table.

Here, our objective is to permit 192.168.4.0/24 and 192.168.5.0/24 to be learnt via OSPF by R3 and 192.168.3.0/24 and 192.168.4.0/24 to be learnt via OSPF by R4. The similar logic is applied to the RIP routing process as well.

R3 configuration
access-list 1 permit 192.168.4.0 0.0.0.255
access-list 1 permit 192.168.5.0 0.0.0.255
access-list 2 permit 192.168.6.0 0.0.0.255
access-list 2 permit 192.168.1.0 0.0.0.255

router ospf 1
router-id 3.3.3.3
log-adjacency-changes detail
redistribute rip metric 100
network 192.168.3.3 0.0.0.0 area 0
distribute-list 1 in

router rip
passive-interface Serial1/0
network 192.168.2.0
distribute-list 2 in


access-list 1 permit 192.168.4.0 0.0.0.255
access-list 1 permit 192.168.3.0 0.0.0.255
access-list 2 permit 192.168.2.0 0.0.0.255
access-list 2 permit 192.168.1.0 0.0.0.255

router ospf 1
router-id 4.4.4.4
log-adjacency-changes detail
redistribute rip metric 100
network 192.168.5.4 0.0.0.0 area 0
distribute-list 1 in

router rip
redistribute ospf 1 metric 2
passive-interface Serial1/0
network 192.168.6.0
distribute-list 2 in

Please remember that applying a distribute-list [access-list no] in only filters routes from the routing table of R3 and R4 . R3 and R4 will continue to advertise LSAs for the following routes 192.168.0.2/24, 192.168.6.0/24, 192.168.1.0/24. By examining R1's routing table and R3's OSPF database, this can be verified.

R1#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C 192.168.4.0/24 is directly connected, Ethernet0/0
O 192.168.5.0/24 [110/74] via 192.168.4.2, 00:36:26, Ethernet0/0
O E2 192.168.6.0/24 [110/100] via 192.168.3.3, 00:09:31, Serial1/0
O E2 192.168.1.0/24 [110/100] via 192.168.3.3, 00:07:27, Serial1/0

O E2 192.168.2.0/24 [110/100] via 192.168.3.3, 00:07:27, Serial1/0
C 192.168.3.0/24 is directly connected, Serial1/0

R3#sh ip ospf database

OSPF Router with ID (3.3.3.3) (Process ID 1)

Router Link States (Area 0)

Link ID ADV Router Age Seq# Checksum Link count
1.1.1.1 1.1.1.1 1391 0x80000005 0x009B20 3
2.2.2.2 2.2.2.2 1187 0x80000004 0x00DCCD 3
3.3.3.3 3.3.3.3 459 0x80000004 0x00BFE7 2
4.4.4.4 4.4.4.4 416 0x80000005 0x00E5AF 2

Net Link States (Area 0)

Link ID ADV Router Age Seq# Checksum
192.168.4.2 2.2.2.2 1187 0x80000003 0x00E3D0

Type-5 AS External Link States

Link ID ADV Router Age Seq# Checksum Tag
192.168.1.0 3.3.3.3 211 0x80000003 0x00EFE7 0
192.168.1.0 4.4.4.4 548 0x80000001 0x00D5FF 0
192.168.2.0 3.3.3.3 211 0x80000003 0x00E4F1 0
192.168.2.0 4.4.4.4 548 0x80000001 0x00CA0A 0
192.168.6.0 3.3.3.3 669 0x80000001 0x00BC18 0
192.168.6.0 4.4.4.4 161 0x80000003 0x009A34 0



Finally, examining R3 and R4s routing table , it can be verified that the routes mentioned in Table 2 is now learned via RIP.

R3#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

O 192.168.4.0/24 [110/74] via 192.168.3.1, 00:14:44, Serial1/0
O 192.168.5.0/24 [110/138] via 192.168.3.1, 00:14:44, Serial1/0
R 192.168.6.0/24 [120/1] via 192.168.2.5, 00:00:04, Ethernet0/0
R 192.168.1.0/24 [120/1] via 192.168.2.5, 00:00:04, Ethernet0/0

C 192.168.2.0/24 is directly connected, Ethernet0/0
C 192.168.3.0/24 is directly connected, Serial1/0

R4#sh ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

O 192.168.4.0/24 [110/74] via 192.168.5.2, 00:13:03, Serial1/0
C 192.168.5.0/24 is directly connected, Serial1/0
C 192.168.6.0/24 is directly connected, Ethernet0/0
R 192.168.1.0/24 [120/1] via 192.168.6.5, 00:00:05, Ethernet0/0
R 192.168.2.0/24 [120/1] via 192.168.6.5, 00:00:05, Ethernet0/0

O 192.168.3.0/24 [110/138] via 192.168.5.2, 00:13:03, Serial1/0


I have tried to keep this tutorial simple. When I started, I thought it would a piece of cake to write one. Well the answer my friends, it's not. However, I'd encourage more people to write tutorials because it benefits others and familiarises oneself with topics that are not their strong areas.



No comments: