So I understand that to forward a packet, a router needs 3 pieces of information: next hop, egress interface and Adjacency (L2 information). On a Cisco router, this will be stored in FIB and CEF.
What confuses me is that it appears next hop is needed only for finding out adjacency info (by ARP), because really only L2 info is necessary when forwarding a IP packet to the next router.
So my question is why there is this indirection between next hop -> adjacency? Why can't this adjacency information be collected directly? And how is this egress interface decided inside a router?
Or it would be more helpful if someone could explain how are the two tables (FIB and CEF) populated?
I guess my question itself is very confusing. So here I am trying to make it more specific/clear.
I am aware that there are many different routing protocols. However, my question isn't really about how the routes are received or calculated. It's more in line with what happens in a router after these information is received. To be more specific, in a router, adjacency is usually inserted by ARP instance. And next hop information are the ones inserted by routing instances. So here I am assuming that next hop is already known/calculated by the routing instance.