Everything is going seamlessly regarding redistribution if we have only one point of redistribution, but when we add another router on the edge of 2 routing protocols, for instance in order to provide “high availability” by adding another point of failure to get redundancy, then our network is exposed to very inefficient sub-optimal routing.
Let’s have a look at a topology below. We have 2 routing protocols EIGRP and OSPF. What will happen if we utilize simple mutual redistribution and also redistribute connected routes into EIGRP (1.0.0.0/24) ? Routes injected into EIGRP will get Administrative Distance 170 as external routes. OSPF has got AD 110, EIGRP 90. The router which the first started redistribution process is in privilege position and from its point of view everything will be going fine (R1). But the second router (R2) is going to get external routes injected into EIGRP from EIGRP with AD 170 but also from OSPF with AD 110, because OSPF has the same value for internal and external learned routes, owing to lower AD, R2 will choose OSPF protocol and install its routes in the routing table. To summarize, if router R2 wants to reach network 1.0.0.0/24, the path of the packet will be looking it this way : R2-R5-R3-R1-R4-R7, instead R2-R6-R7. Let’s trace back this story from the scratch.
First of all let’s redistribute connected networks into EIGRP process:
R1 routing table
Now, let’s make mutual, plain redistribution between OSPF and EIGRP domains on R1 and R2.
If we compare the route to 1.0.0.0 network from R1 and R2, we notice that from the R1 point of view everything is working fine, but from R2 no entirely! To proove it, let’s try tracerotue 1.0.0.1 interface to see the path, that packet is going through, on particular routers.
R1
R2
To visualize this problem take a look on the below picture with R1 and R2 paths
As you may notice from R1 the packet is going as is desirable, but from R2 totally not. This is exactly what we call suboptimal routing. Let’s try to do something about that. We may deal with this in 2 ways
Changing administrative distance for external routes learned by OSPF.
In order to do that we have to change AD for something higher than 170 (AD of EIGRP route that comming straight from EIGRP process, but couldn’t get into routing table because the route was learned by R2 with OSPF with AD 110)
R2
router ospf 1
distance ospf external 180
Route Tagging
The goal of tagging routes in our case is marking the network and then reject routes with apropriate TAGs on routers that make mutual distribution. In our case I am going to mark the network 1.0.0.0/24 with TAG 1000, distribute its with this TAG into OSPF process, but on R2 I am going to reject network 1.0.0.0/24 with TAG 1000 as learned with OSPF process and AD 110 in order to put this route into routing table with EIGRP routing protocol with AD 170. I also will make mutual redistribution on both routers as is its being made usual.
R1 configuration
access-list 5 permit 1.0.0.0 0.0.0.255
route-map EIGRP_TO_OSPF permit 10
match ip address 5
set tag 1000
route-map EIGRP_TO_OSPF permit 20
router ospf 1
redistribute eigrp 1 subnets route-map EIGRP_TO_OSPF
router eigrp 1
redistribute ospf 1 metric 100000 1 255 1 1500
1. Firstly I create an access list with marked network 1.0.0.0/24 that is interesting for us.
2. I create the route-map EIGRP_TO_OSPF with statement : set TAG 1000 for the network from access list number 5 (1.0.0.0/24). Permit the other routes to be redistributed (remember, there is invisible “deny any” at the end.).
3. Next I put this route into redistribution process under OSPF
4. And I redistributed EIGRP to OSPF as usual
R2 configuration
route-map OSPF_FILTER deny 10
match tag 1000
route-map OSPF_FILTER permit 20
router ospf 1
distribute-list route-map OSPF_FILTER in
redistribute eigrp 1 subnets
router eigrp 1
redistribute ospf 1 metric 100000 1 255 1 1500
1. I created the route map with “deny” statement for the networks with TAG 1000
and I put its into redistribution process under OSPF. I used distribution list that points out on the route map and direction “in”. Next I just redistributed the remained eigrp networks with “redistribute” command.
2. I made a usual redistribution of OSPF to EIGRP.
Let’s confirm that everything has went well on R2
R2 routing table, we see that the route to network 1.0.0.0/24 with AD 110 has gone!
But how can we verify that network 1.0.0.0/24 has been tagged at all ? We may check this in OSPF Routing Information Base ot OSPF database where routes will appear with TAGs
So R2 got to know about network 1.0.0.0/24 with OSPF protocol, but because we have rejected routes with TAG 1000, didn’t put its into the routing table. This is exactly what we wanted to achieve!
We got rid of suboptimal routing and the flow of packets from now on look in this way