How data moves from A to B in the network?
What are the different networking layers involved?
In the last post, I covered the high level details of what happens when you type “google.com” in the browser. There were mentions of user sending a request from their device to the server (google.com) and the server responding back to the user. In this post, I will zoom into a sub-section of the details specifically on how data is transferred from A to B in the networking world. To keep it shorter - I will use “user’s device” as A and “the Internet” as B.
Like the last time, I will use an example to make it simpler.
Imagine you want to send a physical letter to your friend (Yes, I did mean physical. It is very uncommon in this day and age to write and send a physical letter. But bear with me, it is just for explaining the concept). Lets try to break down the steps involved here.
Write the letter on a piece of paper. You will start out with something like “Dear <Friend Name>”, write down what you intended to share and then wrap up by something like “Yours lovingly” and your name.
To ensure that the content of the letter is private and safe, you would put your letter inside an envelope. On top of the envelope, you would write your friends address as “To address” and your address as “From address” and go drop it in the nearest mailbox. This will be the last thing you would do on your part. The rest is taken care by the postal infrastructure.
A postal office employee will pick up all the letters from the mailbox and take it to the post office.
Once it reaches the local post office, your letter will be sorted based on the destination address and further transported till it eventually reaches a local post office from where the letter can be delivered to your friend.
Now lets map these steps in the networking world.
Lets consider that you typed “google.com” in your browser address bar and pressed enter.
Your browser will construct a request.
Similar to how you would write “Dear <Friend Name”, your browser will create a request and fill in the destination server like “Host: www.google.com”.
And similar to how you would add your signature or name at the end of the letter, your browser will add some description about your browser that you are using via User Agent field.
In the networking layers, this part is called the Application Layer. As you can see - all of the work here is done by your application (browser).
Protocols like HTTP or HTTPS are commonly used for web-browsing. “google.com” does use HTTPS.
Your browser will then interact with your local device’s operating system to create an envelope for your request. Envelope will contain your IP address (your device’s digital address) and the IP address of “google.com”.
To map this step to the example, you can think of the browser as you and your local device (your phone or laptop’s operating system) as the mailbox.
In the networking layer, this is called the Transport / Network Layer.
Protocols like TCP or UDP are used in the Transport Layer. In this case of viewing “google.com”, TCP will be used.
Protocol called IP is commonly used in the Network Layer.
There are also additional details like port numbers and book-keeping details like sequence number added to the envelope.
Your local device will then send your envelope to your home router.
To map it to the example, your device is the mailbox and your home router is the local post office.
Your device will determine to whom this envelope should be sent to based on the destination IP address. Since your device only knows about the other devices in your home and has information that the router is the device that can route your data eventually to your destination, it decides to send it to your router.
In order for your device to send the data to your router, it has to know the physical address of your router. Every networking device has a physical address called MAC (media access control) address. Your device will put your envelope in step 2 (lets call it IP envelope) inside another envelope with your device’s MAC address and your router’s MAC address.
This layer is called Data link layer and typically MAC is a standard used here.
You might think that - the post did mention about how data moves from A to B, but I am almost at the end of the post but the data has not moved out of the device yet. Yes, that is correct. Data is moved only in this final step. Here goes - the final envelope with the MAC address will be physically sent from your device to the router.
This layer is called the Physical layer where the digital data is converted into analog signals and sent through a wire (ethernet) or air (in case of Wi-Fi).
Your router will then sort out how your data should further be transported so that it will reach your final destination i.e., one of the google servers hosting “google.com”. This is where your data moves out from your house and enters “the Internet”.
To recap, we went through how a physical letter that you write to your friend will reach them. Then mapped them to the networking world and touched upon the different networking layers in this post.
Application Layer
Transport Layer
Network Layer
Data Link Layer
Physical Layer
How data is moved from one layer to the other should give you a high-level understanding of the networking world and better understand how the communication happens in the digital world.
Couple of Caveats
There is also a 7 layer OSI model which is conceptual in nature, the post above is about TCP/IP model which is used widely in practice.
Data Link and Physical layer are composed into a single layer called Network Access. I have split them into two based on OSI model for ease of explanation.
Like my other posts, this post is an abstracted version and only scratching the surface of each of the networking layers.

