Each of the protocols has its own mechanism to prevent loops. With OSPF it is pretty simple - as a link state protocol OSPF uses LSA to build a map of all of the links within the area and based on this map OSPF can detect and prevent any loop within the area. EIGRP is somewhat more complex in its loop prevention mechanism. EIGRP uses the DUAL mechanism and the feasibility test to prevent loops.
I don't know EIGRP so I can't say anything about it.
For OSPF, each node builds the same representation of the network based on the LSA it receives. This representation is a graph (see http://en.wikipedia.org/wiki/Graph_(mathematics)), where LSA are used to create nodes/vertices (routers and networks) and edges (costs to go from one node to another).
Each router performs dijkstra algorithm to find out the shortest path from itself to every other destination in the network.
As Dijsktra algorithm is in fact the determination of an optimal tree where the router is the root and every destination is a leaf, with optimal root to leaf cost, there is by essence no possibility for any loop.
So, by essence, OSPF won't ever allow for a loop.
Beware the redistribution policies you configure at the boundaries of the OSPF cloud though. Loops could occur through hasardous redistribution at the boundaries of the OSPF domain I guess, but never inside, OSPF design being what it is.
The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.
In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.
I just wanted to add, both EIGRP and OSPF will compute a loop free topology, as the other posters have noted. However, it's possible to have transient loops when there's a change in the network topology and all the routers have not yet converged on an accurate representation of it.
We are pleased to announce availability of Beta software for 16.6.3. 16.6.3 will be the second rebuild on the 16.6 release train targeted towards Catalyst 9500/9400/9300/3850/3650 switching platforms. We are looking for early feedback from custome...