Will ospf and eigrp share the 10 network on the right to their
neighbors?
As per my understanding link state protocols like ospf do so while
eigrp being a distance vector protocol will share only one of the
routes, but this case let's say both the routes are exactly same, how
will this be handled then?
By default, the router will install the route learned via EIGRP into the routing table. This is because EIGRP has a lower Administrative Distance than OSPF.
It should also be noted that both learned routes will remain in their respective routing processes. Thus, the router knows about both but will only select one route when routing.
Routers select routes in the following order:
- Prefix Length - The longest-matching route is preferred first.
Prefix length trumps all other route attributes.
- Administrative Distance - In the event there are multiple routes to
a destination with the same prefix length, the route learned by the
protocol with the lowest administrative distance is preferred.
- Metric - In the event there are multiple routes learned by the same
protocol with same prefix length, the route with the lowest metric
is preferred. (If two or more of these routes have equal metrics,
load balancing across them may occur.)
Jeremy Stretch does a great job going into deep details and examples of route selection here.
EDIT:
I am asking the question in two separate scenarios using a single
protocol at a time and not running both protocols at once.
In the event of all things equal and the routing process supports it, equal-cost load balancing will occur.
Exactly how the router handles the load-balancing depends on your configuration, version of IOS and potentially your router platform. Cisco dives into the matter with the following documents.
What does it look like in the routing table?
The following is an example output of EIGRP speaking routers with an equal-cost route for 10.1.1.0/24
:
ROUTER2#show ip route
[...omitted text...]
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
D 10.1.1.0/24 [90/30720] via 10.1.3.2, 00:00:17, FastEthernet1/0
[90/30720] via 10.1.2.2, 00:00:17, FastEthernet0/0
C 10.1.2.0/24 is directly connected, FastEthernet0/0
L 10.1.2.1/32 is directly connected, FastEthernet0/0
C 10.1.3.0/24 is directly connected, FastEthernet1/0
L 10.1.3.1/32 is directly connected, FastEthernet1/0
Here is an example for OSPF:
ROUTER2#show ip route
[...omitted text...]
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O 10.1.1.0/24 [110/2] via 10.1.3.2, 00:00:02, FastEthernet1/0
[110/2] via 10.1.2.2, 00:00:02, FastEthernet0/0
C 10.1.2.0/24 is directly connected, FastEthernet0/0
L 10.1.2.1/32 is directly connected, FastEthernet0/0
C 10.1.3.0/24 is directly connected, FastEthernet1/0
L 10.1.3.1/32 is directly connected, FastEthernet1/0