internet network

Internet – How does it work?

Posted by

The Internet! The magical thing we all know and use on a daily basis to look up the newest cat videos. People are reading articles, blog posts (see 😏), news, recipes and so much more on the web day by day. Some blame it for all the bad things in our society, others are obsessed with it. Some depend on it as their job is 100% online. But surprisingly few people actually know how it works. In today’s post, let’s see how the world wide web works!

It is just a huge network!

The internet is a huge network of devices connected by routers (and more but let’s stick to the basics). The communication between these nodes (devices) is controlled by various protocols. The two most important are IP (Internet Protocol) and TCP (Transport Control Protocol).

A protocol is just a set of rules defining how a certain part of the network works, how devices communicate, how addresses are found in the network and so on…

internet packet

When data is sent over the internet, it is split into small packets then sent through routers to a destination computer. A packet is a small chunk of data together with meta-information about the source computer and the destination computer as well as about the complete data itself.

What are these routers? Where are they and who owns them?

router

In the beginning, these routers were owned by governmental institutions and universities but nowadays it more the job of internet provider companies. The purpose of this router is to know how to get to a destination. When someone sends a message to a destination that has is unknown by the router, it asks another router that either knows the destination and tells the first router how to find it or ask another router and so on until the destination is either found or declared unknown.

Actually, you probably have a router too but that one has a slightly different purpose. It has to know where the ISP’s (Internet service provider) router is and how to map public addresses to private addresses and back. More on addresses later.

Let’s see an example

Let’s imagine Greg and Pete are going to the same party and Pete wants to check on Greg to make sure they both remember the same time for their meeting. Pete sends the following message: “Hey Greg! 8pm at Sarah’s?”

First, the message is split into packets by Pete’s phone. These packets contain a small part of the message, Greg’s address and some info about the original message for Greg’s phone to be able to reassemble the message.

Message split into packets

These packets are then sent to Greg’s public address which actually points to Greg’s router. The router then decides which device it has to send the packets to.

In real life, messaging apps usually send messages to a server and the server delivers them when the destination device asks for new messages. This is because with modern wireless networks all over the place it is really hard to know the exact address of the destination. In fact, these addresses often change as well… But as I said at the beginning, let’s stick to the basics and pretend that Pete and Greg are communicating directly to each other over the internet. The phone <-> server communication happens the same way anyways…

How do routers address devices?

Let’s take a break and discuss how addresses work. Here comes IP in the game. An IP address is a combination of numbers. The IP protocol determines what those numbers represent (for example region).

There are two types of IP addresses:

  • IPV4: It looks like this X.X.X.X where every X represents a number from 0 to 255. This type of addressing provides 232 unique addresses. If you do the math and consider that there are addresses reserved for stuff like governments and also some addresses used by computers for special tasks such as aliasing their own address, you will see that we are going to run out of addresses very soon. 😱 Don’t worry. We already have two solutions for this problem: Private addresses and IPV6 Addresses.
  • IPV6: This is the newer IP addressing protocol that is intended to solve the problem of limited IPV4 addresses. It looks something like this: 2001:0db8:0000:0000:0000:8a2e:0370:7334. The number of addresses is still limited in theory. But in practice, you can be sure that it will take us some time to use up all the 2128 addresses. (lots of generations in fact)

I’ve already mentioned private and public addresses a few times. But what are they? Whenever you connect a device to your router, it receives a port number. This is just an internal identification number given out by your router. If you would send out a message to the same destination from two devices from your network, the destination computer would see the same public address for both of them. When the destination computer sends an answer back to your router, it uses the port number to determine which device should get the message.

Back to Greg and Pete

Now let see how what happens with Pete’s message when it arrives to Greg’s phone.

The phone starts to process incoming packets one by one. There is nothing that guarantees that these packets arrive in order to the destination computer has to figure out their order (looking at the packets meta information) to assemble the data correctly.

Sometimes too many packets arrive at once and the computer can not process them fast enough. It can not do anything other than throw away some packets.

Whoooat? It thows away my data?? 😱

Don’t worry! TCP comes to the rescue. This protocol requires the destination computer to send back confirmation messages repeatedly. In these messages the destination computer can request the source to send some packets again.

Conclusion

At this point Greg received Pete’s message and can send an answer back following the same procedure. I hope you can see now how many things happen every time you send a message or receive a new notification!

0Shares

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *