I've been doing small-time freelance IT work (among other things) for about the last decade now. I've set-up or rebuilt more local network arrangements than I can care to count, and more recently I've been studying up on some of the big gaps that remained in my networking knowledge. All-in-all, while I most definitely wouldn't call myself an "expert" I think that at this point I have a decent grasp of how things work inside a network perimeter, and a fair understanding of most networking fundamentals (the layers of the OSI stack, TCP/IP, DNS, MAC addressing & ARP, higher-level protocols, etc.)
However, the other day something occurred to me: "How would I explain to someone how routing a packet on the Internet actually works?" And I realized I'd have trouble answering that question.
Now, I do have at least some understanding of what, for example, Border Gateway Protocol is & does, or what a routing table is, or what Internet infrastructure peering points are. But I'll admit that I don't really understand how those things and others actually determine what a router will actually do with a packet to move it towards its destination IP address.
So, how does a router on the Internet that receives a packet decide which router to forward it to next? And how does that router then know the best router it should forward the packet to? As I said, I have some understanding of elements & concepts related to the Internet routing infrastructure, but I'm unclear about how everything fits together to actually allow a given router to make a good routing "decision" about where to send a packet that comes to it to do its part in correctly moving the packet towards its final destination.
(Note: I've looked at any of number of resources to try to gain a better understanding of this. But most things I've come upon thus far have either (1) elided over the technical topic of how a router on the Internet knows where to send a packet for the next hop, or (2) gotten so bogged down in technical details & jargon about protocols and such that it's been hard to gain a picture of how everything comes together at a router's decision point. And I thought this would be as good a place as any to get an actual technical answer to that question that might also be comprehensible to a non-expert in networking.)