TCP/IP Model Explained: Layers, Protocols and a Packet Walk-Through

The TCP/IP model is the four-layer framework the internet is built on.

Jul 28, 2025 - 16:44
Updated: 
102.9k

Networking in IT Infrastructure · Explainer

TCP/IP Model Explained: Layers, Protocols and a Packet Walk-Through

Quick answer: The TCP/IP model is the four-layer framework the internet is built on. The application layer holds protocols users and programs work with, such as HTTP, DNS and SMTP; the transport layer (TCP and UDP) moves data between programs using port numbers; the internet layer (IP and ICMP) routes packets between networks using IP addresses; and the link layer (Ethernet, Wi-Fi) delivers frames on the local network using MAC addresses. As data goes down the layers each adds a header, and the receiver removes them in reverse. Knowing which layer a problem or attack sits on is the starting point for troubleshooting and security.

Key takeaways

  • The four layers are application, transport, internet and link, as described in RFC 1122.
  • Each layer adds its own header: encapsulation on the way down, decapsulation on the way up.
  • TCP is reliable and ordered; UDP is lightweight and leaves reliability to the application.
  • The OSI model has seven layers and is mainly a teaching and troubleshooting reference.
  • Attacks and defences map to layers, from ARP spoofing to application exploits.

Table of Contents

What Is the TCP/IP Model?

The model grew out of ARPANET research in the 1970s and was formalised in RFC 1122 in 1989. It is named after its two core protocols, TCP and IP. Some textbooks split the link layer into data link and physical, giving five layers; the RFC uses four.

What Does Each Layer Do?

LayerJobAddressingExample protocolsData unit
ApplicationServices for programs and usersNames and URLsHTTP, HTTPS, DNS, SMTP, SSH, DHCPMessage
TransportProcess-to-process delivery, reliability, flow controlPort numbersTCP, UDP, QUICSegment or datagram
InternetRouting between networksIP addressesIPv4, IPv6, ICMPPacket
LinkDelivery on the local networkMAC addressesEthernet, Wi-Fi (802.11), ARPFrame

How Does Encapsulation Work?

An HTTP request becomes the payload of a TCP segment, whose header adds source and destination ports, sequence numbers and flags. That segment becomes the payload of an IP packet, whose header adds source and destination IP addresses and a time-to-live. The packet becomes the payload of an Ethernet frame with MAC addresses and a checksum. Routers strip and rebuild the link-layer frame at every hop, but the IP packet travels end to end.

How Does a Web Request Move Through the Layers?

  1. DNS: the browser asks a resolver for the IP address of www.example.com, usually over UDP port 53.
  2. ARP: to reach the default gateway, the computer finds the gateway's MAC address.
  3. TCP handshake: SYN, SYN-ACK, ACK to port 443, as defined in RFC 9293.
  4. TLS handshake: client and server agree keys and the server proves its identity with a certificate.
  5. HTTP: the browser sends GET / inside the encrypted session.
  6. Routing: routers forward each packet by destination IP, decrementing TTL.
  7. Response: the server's data returns the same way, and TCP reassembles it in order.

How Can You See the Layers Yourself?

Capture your own traffic with tcpdump (or Wireshark) while making a request:

# terminal 1: capture DNS and HTTPS traffic, show link-layer headers too
sudo tcpdump -i any -n -e "port 53 or port 443" -c 20

# terminal 2: make a request and watch each stage
curl -v https://example.com/ -o /dev/null

In the output you will see the DNS query and answer, then three packets with flags [S], [S.] and [.] (the TCP handshake), then the TLS exchange. curl -v prints the same steps from the application's view: resolving, connecting, TLS and the HTTP request.

What Is the Difference Between TCP, UDP and QUIC?

TCPUDPQUIC
ConnectionHandshake firstNoneHandshake combined with TLS 1.3
Reliability and orderBuilt inNoneBuilt in, per stream
Header size20 bytes minimum8 bytesRuns over UDP
Typical useWeb, email, SSH, file transferDNS, VoIP, gaming, streamingHTTP/3

QUIC builds reliable, encrypted streams on top of UDP, avoiding head-of-line blocking between streams.

How Does TCP/IP Compare With the OSI Model?

TCP/IP layerOSI layers
Application7 Application, 6 Presentation, 5 Session
Transport4 Transport
Internet3 Network
Link2 Data Link, 1 Physical

Engineers often say "layer 2" or "layer 7" using OSI numbers even when talking about TCP/IP networks. See our OSI model guide.

How Do Attacks Map to the Layers?

LayerExample attacksDefences
ApplicationSQL injection, phishing, DNS spoofingInput validation, WAF, DNSSEC, user training
TransportSYN floods, port scanning, session hijackingSYN cookies, firewalls, TLS
InternetIP spoofing, ICMP floods, route hijackingIngress filtering, rate limiting, RPKI
LinkARP spoofing, MAC flooding, rogue access pointsDynamic ARP inspection, port security, WPA3, 802.1X

Continue with subnetting and TLS versus IPsec VPNs, or talk to a WebAsha training advisor about CCNA training.

References

Frequently Asked Questions

Application, transport, internet and link, as described in RFC 1122.

It delivers data between programs using port numbers, with TCP adding reliability and ordering.

Each layer wraps the data from the layer above with its own header before passing it down.

TCP sets up a connection and guarantees ordered delivery; UDP sends datagrams with no guarantees.

TCP/IP has four practical layers; OSI has seven and is mainly used as a reference model.

The internet layer, forwarding packets by destination IP address.

A transport protocol over UDP with built-in encryption and streams, used by HTTP/3.

Every attack and defence sits at a layer, so the model guides analysis, detection and troubleshooting.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.