I saw a map of undersea internet cables the other day and it’s crazy how many branches there are. It got me wondering - if I’m (based in the UK) playing an online game from someone in Japan for example, how is the route worked out? Does my ISP know that to get to place X, the data has to be routed via cable 1, cable 2 etc. but to get to place Z it needs to go via cable 3, 4?
Oh boy! You’re one of the lucky 10,000!
Watch this! It’s only 10 minutes or so.
darganon@lemmy.world 8 months ago
There are things called routers that…route traffic. A dumbed down version is routers talk to other routers to find out what they know about.
If a game server you connect to matches you with someone in Japan, your computer sends a packet with the address in Japan attached to it. Your home router probably has no clue where that is, so it goes to its upstream router and asks if they know, this process repeats until one figures it out and you get a route.
This all happens very quickly, and it’s why people say the Internet routes around damage.
Atemu@lemmy.ml 8 months ago
That’s not how that works. The router merely sends the packet to the next directly connected router.
Let’s take a simplified example:
If you were in the middle of bumfuck nowhere, USA and wanted to send a packet to Kyouto, Japan, your router would send the packet to another router it’s connected to on the west coast. From your router’s perspective, that’s it; it just sends it over and never “thinks” about that packet again.
The router on the west coast receives the packet, looks at the headers, sees that its supposed to go to Japan and sends it over a link to Hawaii.
The router in Hawaii again looks at the packet, sees that it’s supposed to go to Japan and sends it over its link to Toukyou.
The router in Toukyou then sends it over its link to Kyouto and it’ll be locally routed further to the exact host from there but you get the idea.
This is generally how IP routing works; always one hop to the next.
What I haven’t explained is how your router knows that it can reach Kyouto via the west coast or how the west coast knows that it can reach Kyouto via Hawaii.
This is where routing protocols come in. You can look up how exactly these work in detail but what’s important is their purpose: Build “map” of the internet which you can look at to tell which way to send a packet at each intersection depending on its destination.
In operation, each router then simply looks at the one intersection it represents on the “map” and can then decide which way (link) to send each individual packet over.
The “map” (routing table) is continuously updated as conditions change.
Never at any point do routers establish a fixed route from one point to another or anything resembling a connection; the internet protocol is explicitly connectionless.
OmegaMouse@pawb.social 8 months ago
That sounds like quite a messy and inefficient process! But I guess as long as it can be done quickly enough, it doesn’t really matter?
MelastSB@sh.itjust.works 8 months ago
I think the previous comment omitted something, which is why you think it’s inefficient: routers don’t ask for directions every packet, they record the directions in their route table.
glimse@lemmy.world 8 months ago
I’m no expert but it seems like the most efficient way with the given technology! The hops between routers are much less frantic than (I think) you’re imagining.
To oversimplify, think of it like boxes in boxes where each box is a router.
Your PC is in the first small box. It says “I want to connect to [IP]” and the box says “I don’t have that IP, let me ask the bigger box”
The bigger box (your ISP) says “I don’t have it either, I’ll ask the big box”
The big box says “I don’t have it but based on the address, I know it’s in this other big box”
Other big box says the same thing and sends it to another small box. That small box has the PC you’re looking for and the packet is delivered!
wkk@lemmy.world 8 months ago
www.khanacademy.org/computing/…/internet-routing
I wouldn’t call that “messy and inefficient” but you do you. I’d be curious to know what’s a “clean and efficient” solution for you when it comes to routing packets around the planet :)
KillingTimeItself@lemmy.dbzer0.com 8 months ago
it’s not efficient from the perspective of organization. But the thing nobody tells you here is that packets have no predefined route, they take whatever route gets them there optimally. So it’s highly redundant, and very fault tolerant. When you consider that, for what it does, it’s a highly efficient routing system.
To the point where you could cut an undersea cable, and traffic would still route perfectly fine, albeit probably a lot slower, assuming that isn’t your only connection of course. The fact that it works it all is kind of a miracle.