DEV Community

Cover image for TCP / IP Stack - Oversimplified for Web Developers 🌍🧑🏻‍💻
Jean-Paul Rustom
Jean-Paul Rustom

Posted on

TCP / IP Stack - Oversimplified for Web Developers 🌍🧑🏻‍💻

Here is the animated version for those of you who prefer interactive videos:

Introduction

The TCP / IP model is a conceptual model of how communications are made over the internet, and is consists of 4 layers.

Layers of TCP / IP

1. The Application Layer

The application layer is the layer that interacts directly with the end user, providing the services and applications that allows user to access and use the network resources.

They are software applications you use on your computer, such as web browsers, email clients and messaging apps.

Example: Applications that allows Internet access
Example: web browser, messaging apps

These use protocols such as:

  • HTTPS
  • DNS
  • SMTP
  • FTP
  • SSH

2. The Transport Layer

The transport layer provides data transport services to and from the application layer. It offers two main options for data transportation: reliable and efficient or unreliable and fast.

This layer uses protocols like TCP to provide reliable communication between two devices, and UDP to provide fast but unreliable transmission. (More on these in my other articles)

The transport layer takes the application data (for eg an HTTP POST request) from the application layer and packages it into segments, which are then sent over the internet using port numbers.

Structure of a TCP segment on a high level

3. The Network Layer

This layer is responsible for routing the data across multiple networks and it uses protocols such as the IP protocol.

ip protocol route.png

It takes the data from the transport layer and packages it into packets, which are then sent over the Internet using IP addresses.

Think of it like a postal service that can deliver letters across the globe.

It needs to know the destination and the best route to get there. The Internet layer uses IP addresses to identify different networks and determines the best path for data to travel across them.

The network layer is considered an unreliable protocol as it does not guarantee the delivery of packets or their order. The reliability of communication is achieved by higher protocols such as TCP which use IP as their underlying transport mechanism.

4. The Link Layer

The link layer is responsible for taking the raw bits of data from the physical layer, and organizing them into frames, then moving data between devices that are physically connected.

Image description

Think of it like a postman that is delivering letters within the same neighborhood. The postman needs to know the addresses of the sender and the recipient, and also needs to make sure that the letters are properly packaged and labeled.

In the same way, the data link layer uses frames to package data and add information such as source and destination MAC addresses to ensure it gets delivered to the correct device.

Top comments (0)