How the Internet Works
Tags: internet, protocols
Published: 2020-09-13 08:17:21

The term internet has been grossly misused and in fact slandered. When my kid sister told me the internet is the cloud, I said to myself: enough is enough! In this article I’ve explained the internet in a way that even the non-techies could understand. If you have a strong grasp of the nitty-gritty of the internet, you’d find that this article has been oversimplified. Well, I’m just setting the lower bound for what I believe every person should know about the internet. Enough of the _yarns_; shall we get to the main thing?



**Before the Internet**

When people began to use machines for work, humans have been relentless in their pursuit of ways to make most of  human experiences faster, easier, and more reliable. For example, in communication, there has been a shift from the use of town criers, to telegraphs, and subsequently telephones. Furthermore, when computers emerged, computer people began to explore ways to make communication more efficient and reliable with computers. 


**But was communication inefficient and unreliable prior to the internet you ask?**



Yes! Prior to the internet, communication over long distances was  highly inefficient. Most times letters took days to arrive at their destination. Then came the telephone era. While this new machine disrupted the communication sphere and made information dissemination faster, it wasn’t very efficient and reliable. This is true because, with telephones, two people could only talk over a dedicated communication line. What this means is this: if this communication line was a road, then only one car could go through at a time. The width of the road notwithstanding. Even if this car spoils mid way, other cars would have to wait. Relating this to telephones, talking over a dedicated communication line means it can only be used by two people at a time. Even if the users at the two ends aren’t really talking, simply because these two telephones are connected, other users wanting to use that particular communication line or to connect to one of the connected  telephones would have to wait. This technique of moving data  over a dedicated communication line is formally called circuit switching. While this technique undeniably had its strengths, it is, in my opinion, a makeshift solution at best. To fill this gap in communication, the internet was created. 


**Can you tell me what this internet is already?**

 Lol.. calm down.



**Okay, Meet the Internet**


The internet is just a more efficient and reliable way of passing data around with computers. As opposed to circuit switching, the internet uses packet switching to move data around. with packet switching, before being transferred, a piece of data is broken down into smaller chunks called packets. These packets are then transferred through several routes to their destination where they are then reassembled. Because of this architecture, on the internet, computers don’t have to wait. Thus, a computer on the internet could be sending data to several  computers while receiving from other computers.



In reality, at any given time, there will be thousands or millions of people in different parts of the world who’d want to talk to each other. Thus, at any given time, there are thousands or millions of these computers that are connected and sharing information with each other in a network of some sort. The internet at the most basic level is the name given to this global digital community of computers constantly talking to each other. Oh, computers too talk ?



Yes! Pretty much the way humans do. It happens all the time. When you send an email to a friend the two devices involved are in a back and forth communication with each other. This communication is possible because these computers model the reality of human communication. This doesn’t make sense you think? I imagine you hold that opinion because you believe humans are able to communicate because they have and use language, but computers don’t have this do they ?  Well, they do. Let me tell you how.



**How the Internet Works**



Computers on the internet have and use protocols. Just as language simplifies communication between two people, protocols on the internet make communication between computers on the internet possible. These protocols are predefined rules for formatting and moving data on the internet. Still struggling to understand what protocols do on the internet? It’s alright. Just carry on; you will soon understand.



When you say “hello” to a friend in an email, these protocols format your “hello” text in a certain way. After formatting this data, these protocols then carry this text from your device to the receiver’s device. Protocols are powerful! 



The internet does not have just one monolithic protocol that does everything though. The internet is composed of several related protocols with each protocol doing one thing really well. These set of inter-related protocols on the internet are collectively called the TCP/IP suite.



Protocols in the TCP/IP suite are layered. Each layer is usually made up of protocols that leverage the capabilities of the protocols in the layer below it. These layers collectively make up the internet protocol stack, and this stack has four major layers:



The application layer (HTTP, SMTP)
The transport layer (TCP, UDP)
The network layer (IP)
Link layer (Ethernet)


The application layer protocols are usually embedded in the several applications in your computer. Embedded? Well, yes. Remember, protocols are just rules so they are programmed as part of these applications. For example browsers use the HTTP protocol and some email clients use the SMTP protocol. Using the protocols in this layer, these applications allow users to construct messages that are then passed down to the transport layer.

The transport and network layer protocols are usually embedded in the operating system of your device. The transport layer ensures that the message is reliably delivered to the right application in the receiving device. Message segments from the transport layer are then passed to the network layer. The network layer ensures that message segments are routed to the appropriate destination machine

The link layer protocols are most times embedded in the network interface cards. Segments from the network layer are then passed to the link layer that carries the data to the destination machine.

These protocols are collectively able to move data to a specific device and to a specific application in that device majorly because of IP addresses and port numbers.

IP addresses and Port numbers ? I thought you said non-techies could understand this too?



Yeah! See it’s simple: Every computer connected to the internet has a unique address called an IP address. An IP address is a series of numbers. Port numbers on the other hand, provide us with a way to uniquely identify processes/applications on a given computer. Protocols in the transport layer use these port numbers to forward messages to specific processes. Think of IP addresses as street addresses, and port numbers as house numbers within a street. Just as written letters are first of all transported to a particular street using the street address and then to a particular home using the house number, all messages on the internet are first of all routed to a computer (using its IP address) then to a specific application on that computer(using its port number).



**So far, my explanation of how the internet works has been quite abstract right?**

Don’t give up yet, I saved the best for last.



Going with the “hello” example at the beginning of this article, when you say “hello” to a friend in an email, the application layer forwards the message to the transport layer. At the transport layer, the port number of the email client is appended to the message passed from the application layer. Of course after splitting the message into segments. These segments with port numbers are then passed to the network layer. At the network layer, the IP address of the destination and the source computer is again added to each segment. Fully equipped with all the necessary extra data, the message is then moved to the data link layer that then moves all the segments to the destination computer using the IP address appended to each segment.



At the destination computer, the received segments are then moved from the data link layer to the network layer. At the network layer of the receiving computer, each segment is then stripped of the IP address appended to it (because it’s no longer needed). The segments are then moved to the transport layer. At the transport layer,  the segments are then reassembled into the original message. Depending on whether the two devices are using the TCP or UDP protocols, at the transport layer, the receiving device could even send a message to the sending device confirming that it has successfully received all the segments. Using the port number appended to the received message, the  transport layer is able to tell the process it is suppose to forward the message to in the application layer.



This is how the internet works. This is how every data you send is routed to the receiving device.