How internet works: An informal introduction

Danish KhanDanish Khan
7 min read

In this series, we’ll explore how the internet works by diving into core networking concepts. I’ve often seen students struggle to grasp these ideas due to the overwhelming technical jargon and lack of relatable examples. This series aims to change that. We’ll focus on practical, real-world examples to explain the process of networking, starting with a basic overview of how it all works. From there, we’ll introduce the OSI and TCP/IP models as a framework for understanding the entire process. The main focus will be on the Transport and Network layers, which are the heart of internet functionality. While we’ll touch on the Physical and Data Link layers, they won’t be discussed in detail.

The goal is to give you a comprehensive, easy-to-follow guide to understanding the internet’s working, not a deep dive into every technical detail of Computer network subject. Yet it will be comprehensive guide. This series is perfect for junior web developers, students who wants to start DevOps or anyone needing to understand how the internet works as part of their foundational knowledge. It’s designed to provide clarity without getting lost in complex networking theories.

This is first blog of the How internet work series. So i hope you have read till here and acknowledge that you are one from the target audience.

Networking refers to a system where devices are connected together to communicate and share resources. A network can consist of computers, servers, printers, and other devices linked in various ways, forming a system that allows these devices to interact. The internet is the most expansive example of a network, often described as a global network of interconnected networks. We have devices in network. We call them nodes. Node can be client or server. If it’s sending data, it’s server, if it’s requesting data it’s client. Most of the devices are capable of both. Cool.

Consider a scenario where your PC is connected to the internet via your mobile's hotspot. Your mobile device has an internet connection provided by an ISP (Internet Service Provider). The ISP assigns a unique public IP address to your mobile device. IP addresses are like the name of the device, so network can recognize the device to communicate with it. There are different types of name. consider it like your friend network, and your collage classroom network. In your friend network you may call your friend by his/her nickname, while in classroom you and all of the students have unique role numbers. So in the case of IP addresses, we have local IP and Public IP. Local IP is to recognize device within a local area network, while public IP is to recognize device on the internet as a whole. Check the IP address in your mobile device, typically in about phone -> status. These IP addresses are unique across the entire internet: Public IP address. Here’s how my mobile IPs looks like. we will be covering the details in further section.

When your PC connects to the mobile's network, it becomes part of a Local Area Network (LAN) managed by the mobile device. Your mobile and device connected to the hotspot of your mobile. This creates a small network, which can be called LAN - local area network. where managing the IP addresses of connected device and communication to the internet all managed by your mobile. this is described as deafult gateway. A device which is main actor in LAN. Do not worry about the techinical definitions right now, we will surely come to that. try to follow the flow of current example.

Do ipconfig command in PC: so if you see the ip address 192.168.x.x everywhere, I mean everywhere, do not be confused like, shouldn’t be it unique? These are Local addresses. Open up your mobile and pc and try this command to remove your confusion.

Here, all the address are given by mobile. Which is default gateway. Default gateway here is local address of my mobile in this case.

When you type "google.com" into your PC's browser, the process begins with your PC needing to find the IP address of the Google server that hosts the requested resources. This is where the DNS (Domain Name System) comes into play. Your PC forwards the request to the mobile network, by sending it to default gateway address(192.168.43.1) here, which then queries a DNS server to translate "google.com" to its corresponding IP address. Consider it as we can recognize the person by face, but in paper records it requires registered name. so as we can recognize google.com by looking at it, but to send request to gooogle.com, we need the IP address of it. Once the IP address gets determined, your mobile device makes an HTTPS request to the Google server.

However, the request originating from your PC contains your PC's local IP address(192.168.43.133 here), which is not routable on the internet. So, typical ip addresses you see 192.168.x.x on different tutorials taking it for explainations, are not which used for communicating on the networks.

Before the request is sent out to the internet, the NAT (Network Address Translation) function on your mobile device replaces the PC's local IP address with the mobile's public IP address(100.86.218.101)see the image of my mobile IPs. The request is then sent to the local cellular tower, through the ISP, and eventually reaches Google's server.

The server processes the request and sends a response back. This response first travels through the ISP, which forwards it to your mobile device's public IP address. NAT on your mobile device translates the public IP address back to your PC's local IP address, ensuring the response reaches the correct device within your local network.

Each device on a network can run multiple applications, each potentially requiring a response from the internet. Here in case if you are playing a game online, your chrome browser also running from where you sent the Google.com request, how do we know that response should reach to the particular application - browser? To manage this, network communication relies on ports. As IP address used to recognize the devices on the internet, ports are used for recognizing applications on the device. When your PC's browser made the request, it used a specific port number, which is noted in the response. So when the response comes back, it knows which application (in this case, your web browser) to deliver the data to. This way, the correct application on your PC receives the appropriate response.

From above discussion, there are many definitions and concepts derived which we will walk through. As title of the series says, with and without jargons...

Key Terminologies Explained

ISP (Internet Service Provider): The company that provides your mobile device with internet access, assigning it a public IP address to connect to the internet.

Public IP Address: An IP address assigned by the ISP that is unique and accessible over the internet. It identifies your mobile device on the global network.Note that, these addresses are ever changing. ISP which assigns this unique public IP addresses, it’s temporary, yet unique. At the moment of assignment, ISP has multiple available addresses which are not used & available for public. When some devices disconnect from internet, that IP becomes available for ISP to assign it to other devices. Details in further sections…

Local Area Network (LAN): A network within a localized area, such as your mobile's hotspot, where devices like your PC connect and communicate.

Private IP Address: An IP address assigned to devices within a LAN, not routable on the public internet, used for internal communication within the network.

Default Gateway: The routing device (in our example, your mobile) that connects your LAN to the internet, serving as the point where all outbound internet requests are sent.

DNS (Domain Name System): The system that translates domain names (like google.com) into IP addresses, allowing devices to locate and communicate with servers on the internet.

NAT (Network Address Translation): A process that modifies network address information in packet headers, translating private IP addresses to public IP addresses and vice versa, enabling devices within a LAN to access the internet.

Ports: Virtual endpoints in a device's operating system used for managing multiple communication sessions, ensuring that responses from the internet are delivered to the correct application.

Now as we understand the concept of how the data roams from your laptop to the server and what are steps involved, we can visualize and understand OSI model properly which if we try to understand in first place, we cannot relate to it. So keep this example of Sending request to Google.com, we discussed above. Now you may have many doubts and some concepts being unclear which will get clear by the next blogs, where we will continue our example discussed above, and dive into each step involved.

Thanks for reading...

2
Subscribe to my newsletter

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

Written by

Danish Khan
Danish Khan

I'm a backend devloper using python, django as my stack. I also have beginner level skills in DevOps like Linux, Virtual machines, OS, networking. Right now learning and expanding skills in DevOps