I would like to confirm my idea about routing tables.
If a have following entries:
as routes in my router.
My internal network 10.0.0.0/16
Route to another private network 10.0.0.0/24 which is reachable through GW in my Wan (this gw is reachable as well).
What I want to confirm is that this config is consistent. Which route would try first or how would manage both routes in case of packet comming from outside to a host with for example this IP: 10.2.2.2?
Is this behaviour same in other routing devices? linux, fortinet....
Thanks and best regards,
Cisco always uses longest match in making routing decisions. There is not any relationship between ip classless or no ip classless and longest match, and they both use longest match.
In general if there is 10.0.0.0/24 which is reached through the gateway and there is also 10.0.0.1 -->10.0.0.254 somewhere else in your network there is a problem. If there is a host 10.0.0.5 and if there is something that puts a host route into the routing table then it would be reachable (but 10.0.0.5 through the gateway would not be reachable).
If you do have the situation where someone is using the same address space that you are using then the usual solution is to use Network Address Translation. NAT can help resolve the issue of overlapping addresses in networks.