How The INTERNET Works

Farhan KhanFarhan Khan
14 min read

The internet works like a massive network of computers communicating with each other. To explain how it works, let’s break it down step by step using a real-life analogy: sending a letter.


Hello Everyone ! "Have you ever thought that when you type the name of a website by pressing a button, how does the whole page appear in front of you within a second? Or when you talk on a video call, how does your voice and picture reach the other corner of the world?"

Imagine a simple request, like searching for a video on YouTube. Behind it, there's an entire world at work, with a network of wires, satellites, and thousands of servers. It's like magic we can't see, connecting the whole world together.

Now, consider this: I wrote this article on my computer, and the photo you're looking at is also on my computer. Yet, you can access it on your laptop or device, all thanks to the internet.

This is just a small example, but think about it—without the internet, how different would the world be? You wouldn't have access to information from around the globe with just one click. This article aims to explain the science and reality behind this magic—how the internet works and how it has transformed the world.

In this article, we'll explore not just the science behind the internet, but also the story behind it, its power to change the world, and its impact on our lives.

Let's begin this journey into the fascinating world of the internet!

What is Internet ?

Before we cover what the Internet is, we must define what a "network" is. A network is a group of connected computers that are able to send data to each other. A computer network is much like a social circle, which is a group of people who all know each other, regularly exchange information, and coordinate activities together.

The Internet is a vast, sprawling collection of networks that connect to each other. In fact, the word "Internet" could be said to come from this concept: interconnected networks.

Since computers connect to each other within networks and these networks also all connect with each other, one computer can talk to another computer in a faraway network thanks to the Internet. This makes it possible to rapidly exchange information between computers across the world.

Computers connect to each other and to the Internet via wires, cables, radio waves, and other types of networking infrastructure. All data sent over the Internet is translated into pulses of light or electricity, also called "bits," and then interpreted by the receiving computer. The wires, cables, and radio waves conduct these bits at the speed of light. The more bits that can pass over these wires and cables at once, the faster the Internet works.

What is distributed networking, and why is this concept important to the Internet ?

There is no control center for the Internet. Instead, it is a distributed networking system, meaning that it is not dependent on any individual machine. Any computer or piece of hardware that can send and receive data in the right way (for example by using the right networking protocols) can be part of the Internet.

[More on networking protocols later]

The distributed nature of the Internet makes it resilient. Computers, servers, and other pieces of networking hardware connect and disconnect from the Internet all the time, without affecting how the Internet works – unlike a computer, which may not work at all if it lacks a single component. This also applies on a larger scale: if a server, an entire data center, or an entire region of a data center goes down, the rest of the Internet can still function (albeit more slowly).

Before we understand how the Internet works, how browsers and servers connect and work, let us understand the technology behind it so that we can understand better how the Internet works.

like :- TCP , IP , UDP , HTTP / HTTPS , ROUTING ETC…

What is an IP address and why does it matter ?

The Internet Protocol (IP) is a protocol, or set of rules, for routing and addressing packets of data so that they can travel across networks and arrive at the correct destination. Data traversing the Internet is divided into smaller pieces, called packets. IP information is attached to each packet, and this information helps routers to send packets to the right place. Every device or domain that connects to the Internet is assigned an IP address, and as packets are directed to the IP address attached to them, data arrives where it is needed.

Once the packets arrive at their destination, they are handled differently depending on which transport protocol is used in combination with IP. The most common transport protocols are TCP and UDP.

Example :- Location Tracking

Services like Google Maps can estimate your location using your IP address. Even if GPS is turned off, your approximate location can still be determined based on your IP address.

‘IP’ stands for Internet Protocol, which is the set of rules that makes it possible for devices to communicate over the Internet. With billions of people accessing the Internet every day, unique identifiers are necessary to keep track of who is doing what. The Internet Protocol solves this by assigning IP numbers to every device accessing the Internet.

A computer’s IP address is like the physical address of a house. If someone calls a pizzeria to order a delivery, they need to provide their physical address. Without that address, the pizza delivery person will have no idea which house to deliver the pizza to.

For example, when a user types a domain name, like google.com, into a web browser, this will initiate a request to Google’s web server asking for content (the Google homepage). Once Google receives the request, it needs to know where to send the website content. For this reason, the request will contain the asker’s IP address. Using the provided IP address, Google can send a response back to the user’s device, which will then display that content in the user’s web browser.

The system that orchestrates all this is called DNS. It works like a phone book for IP addresses so that users can access web services using human-friendly domain names. When a user types a domain name like ‘facebook.com’ into their browser window, this begins a DNS query which ultimately leads to a DNS server translating the domain name into an IP address.

How does IP addressing work ?

An IP address is a unique identifier assigned to a device or domain that connects to the Internet. Each IP address is a series of characters, such as '192.168.1.1'. Via DNS resolvers, which translate human-readable domain names into IP addresses, users are able to access websites without memorizing this complex series of characters. Each IP packet will contain both the IP address of the device or domain sending the packet and the IP address of the intended recipient, much like how both the destination address and the return address are included on a piece of mail.

What are TCP / IP?

The TCP/IP relationship is similar to sending someone a message written on a puzzle through the mail. The message is written down and the puzzle is broken into pieces. Each piece then can travel through a different postal route, some of which take longer than others. When the puzzle pieces arrive after traversing their different paths, the pieces may be out of order. IP makes sure the pieces arrive at their destination address. TCP can be thought of as the puzzle assembler on the other side who puts the pieces together in the right order, asks for missing pieces to be resent, and lets the sender know the puzzle has been received. TCP maintains the connection with the sender from before the first puzzle piece is sent to after the final piece is sent.

IP is a connectionless protocol, which means that each unit of data is individually addressed and routed from the source device to the target device, and the target does not send an acknowledgement back to the source. That’s where protocols such as TCP come in. TCP is used in conjunction with IP in order to maintain a connection between the sender and the target and to ensure packet order.

For example, when an email is sent over TCP, a connection is established and a 3-way handshake is made. First, the source sends an SYN “initial request” packet to the target server in order to start the dialogue. Then the target server sends a SYN-ACK packet to agree to the process. Lastly, the source sends an ACK packet to the target to confirm the process, after which the message contents can be sent. The email message is ultimately broken down into packets before each packet is sent out into the Internet, where it traverses a series of gateways before arriving at the target device where the group of packets are reassembled by TCP into the original contents of the email.

Example :- Online Banking and Transactions

When you perform an online banking transaction, TCP is used to ensure that sensitive data such as account details and transaction information is transmitted securely and accurately. Any lost or corrupted packets are retransmitted to avoid errors

What is UDP / IP ?

The User Datagram Protocol, or UDP, is another widely used transport protocol. It is faster than TCP, but it is also less reliable. UDP does not make sure all packets are delivered and in order, and it does not establish a connection before beginning or receiving transmissions.

How does UDP work ?

Like all networking protocols, UDP is a standardized method for transferring data between two computers in a network. Compared to other protocols, UDP accomplishes this process in a simple fashion: it sends packets (units of data transmission) directly to a target computer, without establishing a connection first, indicating the order of said packets, or checking whether they arrived as intended. (UDP packets are referred to as ‘datagrams’.)

TCP vs. UDP

UDP is faster but less reliable than TCP, another common transport protocol. In a TCP communication, the two computers begin by establishing a connection via an automated process called a ‘handshake.’ Only once this handshake has been completed will one computer actually transfer data packets to the other.

UDP communications do not go through this process. Instead, one computer can simply begin sending data to the other:

In addition, TCP communications indicate the order in which data packets should be received and confirm that packets arrive as intended. If a packet does not arrive — e.g. due to congestion in intermediary networks — TCP requires that it be re-sent. UDP communications do not include any of this functionality.

These differences create some advantages. Because UDP does not require a ‘handshake’ or check whether data arrives properly, it is able to transfer data much faster than TCP.

However, this speed creates tradeoffs. If a UDP datagram is lost in transit, it will not be re-sent. As a result, applications that use UDP must be able to tolerate errors, loss, and duplication.

(Technically, such packet loss is less a flaw in UDP than a consequence of how the Internet is built. Most network routers do not perform packet ordering and arrival confirmation by design, because doing so would require an unfeasible amount of additional memory. TCP is a way of filling this gap when an application requires it.)

What is routing ?

Network routing is the process of selecting a path across one or more networks. The principles of routing can apply to any type of network, from telephone networks to public transportation. In packet-switching networks, such as the Internet, routing selects the paths for Internet Protocol (IP) packets to travel from their origin to their destination. These Internet routing decisions are made by specialized pieces of network hardware called routers.

Consider the image below. For a data packet to get from Computer A to Computer B, should it pass through networks 1, 3, and 5 or networks 2 and 4? The packet will take a shorter path through networks 2 and 4, but networks 1, 3, and 5 might be faster at forwarding packets than 2 and 4. These are the kinds of choices network routers constantly make.

How does the Internet work?

There are two main concepts that are fundamental to the way the Internet functions: packets and protocols.

Packets

In networking, a packet is a small segment of a larger message. Each packet contains both data and information about that data. The information about the packet's contents is known as the "header," and it goes at the front of the packet so that the receiving machine knows what to do with the packet. To understand the purpose of a packet header, think of how some consumer products come with assembly instructions.

When data gets sent over the Internet, it is first broken up into smaller packets, which are then translated into bits. The packets get routed to their destination by various networking devices such as routers and switches. When the packets arrive at their destination, the receiving device reassembles the packets in order and can then use or display the data.

Compare this process to the way the United States' Statue of Liberty was constructed. The Statue of Liberty was first designed and built in France. However, it was too large to fit onto a ship, so it was shipped to the United States in pieces, along with instructions about where each piece belonged. Workers who received the pieces reassembled them into the statue that stands today in New York.

While this took a long time for the Statue of Liberty, sending digital information in smaller pieces is extremely fast over the Internet. For instance, a photo of the Statue of Liberty stored on a web server can travel across the world one packet at a time and load on someone's computer within milliseconds.

Packets are sent across the Internet using a technique called packet switching. Intermediary routers and switches are able to process packets independently from each other, without accounting for their source or destination. This is by design so that no single connection dominates the network. If data was sent between computers all at once with no packet switching, a connection between two computers could occupy multiple cables, routers, and switches for minutes at a time. Essentially, only two people would be able to use the Internet at a time — instead of an almost unlimited number of people, as is the case in reality.

Protocols

Connecting two computers, both of which may use different hardware and run different software, is one of the main challenges that the creators of the Internet had to solve. It requires the use of communications techniques that are understandable by all connected computers, just as two people who grew up in different parts of the world may need to speak a common language to understand each other.

This problem is solved with standardized protocols. In networking, a protocol is a standardized way of doing certain actions and formatting data so that two or more devices are able to communicate with and understand each other.

There are protocols for sending packets between devices on the same network (Ethernet), for sending packets from network to network (IP), for ensuring those packets successfully arrive in order (TCP), and for formatting data for websites and applications (HTTP). In addition to these foundational protocols, there are also protocols for routing, testing, and encryption. And there are alternatives to the protocols listed above for different types of content — for instance, streaming video often uses UDP instead of TCP.

Because all Internet-connected computers and other devices can interpret and understand these protocols, the Internet works no matter who or what connects to it.

1. You Want to Send a Letter

Imagine you want to send a physical letter to a friend in another city. You write the letter, put it in an envelope, and write your friend's address on it.
In the Internet World:
This is like opening your web browser and typing a website address (URL). The URL is the “address” of the website you want to visit.


2. Finding the Right Address

When you mail the letter, the postal system needs to know where to deliver it. The address on the envelope is converted into a unique identifier for the destination.
In the Internet World:
When you type a URL, your computer contacts a DNS (Domain Name System) server, which acts like a directory. It translates the website name (e.g., www.google.com) into an IP address (e.g., 142.250.190.14), which computers use to locate each other.


3. Sending Through the Network

The postal service routes your letter through various post offices and transport systems until it reaches your friend’s city.
In the Internet World:
Data is broken into smaller packets, which are sent through a series of routers (like digital post offices). Each router forwards the packet closer to its destination.


4. Reaching the Destination

When the letter reaches your friend’s mailbox, they open it and read the message.
In the Internet World:
When the packets reach the destination server (e.g., Google’s server), the server processes your request and prepares a response.


5. Sending a Response

Now your friend writes a reply and sends it back to you using the postal system.
In the Internet World:
The server sends packets of data back to your computer (e.g., the HTML, images, and other elements of the webpage). Your browser then assembles these packets to display the website.


Key Components and Real-Life Roles

  1. Web Browser (You): The one initiating the communication (e.g., requesting the website).

  2. DNS (Post Office Directory): Translates website names into IP addresses.

  3. Routers (Post Offices): Direct data packets from one place to another.

  4. IP Address (Address on Envelope): Unique identifier for devices on the network.

  5. Packets (Letters): Small pieces of data that are sent individually.

  6. Servers (Your Friend): Provide the information or service you requested.


Example in Action

When you search for "pizza" on Google:

  1. Your browser sends the request to Google’s IP address (via DNS).

  2. Routers direct the data packets to Google’s server.

  3. Google’s server processes the query and sends packets with search results back to you.

  4. Your browser displays the search results by assembling the packets.

0
Subscribe to my newsletter

Read articles from Farhan Khan directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Farhan Khan
Farhan Khan