So next time if someone ask ...hey if I have two routers running EIGRP and OSPF both, which routing protocol will indeed used to exchange routes and to send data ? Typical answer would be - EIGRP...cause it's AD is 90 where as OSPF AD is 110...so EIGRP will be the winner :)
Nooooo...but may be Yes too :) , just ask them for configuration first
Let me explain step by step approach of router while making routing decisions in such situation:
1.) Check for the longest prefix match....just look into the Diagram...in short EIGRP 1 process is enabled on R1's interfaces f0/0 & s0/0 & On R2 the EIGRP 1 process is enabled on interfaces f0/0 & s0/0 too. Also I have configured OSPF 1 routing process on R1's f0/0 & so/1, R2's f0/0 & s0/1, R3's s0/0 & s0/1.
Now most people will say that the traffic originated from R1's ethernet subnet will exit through R1's interface s0/0 because it's running EIGRP and as we know AD of EIGRP is 90 so it will take preference over OSPF AD 110. But in actual it's moreover dependent on your routing protocol configuration. So lets hop on to configuration :-)
router eigrp 1
R1(config)#do sh ip route
184.108.40.206/30 is subnetted, 1 subnets
So whats next....
But we still have both entries from both protocols in routing table so which one will take precedence ?
Answer: The routing protocol which is providing more accurate route to routing table then other one..which in our case is OSPF with /24 prefix length :-)
So lets test it out....I am going to run a ping test after enabling Debug ip packet command to see which interface icmp packets will choose to reach destination
here we go...
But lets say I want EIGRP to Win this race....hmmm...actually there are many ways to achieve this...let me show you my preferred way for this situation.
Lets turn auto-summarization off in EIGRP,because as soon as we will do that, EIGRP will also advertise the 220.127.116.11 network with /24 prefix length. Also remember that in such situation where both routing protocols will have same prefix length for a given destination; AD will take precedence and only routes with lower AD will end up into the routing table. If AD is also same <> than next preference will be lower metric and in last if all matches than traffic will be load balanced equally.
So lets turn off the auto-summarization on both R1 & R2
R2(config)#do sh run be router