HiBlog Networking and Protocols

What Is the TCP/IP Model? The Four Network Layers Explained Simply

  • Ali GhanimatiAuthor
  • Last updated
  • 5 minutesReading time
  • 458Views
  • Ali Ghanimati
  • Last updated:
  • 5 min read
  • 458 views
What Is the TCP/IP Model? The Four Network Layers Explained Simply

You type a site’s address into your browser and the page opens in less than a second. Behind that one moment, dozens of rules work hand in hand so your request travels from your computer, through modems and routers, to a server on the other side of the world, and the right answer comes back. The name of that set of rules is TCP/IP.

In this article we explain what the TCP/IP model is, what each of its four layers does, how TCP and UDP differ and how a web request moves along step by step. At the end we share a few practical commands for checking a server’s network.

Short answer: TCP/IP is the set of protocols the internet runs on, arranged in four layers: application (such as HTTP and DNS), transport (TCP and UDP), internet (IP) and network access (such as Ethernet and Wi-Fi). Each layer does its own job and hands the data to the next one. TCP guarantees complete, in-order delivery, while UDP is faster but guarantees nothing.

What is TCP/IP?

Strictly speaking, TCP/IP is the name of two important protocols, TCP and IP, but today it refers to the whole internet protocol suite. The model was built in the 1970s for the ARPANET, and RFC 1122 describes its layers for devices connected to the internet. Unlike the seven-layer OSI model, which is mostly used for teaching, TCP/IP is what actually runs on every computer and server.

The four layers of the TCP/IP model

1. Application layer

The layer closest to programs. Protocols such as HTTP and HTTPS for the web, DNS for finding a domain’s IP, SMTP and IMAP for email and SSH for managing servers live in this layer. In this model, TLS encryption also counts as part of this layer.

2. Transport layer

It splits data into segments and uses port numbers to mark which program each segment belongs to; for example, port 443 for HTTPS and 22 for SSH. The two main protocols of this layer are TCP and UDP.

3. Internet layer

It labels every packet with a source and destination IP, and routers use that to find the best path for it. The main protocol of this layer is IP, in its two versions IPv4 and IPv6, and ICMP, which the ping command uses, belongs to this layer too.

4. Network access layer

The actual movement of bits over cable, fiber or Wi-Fi. Data is packed into frames and reaches the next device on the same network by its hardware (MAC) address. Ethernet and Wi-Fi are protocols of this layer.

A web request from start to finish

  1. The browser uses DNS, usually over UDP port 53, to find the site’s server IP.
  2. It opens a TCP connection to the server on port 443: SYN, SYN-ACK and ACK.
  3. Over that connection, TLS exchanges keys and the connection is encrypted.
  4. The browser sends the HTTP request. Each layer adds its own header to the data (encapsulation) so the packets can travel over the network.
  5. At the destination, the server unwraps the headers layer by layer and sends the response back the same way.

HTTP/3 does the same thing over the QUIC protocol and UDP instead of TCP, so connections are set up faster.

TCP vs UDP

TCPUDP
ConnectionSets up a connection before sendingNo connection setup
DeliveryGuarantees complete, in-order deliveryNo guarantee
SpeedSlower, because of acknowledgments and resendingFaster and lighter
Used forThe web, email, SSH and file transferDNS, voice and video calls, online games and HTTP/3

When the network is busy, TCP adjusts its sending speed with congestion control algorithms; we compare its two best-known algorithms in BBR vs CUBIC.

TCP/IP or OSI?

The OSI model has seven layers: application, presentation, session, transport, network, data link and physical. TCP/IP folds OSI’s top three layers into its application layer and the bottom two into its network access layer. OSI is useful for teaching and troubleshooting, while TCP/IP is what works in practice.

A few commands for checking a server’s network

CommandWhat it shows
ping hidata.orgWhether packets arrive, and the round-trip time
traceroute hidata.orgThe path packets take through routers (tracert on Windows)
ip aThe IPs of a Linux server’s network interfaces
ss -tulpnThe ports the server’s services listen on
nslookup hidata.orgThe DNS answer for a domain

If a site won’t open, these commands show whether the problem is in DNS, on the network path or in the service itself. For browser DNS errors, see How to Fix DNS_PROBE_FINISHED_NXDOMAIN.

FAQ

What’s the difference between IPv4 and IPv6?

IPv4 has 32-bit addresses, about four billion of them, which have nearly run out. IPv6 has 128-bit addresses and is practically inexhaustible. Both work at the internet layer.

What is a port?

A number at the transport layer that tells which program on the server a packet belongs to; one IP can serve a website, email and SSH at the same time on different ports.

Why does ping sometimes fail while the site still opens?

Many servers and firewalls block ICMP packets. A ping that gets no answer doesn’t always mean the server is down.

Your server’s network in your hands

On HiData’s Iran NVMe virtual servers you have root access, so you run all these commands and set up the firewall and ports yourself, and if the server’s network becomes unreachable, you get to the server from the VNC console in the Virtualizor panel. See the plans on our virtual servers page, or get a free 24-hour test server!

Share Post

hidata.org/en/blog/what-is-tcp-ip-protocol/
In Social Media

Add Comment

Related Articles