The internet is an amazing technology that most of us use every day but relatively few understand. There are plenty of guides out there on the internet so how is this one different? Well, I believe that if you can follow the process of how a letter in the post gets from A to B then you can understand how the internet works. By using the postal system as an analogy, I hope to make the machinery of the internet accessible to a wider audience.
The way that Royal Mail postcodes are used in the UK to move post around the country is a pretty good approximation to how messages move around the internet. If you live outside the UK, you’ll be familiar with your own version of a postcode, which may well operate in a similar way. Even if it doesn’t, I explain how UK postcodes work along the way so you’ll be fine.
Before we start, a quick caveat: using an analogy to explain a complex topic is like converting a raw image file from a camera into a JPEG file. To use the technical term, it is “lossy”. Now, I realise I’ve just used an analogy to describe an analogy, but what I’m trying to say is that while some of the fine detail is lost, you get the general picture:
Credit: Wikimedia Commons
Imagine that all the nitty-gritty of computer networking is the top image. While it’s an accurate depiction, it’s impenetrable to a non-technical reader. This article aims to paint the bottom picture. Oh, and another thing: if you don’t understand all this after one read, don’t fret – there’s a lot to take in, just re-read it and persevere.
Let’s start by looking at what happens with an old-fashioned bit of post. A letter in a postbox or at a Post Office is collected and sent to a sorting office, also known as a mail centre. There are about 50 of these in the UK and at this point the mail goes through what’s known as “outward sorting”. The part of this that’s most relevant to us is the question “is the destination local?” – which is to say, does the address lie within the boundaries of this sorting office? For example, take the Medway sorting office in the South East, which serves all the postcodes beginning ME. When a letter for ME8 8ZA posted in that same area passes through outward sorting, the postcode is matched to ME, so the letter stays there. But a letter for CW12 doesn’t match ME so it’s put into the pigeon hole for delivery to the sorting office that serves that particular area. It gets there by road, rail or occasionally air.
Figure 1: outward sorting
Within the Medway area, a match for ME means the destination is local, otherwise the letter must move to a different sorting office. The results of two previous decisions are also shown.
Whether the letter has travelled 100 feet or 100 miles, it’s now sat in the right sorting office for “inward sorting”. The postcode is then used to decide which “delivery office” the letter should be sent to. There are about 1,300 delivery offices in the UK. Dividing that by the 50 sorting offices means that, on average, each sorting office has 26 delivery offices in its jurisdiction. Obviously the letter is sent to the delivery office closest to the final destination, and again that decision is based on the postcode.
Figure 2: inward sorting
A larger part of the postcode is matched to a delivery office, here “ME8 8” matches “Rainham”
Finally, a postman collects the mail from the delivery office and hand-delivers the post to its final destination.
Surfing the net
Now let’s compare a journey on the internet. Imagine typing into the address bar of your browser www.jeromesmith.uk (or going there by clicking a link). You can think of www.jeromesmith.uk as the name of the computer that runs this website. If you posted a letter with just a name on the envelope, you know it wouldn’t get very far. It’s the same with your request to www.jeromesmith.uk: the internet doesn’t work on names alone. The first thing your computer needs to do is to turn that wordy address into something more or less like a number – what’s known as an IP address. The IP stands for Internet Protocol and under our analogy it’s more or less the equivalent of a postcode.
Just like the Royal Mail focuses on the postcode for sending a letter, computers use IP addresses to shuttle messages around the internet. So when you look up a postcode for someone, it’s a bit like what your computer does with the name “www.jeromesmith.uk”. For most of us at home, this look-up is done by our Internet Service Provider, or ISP, which is to say the people to whom we pay our broadband bill. So your ISP does a look-up and tells your computer that www.jeromesmith.uk is at the IP address 126.96.36.199 (I’ve omitted how this look-up works to keep things moving – oh, and that address was correct when I wrote this, it may change over time). 188.8.131.52 is certainly a funny-looking number but we’ll look at it more closely later on. For now all we need to understand is that, just like a postcode completes a postal address, looking up the IP address for www.jeromesmith.uk and adding it to your message means that it too is properly addressed and ready to go.
Before we go any further, let’s briefly consider exactly what the message you’re sending actually is. Under our postal analogy that’s the same as looking at the contents of the letter inside the envelope. By entering just www.jeromesmith.uk, the message is simply “can I have your home page please?”. If you had typed into the address bar www.jeromesmith.uk/about then the message would have been “can I have the web page called about please?”. If you had typed www.jeromesmith.uk/blog/1 then the message would have been “can I have the web page called 1 in the folder blog?”. So you can think of those forward slashes exactly like you would a path when you click your way through to a file you want on your own computer. The home page, then, is the page right at the top of the website.
Let’s summarise what we’ve got so far:
Figure 3: the message “I’d like your home page” for www.jeromesmith.uk is in an envelope addressed to 184.108.40.206
The next thing that happens is that your computer makes what’s called a routing decision. This is exactly the same thing that a sorting office does in “outward sorting” (when the postcode is used to decide whether a letter is local or remote). For example, the first couple of letters “CW” of the destination postcode “CW12 9TZ” are compared to the postcode areas that the sorting office serves (e.g. “ME”), and if there’s a match then the letter is local. Similarly, your computer has an IP address just as www.jeromesmith.uk does, and it compares the two to decide if the destination is local or not. Of course, it’s obvious to us that my website isn’t in your house, but computers have to follow rules and so here’s what happens. Let’s say your computer’s IP address is 192.168.1.5. Just as the sorting office knows how much of a postcode to inspect to decide whether a letter is local or not, so your computer knows how much of the IP address to compare. In this example, let’s say that your computer uses the first three numbers of the IP address. Again, to keep things moving, I’ll skip over how it knows this. It compares 192.168.1 with 176.74.20. Clearly that’s far from a match, so your computer knows that www.jeromesmith.uk is somewhere out there on the internet.
Figure 4: outward sorting at a computer
For this computer, a match for 192.168.1 means the destination is local. The results of two previous decisions are also shown.
The next step follows exactly what the sorting office does. In the postal system, when a letter is known not to be local, a pigeon hole is chosen for the sorting office that’s nearest the destination. In the same way, your computer chooses the next best hop for your message. In your home there’s only one place for it to go – and that’s the box with the blinky lights lying on top of a shoe box. That little box is your gateway to the internet. It’s commonly called “the internet” (as in “is the internet working?” or “did you turn the internet off?”) but we’ll call it a “router”. It has an IP address too – let’s say 192.168.1.1.
Figure 5: sorting at a computer
The IP address is matched to the next hop, here “220.127.116.11” matches “192.168.1.1”, which is the IP address of the local router
Figure 5 has been made to look like the postal equivalent in figure 2 but in reality your computer doesn’t have an entry for every single IP address – that would be crazy. Instead it has a “routing table” of places it positively knows about (like the local network 192.168.1), and everything else it sends to the router.
Things get kind of repetitive now. The message for my website is at your router, which makes the same local/remote decision that your computer did a moment ago. In other words, we go through “outward sorting” again. Your router compares a portion of its IP address with the same portion of the destination IP address to see if there’s a match. Again, the answer is no, so the router needs to send the message to the next onward point. This time, however, the router has two wires to choose from (conceptually there’s no difference with Wi-Fi): one wire is connected to your home network and the other is connected to your Internet Service Provider. Just like outward sorting in the postal system figures out which onward sorting office is the next hop, the router’s own outward sorting includes which wire to use.
Figure 6: outward sorting at the router
This time the decision is laid out in a routing table
In effect, the question the router is asking is “which machine do I know is closest to 18.104.22.168?” which is the IP address of www.jeromesmith.uk. This question is exactly like a round in a game of Six Degrees of Separation. In this game the theory goes that anyone in the planet is linked to anyone else by no more than six hops. Imagine playing this with the subject being, for example, Stephen Hawking. Each person in the chain is effectively going through the same process: first, “do I know Stephen Hawking?” If the answer is yes, job done. If the answer is no then “which of my friends is most likely to know Stephen Hawking or someone else who knows him?”. That same question is asked all the way down the chain with a different answer between each link. Similarly, for your message to my website, each router along a path through the internet asks “do I know 22.214.171.124? If not, what’s the next best hop to reach it?” The answer in Figure 6 is 126.96.36.199, which belongs to the ISP.
Much the same question is asked as a letter makes its way through the postal system – “do I know CW12 9TZ? If not, which office is best placed to know it?”. A typical letter within the UK moves from one sorting office to another one and then on to a delivery office. That’s just 3 hops. But a message on the internet might go through a dozen hops – until it finally arrives at a router with an IP address of, say, 188.8.131.52. Just like each step before it, the router compares a portion of its own IP address (say, the first two numbers this time) with the destination address, in this case 184.108.40.206. The difference this time is that there’s a match – the first two numbers “176.74” are identical, which means that 220.127.116.11 is local, not remote. In the routing table above, that’s the step “go direct”. Now, if the message doesn’t need to be sent on, what happens next? In part two, we’ll answer that very question.
Before I sign off part one, I just want to touch on something you may have noticed: I haven’t drawn an analogy with inward sorting. In the postal system, inward sorting happens when the mail has reached the final sorting office, from where it is sent to one of a number of smaller delivery offices. I haven’t mentioned inward sorting because on the internet there isn’t really a distinction between routers that divides them into something like sorting offices and delivery offices. As far as the internet is concerned there are only routers. Sure, there are big ones in the backbone of the internet that cost a lot of money, and there are little ones that sit in your house that come free from your ISP, but their cores work in much the same way. Now take a look at figures 1 and 2: it is because inward sorting and outward sorting use the same basic logic – some portion of a postcode is examined to determine the next hop – that outward sorting alone is sufficient for us.
That’s it for part one. Give yourself a pat on the back if you’ve followed everything so far. If it doesn’t feel like it’s quite clicked into place, do give it another go. Part two will dive a bit deeper to complete our journey, when we’ll be drawing an analogy with what the postwoman does when the letter has arrived at the delivery office.